private void butOK_Click(object sender, System.EventArgs e) { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateTo.errorProvider1.GetError(textDateTo) != "" ) { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (listProv.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one provider must be selected."); return; } if (listProv.SelectedIndices[0] == 0 && listProv.SelectedIndices.Count > 1) { MsgBox.Show(this, "You cannot select 'all' providers as well as specific providers."); return; } DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); string whereProv = ""; if (listProv.SelectedIndices[0] != 0) { for (int i = 0; i < listProv.SelectedIndices.Count; i++) { if (i == 0) { whereProv += " WHERE ("; } else { whereProv += "OR "; } whereProv += "patient.PriProv = " + POut.Long(ProviderC.ListShort[listProv.SelectedIndices[i] - 1].ProvNum) + " "; } whereProv += ") "; } ReportSimpleGrid report = new ReportSimpleGrid(); report.Query = @"SET @pos=0; SELECT @pos:=@pos+1 patCount,result.* FROM (SELECT dateFirstProc,patient.LName,patient.FName," + DbHelper.Concat("referral.LName", "IF(referral.FName='','',',')", "referral.FName") + " refname,SUM(procedurelog.ProcFee) ";//\"$HowMuch\""; if (DataConnection.DBtype == DatabaseType.MySql) { report.Query += "$HowMuch"; } else //Oracle needs quotes. { report.Query += "\"$HowMuch\""; } if (checkAddress.Checked) { report.Query += ",patient.Preferred,patient.Address,patient.Address2,patient.City,patient.State,patient.Zip"; } report.Query += @" FROM (SELECT PatNum, MIN(ProcDate) dateFirstProc FROM procedurelog WHERE ProcStatus=2 GROUP BY PatNum HAVING dateFirstProc >= " + POut.Date(dateFrom) + " " + "AND DATE(dateFirstProc) <= " + POut.Date(dateTo) + " ) table1 " + @"INNER JOIN patient ON table1.PatNum=patient.PatNum LEFT JOIN procedurelog ON patient.PatNum=procedurelog.PatNum AND procedurelog.ProcStatus=2 LEFT JOIN refattach ON patient.PatNum=refattach.PatNum AND refattach.IsFrom=1 AND refattach.ItemOrder=(SELECT MIN(ra.ItemOrder) FROM refattach ra WHERE ra.PatNum=refattach.PatNum AND ra.IsFrom=1) LEFT JOIN referral ON referral.ReferralNum=refattach.ReferralNum " + whereProv; report.Query += "GROUP BY patient.LName,patient.FName,patient.PatNum," + DbHelper.Concat("referral.LName", "IF(referral.FName='','',',')", "referral.FName"); if (checkAddress.Checked) { report.Query += ",patient.Preferred,patient.Address,patient.Address2,patient.City,patient.State,patient.Zip "; } if (checkProd.Checked) { if (DataConnection.DBtype == DatabaseType.MySql) { report.Query += "HAVING $HowMuch > 0 "; } else //Oracle needs quotes. { report.Query += "HAVING \"$HowMuch\" > 0 "; } } report.Query += "ORDER BY dateFirstProc,patient.LName,patient.FName) result"; FormQuery2 = new FormQuery(report); FormQuery2.IsReport = true; FormQuery2.SubmitReportQuery(); report.Title = "New Patients"; report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle)); if (listProv.SelectedIndices[0] == 0) { report.SubTitle.Add(Lan.g(this, "All Providers")); report.SubTitle.Add(dateFrom.ToString("d") + " - " + dateTo.ToString("d")); } else if (listProv.SelectedIndices.Count == 1) { report.SubTitle.Add(Lan.g(this, "Prov: ") + ProviderC.ListShort[listProv.SelectedIndices[0] - 1].GetLongDesc()); report.SubTitle.Add(dateFrom.ToString("d") + " - " + dateTo.ToString("d")); } else { //I'm too lazy to build a description for multiple providers as well as ensure that it fits the space. report.SubTitle.Add(dateFrom.ToString("d") + " - " + dateTo.ToString("d")); } report.SetColumnPos(this, 0, "#", 40); report.SetColumnPos(this, 1, "Date", 120); report.SetColumnPos(this, 2, "Last Name", 210); report.SetColumnPos(this, 3, "First Name", 300); report.SetColumnPos(this, 4, "Referral", 380); report.SetColumnPos(this, 5, "Production", 450, HorizontalAlignment.Right); if (checkAddress.Checked) { report.SetColumnPos(this, 6, "Pref'd", 500); report.SetColumnPos(this, 7, "Address", 570); report.SetColumnPos(this, 8, "Add2", 630); report.SetColumnPos(this, 9, "City", 680); report.SetColumnPos(this, 10, "ST", 730); report.SetColumnPos(this, 11, "Zip", 880); //off the right side } FormQuery2.ShowDialog(); DialogResult = DialogResult.OK; }
private void radioDoseSpotLegacy_Click(object sender, EventArgs e) { MsgBox.Show(this, "This enables the DoseSpot program link only. You must contact support to cancel current eRx Legacy charges and sign up for DoseSpot."); SetRadioButtonChecked(ErxOption.DoseSpotWithLegacy); }
///<summary>Saves the selected rows to database. MUST close window after this.</summary> private bool SaveToDB() { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return(false); } //Prevent backdating---------------------------------------------------------------------------------------- DateTime date = PIn.PDate(textDate.Text); if (IsNew) { if (!Security.IsAuthorized(Permissions.DepositSlips, date)) { return(false); } } else { //We enforce security here based on date displayed, not date entered if (!Security.IsAuthorized(Permissions.DepositSlips, date)) { return(false); } } DepositCur.DateDeposit = PIn.PDate(textDate.Text); //amount already handled. DepositCur.BankAccountInfo = PIn.PString(textBankAccountInfo.Text); if (IsNew) { Deposits.Insert(DepositCur); if (Accounts.DepositsLinked() && DepositCur.Amount > 0) { //create a transaction here Transaction trans = new Transaction(); trans.DepositNum = DepositCur.DepositNum; trans.UserNum = Security.CurUser.UserNum; Transactions.Insert(trans); //first the deposit entry JournalEntry je = new JournalEntry(); je.AccountNum = DepositAccounts[comboDepositAccount.SelectedIndex]; je.CheckNumber = Lan.g(this, "DEP"); je.DateDisplayed = DepositCur.DateDeposit; //it would be nice to add security here. je.DebitAmt = DepositCur.Amount; je.Memo = Lan.g(this, "Deposit"); je.Splits = Accounts.GetDescript(PrefB.GetInt("AccountingIncomeAccount")); je.TransactionNum = trans.TransactionNum; JournalEntries.Insert(je); //then, the income entry je = new JournalEntry(); je.AccountNum = PrefB.GetInt("AccountingIncomeAccount"); //je.CheckNumber=; je.DateDisplayed = DepositCur.DateDeposit; //it would be nice to add security here. je.CreditAmt = DepositCur.Amount; je.Memo = Lan.g(this, "Deposit"); je.Splits = Accounts.GetDescript(DepositAccounts[comboDepositAccount.SelectedIndex]); je.TransactionNum = trans.TransactionNum; JournalEntries.Insert(je); } } else { Deposits.Update(DepositCur); } if (IsNew) //never allowed to change or attach more checks after initial creation of deposit slip { for (int i = 0; i < gridPat.SelectedIndices.Length; i++) { PatPayList[gridPat.SelectedIndices[i]].DepositNum = DepositCur.DepositNum; Payments.Update(PatPayList[gridPat.SelectedIndices[i]]); } for (int i = 0; i < gridIns.SelectedIndices.Length; i++) { ClaimPayList[gridIns.SelectedIndices[i]].DepositNum = DepositCur.DepositNum; ClaimPayments.Update(ClaimPayList[gridIns.SelectedIndices[i]]); } } if (IsNew) { SecurityLogs.MakeLogEntry(Permissions.DepositSlips, 0, DepositCur.DateDeposit.ToShortDateString() + " New " + DepositCur.Amount.ToString("c")); } else { SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, 0, DepositCur.DateDeposit.ToShortDateString() + " " + DepositCur.Amount.ToString("c")); } return(true); }
///<summary>Gets the patient info from the MedLab.OriginalPIDSegments. Returns null if there is an error processing the PID segments.</summary> private List <string[]> GetPatInfoFromPidSegments() { List <string[]> listPats = new List <string[]>(); HL7Def hl7DefCur = HL7Defs.GetOneDeepEnabled(true); if (hl7DefCur == null) { MsgBox.Show(this, "There must be an enabled MedLab HL7 interface in order to parse the message details."); return(null); } HL7DefMessage hl7defmsg = null; for (int i = 0; i < hl7DefCur.hl7DefMessages.Count; i++) { //for now there are only incoming ORU messages supported, so there should only be one defined message type and it should be inbound if (hl7DefCur.hl7DefMessages[i].MessageType == MessageTypeHL7.ORU && hl7DefCur.hl7DefMessages[i].InOrOut == InOutHL7.Incoming) { hl7defmsg = hl7DefCur.hl7DefMessages[i]; break; } } if (hl7defmsg == null) { MsgBox.Show(this, "There must be a message definition for an inbound ORU message in order to parse this message."); return(null); } //for MedLab interfaces, we limit the ability to rearrange the message structure, so the PID segment is always in position 1 if (hl7defmsg.hl7DefSegments.Count < 2) { MsgBox.Show(this, "The message definition for an inbound ORU message does not have the correct number of segments."); return(null); } HL7DefSegment pidSegDef = hl7defmsg.hl7DefSegments[1]; if (pidSegDef.SegmentName != SegmentNameHL7.PID) { MsgBox.Show(this, "The message definition for an inbound ORU message does not have the PID segment as the second segment."); return(null); } for (int i = 0; i < ListMedLabs.Count; i++) { string[] fields = ListMedLabs[i].OriginalPIDSegment.Split(new string[] { "|" }, StringSplitOptions.None); List <FieldHL7> listFields = new List <FieldHL7>(); for (int j = 0; j < fields.Length; j++) { listFields.Add(new FieldHL7(fields[j])); } string patName = ""; string birthdate = ""; string gender = ""; string ssn = ""; for (int j = 0; j < pidSegDef.hl7DefFields.Count; j++) { int itemOrder = pidSegDef.hl7DefFields[j].OrdinalPos; if (itemOrder > listFields.Count - 1) { continue; } switch (pidSegDef.hl7DefFields[j].FieldName) { case "pat.nameLFM": patName = listFields[itemOrder].GetComponentVal(1); if (patName != "" && listFields[itemOrder].GetComponentVal(2) != "") { patName += " "; } patName += listFields[itemOrder].GetComponentVal(2); if (patName != "" && listFields[itemOrder].GetComponentVal(0) != "") { patName += " "; } patName += listFields[itemOrder].GetComponentVal(0); continue; case "patBirthdateAge": //LabCorp sends the birthdate and age in years, months, and days like yyyyMMdd^YYY^MM^DD birthdate = FieldParser.DateTimeParse(listFields[itemOrder].GetComponentVal(0)).ToShortDateString(); continue; case "pat.Gender": gender = Lan.g("enumPatientGender", FieldParser.GenderParse(listFields[itemOrder].GetComponentVal(0)).ToString()); continue; case "pat.SSN": if (listFields[itemOrder].GetComponentVal(0).Length > 3) { ssn = "***-**-"; ssn += listFields[itemOrder].GetComponentVal(0).Substring(listFields[itemOrder].GetComponentVal(0).Length - 4, 4); } continue; default: continue; } } bool isDuplicate = false; for (int j = 0; j < listPats.Count; j++) { if (listPats[j].Length < 4) //should never happen { continue; } if (listPats[j][0] == patName && listPats[j][1] == birthdate && listPats[j][2] == gender && listPats[j][3] == ssn) { isDuplicate = true; } } if (!isDuplicate) { listPats.Add(new string[] { patName, birthdate, gender, ssn }); } } return(listPats); }
private void butImport_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = false; if (dlg.ShowDialog() != DialogResult.OK) { return; } if (!File.Exists(dlg.FileName)) { MsgBox.Show(this, "File does not exist."); return; } if (!ImageHelper.HasImageExtension(dlg.FileName)) { MsgBox.Show(this, "Only allowed to import an image."); return; } string newName = dlg.FileName; if (PrefC.AtoZfolderUsed == DataStorageType.LocalAtoZ) { newName = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), Path.GetFileName(dlg.FileName)); if (File.Exists(newName)) { MsgBox.Show(this, "A file of that name already exists in SheetImages. Please rename the file before importing."); return; } File.Copy(dlg.FileName, newName); } else if (CloudStorage.IsCloudStorage) { if (CloudStorage.FileExists(ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), Path.GetFileName(dlg.FileName)))) { MsgBox.Show(this, "A file of that name already exists in SheetImages. Please rename the file before importing."); return; } FormProgress FormP = new FormProgress(); FormP.DisplayText = Lan.g(CloudStorage.LanThis, "Uploading..."); FormP.NumberFormat = "F"; FormP.NumberMultiplication = 1; FormP.MaxVal = 100; //Doesn't matter what this value is as long as it is greater than 0 FormP.TickMS = 1000; OpenDentalCloud.Core.TaskStateUpload state = CloudStorage.UploadAsync(SheetUtil.GetImagePath(), Path.GetFileName(dlg.FileName) , File.ReadAllBytes(dlg.FileName) , new OpenDentalCloud.ProgressHandler(FormP.OnProgress)); if (FormP.ShowDialog() == DialogResult.Cancel) { state.DoCancel = true; return; } newName = Path.GetFileName(dlg.FileName); //It would be nice to save the image somewhere so that we don't have to download it again. } FillCombo(); for (int i = 0; i < comboFieldName.Items.Count; i++) { if (comboFieldName.Items[i].ToString() == Path.GetFileName(newName)) { comboFieldName.SelectedIndex = i; comboFieldName.Text = Path.GetFileName(newName); FillImage(); ShrinkToFit(); } } }
///<summary>Return false to indicate exit app. Only called when program first starts up at the beginning of FormOpenDental.PrefsStartup.</summary> public bool Convert(string fromVersion, string toVersion, bool silent) { FromVersion = new Version(fromVersion); ToVersion = new Version(toVersion); //Application.ProductVersion); if (FromVersion == ToVersion) { return(true); //no conversion necessary } if (FromVersion >= new Version("3.4.0") && PrefC.GetBool(PrefName.CorruptedDatabase)) { MsgBox.Show(this, "Your database is corrupted because a conversion failed. Please contact us. This database is unusable and you will need to restore from a backup."); return(false); //shuts program down. } if (FromVersion.CompareTo(ToVersion) > 0) //"Cannot convert database to an older version." //no longer necessary to catch it here. It will be handled soon enough in CheckProgramVersion { return(true); } if (FromVersion < new Version("2.8.0")) { MsgBox.Show(this, "This database is too old to easily convert in one step. Please upgrade to 2.1 if necessary, then to 2.8. Then you will be able to upgrade to this version. We apologize for the inconvenience."); return(false); } if (FromVersion < new Version("6.6.2")) { MsgBox.Show(this, "This database is too old to easily convert in one step. Please upgrade to 11.1 first. Then you will be able to upgrade to this version. We apologize for the inconvenience."); return(false); } if (FromVersion < new Version("3.0.1")) { MsgBox.Show(this, "This is an old database. The conversion must be done using MySQL 4.1 (not MySQL 5.0) or it will fail."); } if (FromVersion.ToString() == "2.9.0.0" || FromVersion.ToString() == "3.0.0.0" || FromVersion.ToString() == "4.7.0.0") { MsgBox.Show(this, "Cannot convert this database version which was only for development purposes."); return(false); } if (FromVersion > new Version("4.7.0") && FromVersion.Build == 0) { MsgBox.Show(this, "Cannot convert this database version which was only for development purposes."); return(false); } if (FromVersion >= ConvertDatabases.LatestVersion) { return(true); //no conversion necessary } if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { MsgBox.Show(this, "Web client cannot convert database. Must be using a direct connection."); return(false); } if (ReplicationServers.ServerIsBlocked()) { MsgBox.Show(this, "This replication server is blocked from performing updates."); return(false); } if (PrefC.GetString(PrefName.WebServiceServerName) != "" && //using web service !ODEnvironment.IdIsThisComputer(PrefC.GetString(PrefName.WebServiceServerName).ToLower())) //and not on web server { MessageBox.Show(Lan.g(this, "Updates are only allowed from the web server: ") + PrefC.GetString(PrefName.WebServiceServerName)); return(false); } //If MyISAM and InnoDb mix, then try to fix if (DataConnection.DBtype == DatabaseType.MySql) //not for Oracle { string namesInnodb = DatabaseMaintenance.GetInnodbTableNames(); //Or possibly some other format. int numMyisam = DatabaseMaintenance.GetMyisamTableCount(); if (namesInnodb != "" && numMyisam > 0) { MessageBox.Show(Lan.g(this, "A mixture of database tables in InnoDB and MyISAM format were found. A database backup will now be made, and then the following InnoDB tables will be converted to MyISAM format: ") + namesInnodb); try { MiscData.MakeABackup(); //Does not work for Oracle, due to some MySQL specific commands inside. } catch (Exception e) { Cursor.Current = Cursors.Default; if (e.Message != "") { MessageBox.Show(e.Message); } MsgBox.Show(this, "Backup failed. Your database has not been altered."); return(false); } if (!DatabaseMaintenance.ConvertTablesToMyisam()) { MessageBox.Show(Lan.g(this, "Failed to convert InnoDB tables to MyISAM format. Please contact support.")); return(false); } MessageBox.Show(Lan.g(this, "All tables converted to MyISAM format successfully.")); namesInnodb = ""; } if (namesInnodb == "" && numMyisam > 0) //if all tables are myisam //but default storage engine is innodb, then kick them out. { if (DatabaseMaintenance.GetStorageEngineDefaultName().ToUpper() != "MYISAM") //Probably InnoDB but could be another format. { MessageBox.Show(Lan.g(this, "The database tables are in MyISAM format, but the default database engine format is InnoDB. You must change the default storage engine within the my.ini (or my.cnf) file on the database server and restart MySQL in order to fix this problem. Exiting.")); return(false); } } } #if DEBUG if (!silent && MessageBox.Show("You are in Debug mode. Your database can now be converted" + "\r" + "from version" + " " + FromVersion.ToString() + "\r" + "to version" + " " + ToVersion.ToString() + "\r" + "You can click Cancel to skip conversion and attempt to the newer code against the older database." , "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return(true); //If user clicks cancel, then do nothing } #else if (!silent && MessageBox.Show(Lan.g(this, "Your database will now be converted") + "\r" + Lan.g(this, "from version") + " " + FromVersion.ToString() + "\r" + Lan.g(this, "to version") + " " + ToVersion.ToString() + "\r" + Lan.g(this, "The conversion works best if you are on the server. Depending on the speed of your computer, it can be as fast as a few seconds, or it can take as long as 10 minutes.") , "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return(false); //If user clicks cancel, then close the program } #endif Cursor.Current = Cursors.WaitCursor; #if !DEBUG if (DataConnection.DBtype != DatabaseType.MySql && !MsgBox.Show(this, true, "If you have not made a backup, please Cancel and backup before continuing. Continue?")) { return(false); } try{ if (DataConnection.DBtype == DatabaseType.MySql) { MiscData.MakeABackup(); //Does not work for Oracle, due to some MySQL specific commands inside. } } catch (Exception e) { Cursor.Current = Cursors.Default; if (e.Message != "") { MessageBox.Show(e.Message); } MsgBox.Show(this, "Backup failed. Your database has not been altered."); return(false); } try{ #endif if (FromVersion < new Version("7.5.17")) { Cursor.Current = Cursors.Default; YN InsPlanConverstion_7_5_17_AutoMergeYN = YN.Unknown; if (FromVersion < new Version("7.5.1")) { FormInsPlanConvert_7_5_17 form = new FormInsPlanConvert_7_5_17(); if (PrefC.GetBoolSilent(PrefName.InsurancePlansShared, true)) { form.InsPlanConverstion_7_5_17_AutoMergeYN = YN.Yes; } else { form.InsPlanConverstion_7_5_17_AutoMergeYN = YN.No; } form.ShowDialog(); if (form.DialogResult == DialogResult.Cancel) { MessageBox.Show("Your database has not been altered."); return(false); } InsPlanConverstion_7_5_17_AutoMergeYN = form.InsPlanConverstion_7_5_17_AutoMergeYN; } ConvertDatabases.Set_7_5_17_AutoMerge(InsPlanConverstion_7_5_17_AutoMergeYN); //does nothing if this pref is already present for some reason. Cursor.Current = Cursors.WaitCursor; } if (FromVersion >= new Version("3.4.0")) { Prefs.UpdateBool(PrefName.CorruptedDatabase, true); } ConvertDatabases.FromVersion = FromVersion; ConvertDatabases.To2_8_2(); //begins going through the chain of conversion steps Cursor.Current = Cursors.Default; if (!silent) { MsgBox.Show(this, "Conversion successful"); } if (FromVersion >= new Version("3.4.0")) { //CacheL.Refresh(InvalidType.Prefs);//or it won't know it has to update in the next line. Prefs.UpdateBool(PrefName.CorruptedDatabase, false, true); //more forceful refresh in order to properly change flag } Cache.Refresh(InvalidType.Prefs); return(true); #if !DEBUG } catch (System.IO.FileNotFoundException e) { MessageBox.Show(e.FileName + " " + Lan.g(this, "could not be found. Your database has not been altered and is still usable if you uninstall this version, then reinstall the previous version.")); if (FromVersion >= new Version("3.4.0")) { Prefs.UpdateBool(PrefName.CorruptedDatabase, false); } //Prefs.Refresh(); return(false); } catch (System.IO.DirectoryNotFoundException) { MessageBox.Show(Lan.g(this, "ConversionFiles folder could not be found. Your database has not been altered and is still usable if you uninstall this version, then reinstall the previous version.")); if (FromVersion >= new Version("3.4.0")) { Prefs.UpdateBool(PrefName.CorruptedDatabase, false); } //Prefs.Refresh(); return(false); } catch (Exception ex) { // MessageBox.Show(); MessageBox.Show(ex.Message + "\r\n\r\n" + Lan.g(this, "Conversion unsuccessful. Your database is now corrupted and you cannot use it. Please contact us.")); //Then, application will exit, and database will remain tagged as corrupted. return(false); } #endif }
private void butOK_Click(object sender, System.EventArgs e) { if (textDateStart.errorProvider1.GetError(textDateStart) != "" || textDateStop.errorProvider1.GetError(textDateStop) != "") { MsgBox.Show(this, "Please fix date."); return; } DiseaseCur.DateStart = PIn.Date(textDateStart.Text); DiseaseCur.DateStop = PIn.Date(textDateStop.Text); DiseaseCur.ProbStatus = (ProblemStatus)comboStatus.SelectedIndex; DiseaseCur.PatNote = textNote.Text; if (comboSnomedProblemType.SelectedIndex == 1) //Finding { DiseaseCur.SnomedProblemType = "404684003"; } else if (comboSnomedProblemType.SelectedIndex == 2) //Complaint { DiseaseCur.SnomedProblemType = "409586006"; } else if (comboSnomedProblemType.SelectedIndex == 3) //Dignosis { DiseaseCur.SnomedProblemType = "282291009"; } else if (comboSnomedProblemType.SelectedIndex == 4) //Condition { DiseaseCur.SnomedProblemType = "64572001"; } else if (comboSnomedProblemType.SelectedIndex == 5) //FunctionalLimitation { DiseaseCur.SnomedProblemType = "248536006"; } else if (comboSnomedProblemType.SelectedIndex == 6) //Symptom { DiseaseCur.SnomedProblemType = "418799008"; } else //Problem { DiseaseCur.SnomedProblemType = "55607006"; } DiseaseCur.FunctionStatus = (FunctionalStatus)comboEhrFunctionalStatus.SelectedIndex; if (IsNew) { //This code is never hit in current implementation 09/26/2013. Diseases.Insert(DiseaseCur); SecurityLogs.MakeLogEntry(Permissions.PatProblemListEdit, DiseaseCur.PatNum, DiseaseDefs.GetName(DiseaseCur.DiseaseDefNum) + " added"); } else { //See if this problem is the pregnancy linked to a vitalsign exam List <Vitalsign> listVitalsAttached = Vitalsigns.GetListFromPregDiseaseNum(DiseaseCur.DiseaseNum); if (listVitalsAttached.Count > 0) { //See if the vitalsign exam date is now outside of the active dates of the disease (pregnancy) string dates = ""; for (int i = 0; i < listVitalsAttached.Count; i++) { if (listVitalsAttached[i].DateTaken < DiseaseCur.DateStart || (DiseaseCur.DateStop.Year > 1880 && listVitalsAttached[i].DateTaken > DiseaseCur.DateStop)) { dates += "\r\n" + listVitalsAttached[i].DateTaken.ToShortDateString(); } } //If vitalsign exam is now outside the dates of the problem, tell the user they must fix the dates of the pregnancy dx if (dates.Length > 0) { MsgBox.Show(this, "This problem is attached to 1 or more vital sign exams as a pregnancy diagnosis with dates:" + dates + "\r\nNot allowed to change the active dates of the diagnosis to be outside the dates of the exam(s). You must first remove the diagnosis from the vital sign exam(s)."); return; } } Diseases.Update(DiseaseCur); SecurityLogs.MakeLogEntry(Permissions.PatProblemListEdit, DiseaseCur.PatNum, DiseaseDefs.GetName(DiseaseCur.DiseaseDefNum) + " edited"); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { //Verify Data. if (listEmployees.SelectedIndex < 0) { MsgBox.Show(this, "Please select an employee."); return; } TimeSpan overHoursPerDay = TimeSpan.Zero; if (textOverHoursPerDay.Text != "") { try { if (textOverHoursPerDay.Text.Contains(":")) { overHoursPerDay = TimeSpan.Parse(textOverHoursPerDay.Text); } else { overHoursPerDay = TimeSpan.FromHours(PIn.Double(textOverHoursPerDay.Text)); } } catch { MsgBox.Show(this, "Over hours per day invalid."); return; } if (overHoursPerDay == TimeSpan.Zero || overHoursPerDay.Days > 0) { MsgBox.Show(this, "Over hours per day invalid."); return; } } TimeSpan afterTimeOfDay = TimeSpan.Zero; if (textAfterTimeOfDay.Text != "") { try { afterTimeOfDay = DateTime.Parse(textAfterTimeOfDay.Text).TimeOfDay; } catch { MsgBox.Show(this, "After time of day invalid."); return; } if (afterTimeOfDay == TimeSpan.Zero || afterTimeOfDay.Days > 0) { MsgBox.Show(this, "After time of day invalid."); return; } } if (overHoursPerDay == TimeSpan.Zero && afterTimeOfDay == TimeSpan.Zero) { MsgBox.Show(this, "Hours or time of day must be entered."); return; } //save------------------------------------------------- if (listEmployees.SelectedIndex == 0) { timeCardRule.EmployeeNum = 0; //All employees. } else { timeCardRule.EmployeeNum = Employees.ListShort[listEmployees.SelectedIndex - 1].EmployeeNum; } timeCardRule.OverHoursPerDay = overHoursPerDay; timeCardRule.AfterTimeOfDay = afterTimeOfDay; if (timeCardRule.IsNew) { TimeCardRules.Insert(timeCardRule); } else { TimeCardRules.Update(timeCardRule); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (checkHidden.Checked) { if (Defs.IsDefinitionInUse(DefCur)) { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning: This definition is currently in use within the program.")) { return; } } } if (textName.Text == "") { MsgBox.Show(this, "Name required."); return; } DefCur.ItemName = textName.Text; string itemVal = ""; if (checkChartModule.Checked) { itemVal += "X"; } if (checkPatientForms.Checked) { itemVal += "F"; } if (checkPatientPortal.Checked) { itemVal += "L"; } if (checkPatientPictures.Checked) { itemVal += "P"; } if (checkStatements.Checked) { itemVal += "S"; } if (checkToothCharts.Checked) { itemVal += "T"; } if (checkTreatmentPlans.Checked) { itemVal += "R"; } if (checkExpanded.Checked) { itemVal += "E"; } if (checkPaymentPlans.Checked) { itemVal += "A"; } if (!IsNew && checkExpanded.Checked != DefCur.ItemValue.Contains("E")) //If checkbox has been changed since opening form. { if (MsgBox.Show(this, true, "Expanded by default option changed. This change will affect all users. Continue?")) { //Remove all user specific preferences to enforce the new default. UserOdPrefs.DeleteForFkey(0, UserOdFkeyType.Definition, DefCur.DefNum); } } if (checkClaimAttachments.Checked) { itemVal += "C"; } if (checkLabCases.Checked) { itemVal += "B"; } DefCur.ItemValue = itemVal; DefCur.IsHidden = checkHidden.Checked; if (IsNew) { Defs.Insert(DefCur); } else { Defs.Update(DefCur); } DialogResult = DialogResult.OK; }
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 FormApptEdit.UpdateToDB() 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); } for (int i = 0; i < aptList.Length; i++) { //This gets the list of procedures in the correct order. DataTable procTable = Appointments.GetProcTable(aptList[i].PatNum.ToString(), aptList[i].AptNum.ToString(), ((int)aptList[i].AptStatus).ToString(), aptList[i].AptDateTime.ToString()); Appointment newApt = aptList[i].Clone(); newApt.ProcDescript = ""; newApt.ProcsColored = ""; int count = 0; for (int j = 0; j < procTable.Rows.Count; j++) { if (procTable.Rows[j]["attached"].ToString() != "1") { continue; } string procDescOne = ""; string procCode = procTable.Rows[j]["ProcCode"].ToString(); if (count > 0) { newApt.ProcDescript += ", "; } switch (procTable.Rows[j]["TreatArea"].ToString()) { case "1": //TreatmentArea.Surf: procDescOne += "#" + Tooth.GetToothLabel(procTable.Rows[j]["ToothNum"].ToString()) + "-" + procTable.Rows[j]["Surf"].ToString() + "-"; //""#12-MOD-" break; case "2": //TreatmentArea.Tooth: procDescOne += "#" + Tooth.GetToothLabel(procTable.Rows[j]["ToothNum"].ToString()) + "-"; //"#12-" break; default: //area 3 or 0 (mouth) break; case "4": //TreatmentArea.Quad: procDescOne += procTable.Rows[j]["Surf"].ToString() + "-"; //"UL-" break; case "5": //TreatmentArea.Sextant: procDescOne += "S" + procTable.Rows[j]["Surf"].ToString() + "-"; //"S2-" break; case "6": //TreatmentArea.Arch: procDescOne += procTable.Rows[j]["Surf"].ToString() + "-"; //"U-" break; case "7": //TreatmentArea.ToothRange: //strLine+=table.Rows[j][13].ToString()+" ";//don't show range break; } procDescOne += procTable.Rows[j]["AbbrDesc"].ToString(); newApt.ProcDescript += procDescOne; //Color and previous date are determined by ProcApptColor object ProcApptColor pac = ProcApptColors.GetMatch(procCode); System.Drawing.Color pColor = System.Drawing.Color.Black; string prevDateString = ""; if (pac != null) { pColor = pac.ColorText; if (pac.ShowPreviousDate) { prevDateString = Procedures.GetRecentProcDateString(newApt.PatNum, newApt.AptDateTime, pac.CodeRange); if (prevDateString != "") { prevDateString = " (" + prevDateString + ")"; } } } newApt.ProcsColored += "<span color=\"" + pColor.ToArgb().ToString() + "\">" + procDescOne + prevDateString + "</span>"; count++; } Appointments.Update(newApt, aptList[i]); } #endregion Cursor = Cursors.Default; MsgBox.Show(this, "Done. Please refresh Appt module to see the changes."); }
///<summary></summary> private void butOK_Click(object sender, System.EventArgs e) { if (textMain.Text == "") { MsgBox.Show(this, "Please paste the text generated by the other program into the large box first."); return; } pat = new Patient(); pat.PriProv = PrefC.GetLong(PrefName.PracticeDefaultProv); pat.BillingType = PrefC.GetLong(PrefName.PracticeDefaultBillType); guar = new Patient(); guar.PriProv = PrefC.GetLong(PrefName.PracticeDefaultProv); guar.BillingType = PrefC.GetLong(PrefName.PracticeDefaultBillType); subsc = new Patient(); subsc.PriProv = PrefC.GetLong(PrefName.PracticeDefaultProv); subsc.BillingType = PrefC.GetLong(PrefName.PracticeDefaultBillType); sub = new InsSub(); sub.ReleaseInfo = true; sub.AssignBen = true; plan = new InsPlan(); carrier = new Carrier(); insRelat = "self"; //this is the default if not included guarRelat = "self"; InsEmp = ""; GuarEmp = ""; NoteMedicalComp = ""; insPresent = false; annualMax = -1; deductible = -1; XmlTextReader reader = new XmlTextReader(new StringReader(textMain.Text)); reader.WhitespaceHandling = WhitespaceHandling.None; string element = ""; string textValue = ""; string rootElement = ""; string segment = ""; //eg PatientIdentification string field = ""; //eg NameLast string endelement = ""; warnings = ""; try{ while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: element = reader.Name; if (rootElement == "") //should be the first node { if (element == "Message") { rootElement = "Message"; } else { throw new Exception(element + " should not be the first element."); } } else if (segment == "") //expecting a new segment { segment = element; if (segment != "MessageHeader" && segment != "PatientIdentification" && segment != "Guarantor" && segment != "Insurance") { throw new Exception(segment + " is not a recognized segment."); } } else //expecting a new field { field = element; } if (segment == "Insurance") { insPresent = true; } break; case XmlNodeType.Text: textValue = reader.Value; if (field == "") { throw new Exception("Unexpected text: " + textValue); } break; case XmlNodeType.EndElement: endelement = reader.Name; if (field == "") //we're not in a field, so we must be closing a segment or rootelement { if (segment == "") //we're not in a segment, so we must be closing the rootelement { if (rootElement == "Message") { rootElement = ""; } else { throw new Exception("Message closing element expected."); } } else //must be closing a segment { segment = ""; } } else //closing a field { field = ""; textValue = ""; } break; } //switch if (rootElement == "") { break; //this will ignore anything after the message endelement } if (field != "" && textValue != "") { if (segment == "MessageHeader") { ProcessMSH(field, textValue); } else if (segment == "PatientIdentification") { ProcessPID(field, textValue); } else if (segment == "Guarantor") { ProcessGT(field, textValue); } else if (segment == "Insurance") { ProcessINS(field, textValue); } } } //while } catch (Exception ex) { MessageBox.Show(ex.Message); //MsgBox.Show(this,"Error in the XML format."); reader.Close(); return; } finally{ reader.Close(); } //Warnings and errors----------------------------------------------------------------------------- if (pat.LName == "" || pat.FName == "" || pat.Birthdate.Year < 1880) { MsgBox.Show(this, "Patient first and last name and birthdate are required. Could not import."); return; } //if guarRelat is not self, and name and birthdate not supplied, no error. Just make guar self. if (guarRelat != "self") { if (guar.LName == "" || guar.FName == "" || guar.Birthdate.Year < 1880) { warnings += "Guarantor information incomplete. Guarantor will be self.\r\n"; guarRelat = "self"; } } if (insPresent) { if (carrier.CarrierName == "") { warnings += "Insurance CompanyName is missing. No insurance info will be imported.\r\n"; insPresent = false; } else if (insRelat != "self") { if (subsc.LName == "" || subsc.FName == "" || subsc.Birthdate.Year < 1880) { warnings += "Subscriber name or birthdate is missing. No insurance info will be imported.\r\n"; insPresent = false; } } else if (sub.SubscriberID == "") { warnings += "PolicyNumber/SubscriberID missing.\r\n"; sub.SubscriberID = " "; } } if (warnings != "") { if (MessageBox.Show("It's safe to import, but you should be aware of the following issues:\r\n" + warnings + "\r\nContinue with Import?", "Warnings", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } } //Patient------------------------------------------------------------------------------------- //DataTable table; long patNum = Patients.GetPatNumByNameAndBirthday(pat.LName, pat.FName, pat.Birthdate); Patient existingPat = null; existingPatOld = null; //we will need this to do an update. if (patNum != 0) //a patient already exists, so only add missing fields { existingPat = Patients.GetPat(patNum); existingPatOld = existingPat.Copy(); if (existingPat.MiddleI == "") //only alter existing if blank { existingPat.MiddleI = pat.MiddleI; } if (pat.Gender != PatientGender.Unknown) { existingPat.Gender = pat.Gender; } if (existingPat.Preferred == "") { existingPat.Preferred = pat.Preferred; } if (existingPat.Address == "") { existingPat.Address = pat.Address; } if (existingPat.Address2 == "") { existingPat.Address2 = pat.Address2; } if (existingPat.City == "") { existingPat.City = pat.City; } if (existingPat.State == "") { existingPat.State = pat.State; } if (existingPat.Zip == "") { existingPat.Zip = pat.Zip; } if (existingPat.HmPhone == "") { existingPat.HmPhone = pat.HmPhone; } if (existingPat.Email == "") { existingPat.Email = pat.Email; } if (existingPat.WkPhone == "") { existingPat.WkPhone = pat.WkPhone; } if (existingPat.Position == PatientPosition.Single) { existingPat.Position = pat.Position; } if (existingPat.SSN == "") { existingPat.SSN = pat.SSN; } existingPat.AddrNote += pat.AddrNote; //concat Patients.Update(existingPat, existingPatOld); PatientNote PatientNoteCur = PatientNotes.Refresh(existingPat.PatNum, existingPat.Guarantor); PatientNoteCur.MedicalComp += NoteMedicalComp; PatientNotes.Update(PatientNoteCur, existingPat.Guarantor); //guarantor will not be altered in any way } //if patient already exists else //patient is new, so insert { Patients.Insert(pat, false); SecurityLogs.MakeLogEntry(Permissions.PatientCreate, pat.PatNum, "Created from Import Patient XML tool."); existingPatOld = pat.Copy(); pat.Guarantor = pat.PatNum; //this can be changed later. Patients.Update(pat, existingPatOld); PatientNote PatientNoteCur = PatientNotes.Refresh(pat.PatNum, pat.Guarantor); PatientNoteCur.MedicalComp += NoteMedicalComp; PatientNotes.Update(PatientNoteCur, pat.Guarantor); } //guar----------------------------------------------------------------------------------------------------- if (existingPat == null) //only add or alter guarantor for new patients { if (guarRelat == "self") { //pat is already set with guar as self //ignore all guar fields except EmployerName existingPatOld = pat.Copy(); pat.EmployerNum = Employers.GetEmployerNum(GuarEmp); Patients.Update(pat, existingPatOld); } else { //if guarRelat is not self, and name and birthdate not supplied, a warning was issued, and relat was changed to self. //add guarantor or attach to an existing guarantor long guarNum = Patients.GetPatNumByNameAndBirthday(guar.LName, guar.FName, guar.Birthdate); if (guarNum != 0) //a guar already exists, so simply attach. Make no other changes { existingPatOld = pat.Copy(); pat.Guarantor = guarNum; if (guarRelat == "parent") { pat.Position = PatientPosition.Child; } Patients.Update(pat, existingPatOld); } else //we need to completely create guar, then attach { Patients.Insert(guar, false); SecurityLogs.MakeLogEntry(Permissions.PatientCreate, guar.PatNum, "Created from Import Patient XML tool."); //set guar for guar existingPatOld = guar.Copy(); guar.Guarantor = guar.PatNum; guar.EmployerNum = Employers.GetEmployerNum(GuarEmp); Patients.Update(guar, existingPatOld); //set guar for pat existingPatOld = pat.Copy(); pat.Guarantor = guar.PatNum; if (guarRelat == "parent") { pat.Position = PatientPosition.Child; } Patients.Update(pat, existingPatOld); } } } //subsc-------------------------------------------------------------------------------------------------- if (!insPresent) { //this takes care of missing carrier name or subscriber info. MsgBox.Show(this, "Done"); DialogResult = DialogResult.OK; } if (insRelat == "self") { sub.Subscriber = pat.PatNum; } else //we need to find or add the subscriber { patNum = Patients.GetPatNumByNameAndBirthday(subsc.LName, subsc.FName, subsc.Birthdate); if (patNum != 0) //a subsc already exists, so simply attach. Make no other changes { sub.Subscriber = patNum; } else //need to create and attach a subscriber { Patients.Insert(subsc, false); SecurityLogs.MakeLogEntry(Permissions.PatientCreate, subsc.PatNum, "Created from Import Patient XML tool."); //set guar to same guar as patient existingPatOld = subsc.Copy(); subsc.Guarantor = pat.Guarantor; Patients.Update(subsc, existingPatOld); sub.Subscriber = subsc.PatNum; } } //carrier------------------------------------------------------------------------------------------------- //Carriers.Cur=carrier; carrier = Carriers.GetIdentical(carrier); //this automatically finds or creates a carrier //plan------------------------------------------------------------------------------------------------------ plan.EmployerNum = Employers.GetEmployerNum(InsEmp); plan.CarrierNum = carrier.CarrierNum; InsPlans.Insert(plan); //Attach plan to subscriber sub.PlanNum = plan.PlanNum; InsSubs.Insert(sub); //Then attach plan List <PatPlan> PatPlanList = PatPlans.Refresh(pat.PatNum); PatPlan patplan = new PatPlan(); patplan.Ordinal = (byte)(PatPlanList.Count + 1); //so the ordinal of the first entry will be 1, NOT 0. patplan.PatNum = pat.PatNum; patplan.InsSubNum = sub.InsSubNum; switch (insRelat) { case "self": patplan.Relationship = Relat.Self; break; case "parent": patplan.Relationship = Relat.Child; break; case "spouse": patplan.Relationship = Relat.Spouse; break; case "guardian": patplan.Relationship = Relat.Dependent; break; } PatPlans.Insert(patplan); //benefits if (annualMax != -1 && CovCats.GetCount(true) > 0) { Benefit ben = new Benefit(); ben.BenefitType = InsBenefitType.Limitations; ben.CovCatNum = CovCats.GetFirst(true).CovCatNum; ben.MonetaryAmt = annualMax; ben.PlanNum = plan.PlanNum; ben.TimePeriod = BenefitTimePeriod.CalendarYear; Benefits.Insert(ben); } if (deductible != -1 && CovCats.GetCount(true) > 0) { Benefit ben = new Benefit(); ben.BenefitType = InsBenefitType.Deductible; ben.CovCatNum = CovCats.GetFirst(true).CovCatNum; ben.MonetaryAmt = deductible; ben.PlanNum = plan.PlanNum; ben.TimePeriod = BenefitTimePeriod.CalendarYear; Benefits.Insert(ben); } MsgBox.Show(this, "Done"); DialogResult = DialogResult.OK; }
private void butImportCanada_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; FormFeeSchedPickRemote formPick = new FormFeeSchedPickRemote(); formPick.Url = @"http://www.opendental.com/feescanada/"; //points to index.php file if (formPick.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } Cursor = Cursors.WaitCursor; //original wait cursor seems to go away for some reason. Application.DoEvents(); string feeData = ""; if (formPick.IsFileChosenProtected) { string memberNumberODA = ""; string memberPasswordODA = ""; if (formPick.FileChosenName.StartsWith("ON_")) //Any and all Ontario fee schedules { FormFeeSchedPickAuthOntario formAuth = new FormFeeSchedPickAuthOntario(); if (formAuth.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } memberNumberODA = formAuth.ODAMemberNumber; memberPasswordODA = formAuth.ODAMemberPassword; } //prepare the xml document to send-------------------------------------------------------------------------------------- XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); StringBuilder strbuild = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(strbuild, settings)) { writer.WriteStartElement("RequestFeeSched"); writer.WriteStartElement("RegistrationKey"); writer.WriteString(PrefC.GetString(PrefName.RegistrationKey)); writer.WriteEndElement(); //RegistrationKey writer.WriteStartElement("FeeSchedFileName"); writer.WriteString(formPick.FileChosenName); writer.WriteEndElement(); //FeeSchedFileName if (memberNumberODA != "") { writer.WriteStartElement("ODAMemberNumber"); writer.WriteString(memberNumberODA); writer.WriteEndElement(); //ODAMemberNumber writer.WriteStartElement("ODAMemberPassword"); writer.WriteString(memberPasswordODA); writer.WriteEndElement(); //ODAMemberPassword } writer.WriteEndElement(); //RequestFeeSched } #if DEBUG OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1(); #else OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1(); updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress); #endif //Send the message and get the result------------------------------------------------------------------------------------- string result = ""; try { result = updateService.RequestFeeSched(strbuild.ToString()); } catch (Exception ex) { Cursor = Cursors.Default; MessageBox.Show("Error: " + ex.Message); return; } Cursor = Cursors.Default; XmlDocument doc = new XmlDocument(); doc.LoadXml(result); //Process errors------------------------------------------------------------------------------------------------------------ XmlNode node = doc.SelectSingleNode("//Error"); if (node != null) { MessageBox.Show(node.InnerText, "Error"); return; } node = doc.SelectSingleNode("//KeyDisabled"); if (node == null) { //no error, and no disabled message if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, false)) //this is one of three places in the program where this happens. { DataValid.SetInvalid(InvalidType.Prefs); } } else { MessageBox.Show(node.InnerText); if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, true)) //this is one of three places in the program where this happens. { DataValid.SetInvalid(InvalidType.Prefs); } return; } //Process a valid return value------------------------------------------------------------------------------------------------ node = doc.SelectSingleNode("//ResultCSV64"); string feeData64 = node.InnerXml; byte[] feeDataBytes = Convert.FromBase64String(feeData64); feeData = Encoding.UTF8.GetString(feeDataBytes); } else { string tempFile = Path.GetTempFileName(); WebClient myWebClient = new WebClient(); try { myWebClient.DownloadFile(formPick.FileChosenUrl, tempFile); } catch (Exception ex) { MessageBox.Show(Lan.g(this, "Failed to download fee schedule file") + ": " + ex.Message); Cursor = Cursors.Default; return; } feeData = File.ReadAllText(tempFile); File.Delete(tempFile); } string[] feeLines = feeData.Split('\n'); double feeAmt; long numImported = 0; long numSkipped = 0; for (int i = 0; i < feeLines.Length; i++) { string[] fields = feeLines[i].Split('\t'); if (fields.Length > 1) // && fields[1]!=""){//we no longer skip blank fees { string procCode = fields[0]; if (ProcedureCodes.IsValidCode(procCode)) //The Fees.Import() function will not import fees for codes that do not exist. { if (fields[1] == "") { feeAmt = -1; //triggers deletion of existing fee, but no insert. } else { feeAmt = PIn.Double(fields[1]); } Fees.Import(procCode, feeAmt, SchedNum); numImported++; } else { numSkipped++; } } } DataValid.SetInvalid(InvalidType.Fees); Cursor = Cursors.Default; DialogResult = DialogResult.OK; string outputMessage = Lan.g(this, "Done. Number imported") + ": " + numImported; if (numSkipped > 0) { outputMessage += " " + Lan.g(this, "Number skipped") + ": " + numSkipped; } MessageBox.Show(outputMessage); }
private void butImportEcw_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; OpenFileDialog Dlg = new OpenFileDialog(); #if DEBUG Dlg.InitialDirectory = @"E:\My Documents\Bridge Info\eClinicalWorks\FeeSchedules"; #endif 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 extension = Path.GetExtension(Dlg.FileName); if (extension != ".csv") { Cursor = Cursors.Default; MsgBox.Show(this, "Only .csv files may be imported."); return; } string[] lines = File.ReadAllLines(Dlg.FileName); if (lines.Length == 0 || (lines[0] != "Code,Description,Unit Fee,Allowed Fee,POS,TOS,Modifier,RequiresCliaID,GlobalBillingDays,ChargeCode" && lines[0] != "\"Code\",\"Description\",\"UnitFee\",\"AllowedFee\",\"POS\",\"TOS\",\"Modifier\",\"RequiresCliaID\",\"GlobalBillingDays\",\"ChargeCode\"")) { Cursor = Cursors.Default; MessageBox.Show("Unexpected file format. First line in file should be:\r\nCode,Description,Unit Fee,Allowed Fee,POS,TOS,Modifier,RequiresCliaID,GlobalBillingDays,ChargeCode\r\nor\r\n\"Code\",\"Description\",\"UnitFee\",\"AllowedFee\",\"POS\",\"TOS\",\"Modifier\",\"RequiresCliaID\",\"GlobalBillingDays\",\"ChargeCode\""); return; } string feeSchedName = Path.GetFileNameWithoutExtension(Dlg.FileName); FeeSched feesched = FeeScheds.GetByExactName(feeSchedName, FeeScheduleType.Normal); if (feesched == null) { feesched = new FeeSched(); feesched.Description = feeSchedName; feesched.FeeSchedType = FeeScheduleType.Normal; feesched.ItemOrder = FeeSchedC.ListLong[FeeSchedC.ListLong.Count - 1].ItemOrder + 1; feesched.IsHidden = false; //feesched.IsNew=true; FeeScheds.Insert(feesched); DataValid.SetInvalid(InvalidType.FeeScheds); } else { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Fee schedule already exists and all the fees will be overwritten. Continue?")) { Cursor = Cursors.Default; return; } Fees.ClearFeeSched(feesched.FeeSchedNum); } bool importAllowed = false; if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Import Allowed Fee column instead of Unit Fee column?")) { importAllowed = true; } int imported = 0; int skippedCode = 0; int skippedMalformed = 0; string[] fieldArray; List <string> fields; double feeAmt = 0; string codeText = ""; bool formatQuotes = false; if (lines.Length > 1) { if (lines[1].Substring(0, 1) == "\"") { formatQuotes = true; } } if (formatQuotes) //Original format - fields are surrounded by quotes (except first row, above) { for (int i = 1; i < lines.Length; i++) { //fieldArray=lines[i].Split(new string[1] { "\"" },StringSplitOptions.RemoveEmptyEntries);//Removing emtpy entries will misalign the columns fieldArray = lines[i].Split(new string[1] { "\"" }, StringSplitOptions.None); //half the 'fields' will be commas. fields = new List <string>(); for (int f = 1; f < fieldArray.Length - 1; f++) //this loop skips the first and last elements because they are artifacts of the string splitting. { if (fieldArray[f] == ",") { continue; } fields.Add(fieldArray[f]); } if (fields.Count < 4) { skippedMalformed++; continue; } if (importAllowed) { feeAmt = PIn.Double(fields[3]); } else { feeAmt = PIn.Double(fields[2]); } codeText = fields[0]; if (!ProcedureCodes.IsValidCode(codeText)) { skippedCode++; continue; } Fees.Import(fields[0], feeAmt, feesched.FeeSchedNum); imported++; } } else //New format - fields are delimited by commas only (no quotes) { for (int i = 1; i < lines.Length; i++) { fieldArray = lines[i].Split(new string[1] { "," }, StringSplitOptions.None); fields = new List <string>(); for (int f = 0; f < fieldArray.Length; f++) { fields.Add(fieldArray[f]); } if (fields.Count < 4) { skippedMalformed++; continue; } if (fields.Count > 10) { MsgBox.Show(this, "Import aborted. Commas are not allowed in text fields. Check your descriptions for commas and try again."); Cursor = Cursors.Default; return; } if (importAllowed) { feeAmt = PIn.Double(fields[3]); } else { feeAmt = PIn.Double(fields[2]); } codeText = fields[0]; if (!ProcedureCodes.IsValidCode(codeText)) { skippedCode++; continue; } Fees.Import(fields[0], feeAmt, feesched.FeeSchedNum); imported++; } } DataValid.SetInvalid(InvalidType.Fees); Cursor = Cursors.Default; string displayMsg = "Import complete.\r\nCodes imported: " + imported.ToString(); if (skippedCode > 0) { displayMsg += "\r\nCodes skipped because not valid codes in Open Dental: " + skippedCode.ToString(); } if (skippedMalformed > 0) { displayMsg += "\r\nCodes skipped because malformed line in text file: " + skippedMalformed.ToString(); } MessageBox.Show(displayMsg); DialogResult = DialogResult.OK; }
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 butOK_Click(object sender, System.EventArgs e) { if (date2.SelectionStart < date1.SelectionStart) { MsgBox.Show(this, "End date cannot be before start date."); return; } if (!checkAllProv.Checked && listProv.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one provider must be selected."); return; } if (_hasClinicsEnabled) { if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one clinic must be selected."); return; } } if (listType.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one type must be selected."); return; } List <long> listClinicNums = new List <long>(); for (int i = 0; i < listClin.SelectedIndices.Count; i++) { if (Security.CurUser.ClinicIsRestricted) { listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum); //we know that the list is a 1:1 to _listClinics } else { if (listClin.SelectedIndices[i] == 0) { listClinicNums.Add(0); } else { listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum); //Minus 1 from the selected index } } } List <long> listProvNums = new List <long>(); if (checkAllProv.Checked) { for (int i = 0; i < _listProviders.Count; i++) { listProvNums.Add(_listProviders[i].ProvNum); } } else { for (int i = 0; i < listProv.SelectedIndices.Count; i++) { listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum); } } List <string> listAdjType = new List <string>(); for (int i = 0; i < listType.SelectedIndices.Count; i++) { listAdjType.Add(POut.Long(_listAdjTypeDefs[listType.SelectedIndices[i]].DefNum)); } ReportComplex report = new ReportComplex(true, false); DataTable table = RpAdjSheet.GetAdjTable(date1.SelectionStart, date2.SelectionStart, listProvNums, listClinicNums, listAdjType, checkAllClin.Checked, _hasClinicsEnabled); Font font = new Font("Tahoma", 9); Font fontTitle = new Font("Tahoma", 17, FontStyle.Bold); Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold); report.ReportName = Lan.g(this, "Daily Adjustments"); report.AddTitle("Title", Lan.g(this, "Daily Adjustments"), fontTitle); report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle); report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle); if (checkAllProv.Checked) { report.AddSubTitle("Provider SubTitle", Lan.g(this, "All Providers")); } else { string provNames = ""; for (int i = 0; i < listProv.SelectedIndices.Count; i++) { if (i > 0) { provNames += ", "; } provNames += _listProviders[listProv.SelectedIndices[i]].Abbr; } report.AddSubTitle("Provider SubTitle", provNames); } if (_hasClinicsEnabled) { if (checkAllClin.Checked) { report.AddSubTitle("Clinic SubTitle", Lan.g(this, "All Clinics")); } else { string clinNames = ""; for (int i = 0; i < listClin.SelectedIndices.Count; i++) { if (i > 0) { clinNames += ", "; } if (Security.CurUser.ClinicIsRestricted) { clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr; } else { if (listClin.SelectedIndices[i] == 0) { clinNames += Lan.g(this, "Unassigned"); } else { clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr; //Minus 1 from the selected index } } } report.AddSubTitle("Clinic SubTitle", clinNames); } } QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d")); query.AddColumn("Date", 90, FieldValueType.Date); query.AddColumn("Patient Name", 130, FieldValueType.String); query.AddColumn("Prov", 60, FieldValueType.String); if (_hasClinicsEnabled) { query.AddColumn("Clinic", 70, FieldValueType.String); } query.AddColumn("AdjustmentType", 150, FieldValueType.String); query.AddColumn("Note", 180, FieldValueType.String); query.AddColumn("Amount", 75, FieldValueType.Number); query.GetColumnDetail("Amount").ContentAlignment = ContentAlignment.MiddleRight; report.AddPageNum(font); if (!report.SubmitQueries()) { return; } FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateTo.errorProvider1.GetError(textDateTo) != "" ) { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (listProv.SelectedIndices.Count == 0) { MsgBox.Show(this, "At least one provider must be selected."); return; } if (listProv.SelectedIndices[0] == 0 && listProv.SelectedIndices.Count > 1) { MsgBox.Show(this, "You cannot select 'all' providers as well as specific providers."); return; } DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); if (dateTo < dateFrom) { MsgBox.Show(this, "To date cannot be before From date."); return; } ReportComplex report; if (checkAddress.Checked) { report = new ReportComplex(true, true); } else { report = new ReportComplex(true, false); } List <long> listProvNums = new List <long>(); List <Provider> listProvs = Providers.GetListReports(); string subtitleProvs = ""; if (listProv.SelectedIndices[0] == 0) //'All' is selected { for (int i = 0; i < listProvs.Count; i++) { listProvNums.Add(listProvs[i].ProvNum); subtitleProvs = Lan.g(this, "All Providers"); } } else { for (int i = 0; i < listProv.SelectedIndices.Count; i++) { listProvNums.Add(listProvs[listProv.SelectedIndices[i] - 1].ProvNum); //Minus 1 from the selected index to account for 'All' option if (i > 0) { subtitleProvs += ", "; } subtitleProvs += listProvs[listProv.SelectedIndices[i] - 1].Abbr; //Minus 1 from the selected index to account for 'All' option } } DataTable table = RpNewPatients.GetNewPatients(dateFrom, dateTo, listProvNums, checkAddress.Checked, checkProd.Checked, listProv.SelectedIndices[0] == 0); 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, "New Patients"); report.AddTitle("Title", Lan.g(this, "New Patients"), fontTitle); report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle); report.AddSubTitle("Providers", subtitleProvs, fontSubTitle); report.AddSubTitle("Dates of Report", dateFrom.ToString("d") + " - " + dateTo.ToString("d"), fontSubTitle); QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d")); query.AddColumn(Lan.g(this, "#"), 40, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Date"), 90, FieldValueType.Date, font); query.AddColumn(Lan.g(this, "Last Name"), 120, FieldValueType.String, font); query.AddColumn(Lan.g(this, "First Name"), 120, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Referral"), 140, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Production Fee"), 90, FieldValueType.Number, font); if (checkAddress.Checked) { query.AddColumn(Lan.g(this, "Pref'd"), 90, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Address"), 100, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Add2"), 80, FieldValueType.String, font); query.AddColumn(Lan.g(this, "City"), 100, FieldValueType.String, font); query.AddColumn(Lan.g(this, "ST"), 30, FieldValueType.String, font); query.AddColumn(Lan.g(this, "Zip"), 55, FieldValueType.String, font); } report.AddPageNum(font); if (!report.SubmitQueries()) { return; } FormReportComplex FormR = new FormReportComplex(report); FormR.ShowDialog(); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textRight.errorProvider1.GetError(textRight) != "" || textDown.errorProvider1.GetError(textDown) != "" || textDaysPast.errorProvider1.GetError(textDaysPast) != "" || textDaysFuture.errorProvider1.GetError(textDaysFuture) != "" || textDaysFirstReminder.errorProvider1.GetError(textDaysFirstReminder) != "" || textDaysSecondReminder.errorProvider1.GetError(textDaysSecondReminder) != "" || textMaxReminders.errorProvider1.GetError(textMaxReminders) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textPostcardsPerSheet.Text != "1" && textPostcardsPerSheet.Text != "3" && textPostcardsPerSheet.Text != "4") { MsgBox.Show(this, "The value in postcards per sheet must be 1, 3, or 4"); return; } if (comboStatusMailedRecall.SelectedIndex == -1 || comboStatusMailedRecall.SelectedIndex == -1) { MsgBox.Show(this, "Both status options at the bottom must be set."); return; } if (Prefs.UpdateString(PrefName.RecallPostcardsPerSheet, textPostcardsPerSheet.Text)) { if (textPostcardsPerSheet.Text == "1") { MsgBox.Show(this, "If using 1 postcard per sheet, you must adjust the position, and also the preview will not work"); } } Prefs.UpdateBool(PrefName.RecallCardsShowReturnAdd, checkReturnAdd.Checked); Prefs.UpdateBool(PrefName.RecallGroupByFamily, checkGroupFamilies.Checked); if (textDaysPast.Text == "") { Prefs.UpdateLong(PrefName.RecallDaysPast, -1); } else { Prefs.UpdateLong(PrefName.RecallDaysPast, PIn.Long(textDaysPast.Text)); } if (textDaysFuture.Text == "") { Prefs.UpdateLong(PrefName.RecallDaysFuture, -1); } else { Prefs.UpdateLong(PrefName.RecallDaysFuture, PIn.Long(textDaysFuture.Text)); } Prefs.UpdateDouble(PrefName.RecallAdjustRight, PIn.Double(textRight.Text)); Prefs.UpdateDouble(PrefName.RecallAdjustDown, PIn.Double(textDown.Text)); if (comboStatusEmailedRecall.SelectedIndex == -1) { Prefs.UpdateLong(PrefName.RecallStatusEmailed, 0); } else { Prefs.UpdateLong(PrefName.RecallStatusEmailed, DefC.Short[(int)DefCat.RecallUnschedStatus][comboStatusEmailedRecall.SelectedIndex].DefNum); } if (comboStatusMailedRecall.SelectedIndex == -1) { Prefs.UpdateLong(PrefName.RecallStatusMailed, 0); } else { Prefs.UpdateLong(PrefName.RecallStatusMailed, DefC.Short[(int)DefCat.RecallUnschedStatus][comboStatusMailedRecall.SelectedIndex].DefNum); } if (comboStatusEmailedConfirm.SelectedIndex == -1) { Prefs.UpdateLong(PrefName.ConfirmStatusEmailed, 0); } else { Prefs.UpdateLong(PrefName.ConfirmStatusEmailed, DefC.Short[(int)DefCat.ApptConfirmed][comboStatusEmailedConfirm.SelectedIndex].DefNum); } string recalltypes = ""; for (int i = 0; i < listTypes.SelectedIndices.Count; i++) { if (i > 0) { recalltypes += ","; } recalltypes += RecallTypeC.Listt[listTypes.SelectedIndices[i]].RecallTypeNum.ToString(); } Prefs.UpdateString(PrefName.RecallTypesShowingInList, recalltypes); if (textDaysFirstReminder.Text == "") { Prefs.UpdateLong(PrefName.RecallShowIfDaysFirstReminder, -1); } else { Prefs.UpdateLong(PrefName.RecallShowIfDaysFirstReminder, PIn.Long(textDaysFirstReminder.Text)); } if (textDaysSecondReminder.Text == "") { Prefs.UpdateLong(PrefName.RecallShowIfDaysSecondReminder, -1); } else { Prefs.UpdateLong(PrefName.RecallShowIfDaysSecondReminder, PIn.Long(textDaysSecondReminder.Text)); } if (textMaxReminders.Text == "") { Prefs.UpdateLong(PrefName.RecallMaxNumberReminders, -1); } else { Prefs.UpdateLong(PrefName.RecallMaxNumberReminders, PIn.Long(textMaxReminders.Text)); } if (radioUseEmailTrue.Checked) { Prefs.UpdateBool(PrefName.RecallUseEmailIfHasEmailAddress, true); } else { Prefs.UpdateBool(PrefName.RecallUseEmailIfHasEmailAddress, false); } changed = true; DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textValue.Text.Trim() == "") { MsgBox.Show(this, "Missing value."); return; } VaccineObsType vaccineObsType = (VaccineObsType)listValueType.SelectedIndex; if (vaccineObsType == VaccineObsType.Coded) { //Any value is allowed. } else if (vaccineObsType == VaccineObsType.Dated) { try { DateTime.Parse(textValue.Text); } catch (Exception) { MsgBox.Show(this, "Value must be a valid date."); return; } } else if (vaccineObsType == VaccineObsType.Numeric) { try { double.Parse(textValue.Text); } catch (Exception) { MsgBox.Show(this, "Value must be a valid number."); return; } } else if (vaccineObsType == VaccineObsType.Text) { //Any value is allowed. } else //DateAndTime { try { DateTime.Parse(textValue.Text); } catch (Exception) { MsgBox.Show(this, "Value must be a valid date and time."); return; } } if (comboUnits.Enabled && comboUnits.SelectedIndex == 0) { MsgBox.Show(this, "Missing units."); return; } if (textDateObserved.errorProvider1.GetError(textDateObserved) != "") { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (!textMethodCode.ReadOnly && textMethodCode.Text.Trim() == "") { MsgBox.Show(this, "Missing method code."); return; } _vaccineObsCur.IdentifyingCode = (VaccineObsIdentifier)comboObservationQuestion.SelectedIndex; _vaccineObsCur.ValType = (VaccineObsType)listValueType.SelectedIndex; _vaccineObsCur.ValCodeSystem = (VaccineObsValCodeSystem)listCodeSystem.SelectedIndex; _vaccineObsCur.ValReported = textValue.Text; _vaccineObsCur.UcumCode = ""; if (comboUnits.Enabled) { _vaccineObsCur.UcumCode = comboUnits.Items[comboUnits.SelectedIndex].ToString(); } _vaccineObsCur.DateObs = DateTime.MinValue; if (textDateObserved.Text != "") { _vaccineObsCur.DateObs = PIn.Date(textDateObserved.Text); } _vaccineObsCur.MethodCode = textMethodCode.Text; DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { string compName = SystemInformation.ComputerName; if (checkSimple.Checked && !PrefC.GetBool(PrefName.EasyHidePrinters)) { //if user clicked the simple option if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Warning! You have selected the simple interface option." + " This will force all computers to use the simple mode." + " This will also clear all printing preferences for all other computers and set them back to default." + " Are you sure you wish to continue?")) { return; } Printers.ClearAll(); Printers.RefreshCache(); string printerName = ""; if (comboDefault.SelectedIndex == 0) { printerName = ""; } else { printerName = comboDefault.SelectedItem.ToString(); } Printers.PutForSit(PrintSituation.Default, compName, printerName, true); } else { for (int i = 0; i < Enum.GetValues(typeof(PrintSituation)).Length; i++) { //loop through each printSituation string printerName = ""; bool isChecked = false; //PrintSituation sit=PrintSituation.Default; //first: main Default, since not in panel Simple if (i == 0) //printSituation.Default { if (comboDefault.SelectedIndex == 0) { printerName = ""; } else { printerName = comboDefault.SelectedItem.ToString(); } } foreach (Control control in panelSimple.Controls) { if (control.GetType() != typeof(ComboBox) && //skip anything but comboBoxes and CheckBoxes control.GetType() != typeof(CheckBox)) { continue; } //so only two controls out of all will be used in each Enum loop if (GetSit(control) != (PrintSituation)i) { continue; } if (control.GetType() == typeof(ComboBox)) { if (((ComboBox)control).SelectedIndex == 0) { printerName = ""; } else { printerName = ((ComboBox)control).SelectedItem.ToString(); } } else //checkBox { isChecked = ((CheckBox)control).Checked; } } Printers.PutForSit((PrintSituation)i, compName, printerName, isChecked); } } DataValid.SetInvalid(InvalidType.Computers); if (checkSimple.Checked != PrefC.GetBool(PrefName.EasyHidePrinters)) { Prefs.UpdateBool(PrefName.EasyHidePrinters, checkSimple.Checked); DataValid.SetInvalid(InvalidType.Prefs); } Printers.RefreshCache(); //the other computers don't care DialogResult = DialogResult.OK; }
private void butPickRxListImage_Click(object sender, EventArgs e) { if (PrefC.AtoZfolderUsed == DataStorageType.InDatabase) { MsgBox.Show(this, "This option is not supported with images stored in the database."); return; } FormImageSelect formIS = new FormImageSelect(); formIS.PatNum = PatCur.PatNum; formIS.ShowDialog(); if (formIS.DialogResult != DialogResult.OK) { return; } string patFolder = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath()); Document doc = Documents.GetByNum(formIS.SelectedDocNum); if (!ImageStore.HasImageExtension(doc.FileName)) { MsgBox.Show(this, "The selected file is not a supported image type."); return; } textDocDateDesc.Text = doc.DateTStamp.ToShortDateString() + " - " + doc.Description.ToString(); if (BitmapOriginal != null) { BitmapOriginal.Dispose(); } if (PrefC.AtoZfolderUsed == DataStorageType.LocalAtoZ) { BitmapOriginal = ImageStore.OpenImage(doc, patFolder); } else { FormProgress FormP = new FormProgress(); FormP.DisplayText = "Downloading Image..."; FormP.NumberFormat = "F"; FormP.NumberMultiplication = 1; FormP.MaxVal = 100; //Doesn't matter what this value is as long as it is greater than 0 FormP.TickMS = 1000; OpenDentalCloud.Core.TaskStateDownload state = CloudStorage.DownloadAsync(patFolder , doc.FileName , new OpenDentalCloud.ProgressHandler(FormP.OnProgress)); FormP.ShowDialog(); if (FormP.DialogResult == DialogResult.Cancel) { state.DoCancel = true; return; } else { using (MemoryStream ms = new MemoryStream(state.FileContent)) { BitmapOriginal = new Bitmap(ms); } } } Bitmap bitmap = ImageHelper.ApplyDocumentSettingsToImage(doc, BitmapOriginal, ImageSettingFlags.ALL); pictBox.BackgroundImage = bitmap; resizePictBox(); }
private void butAddTo_Click(object sender, EventArgs e) { if (!Security.IsAuthorized(Permissions.RefAttachAdd)) { return; } FormReferralSelect FormRS = new FormReferralSelect(); FormRS.IsSelectionMode = true; FormRS.ShowDialog(); if (FormRS.DialogResult != DialogResult.OK) { return; } RefAttach refattach = new RefAttach(); refattach.ReferralNum = FormRS.SelectedReferral.ReferralNum; refattach.PatNum = PatNum; refattach.RefType = ReferralType.RefTo; refattach.RefDate = DateTimeOD.Today; refattach.IsTransitionOfCare = FormRS.SelectedReferral.IsDoctor; refattach.ItemOrder = RefAttachList.Select(x => x.ItemOrder + 1).OrderByDescending(x => x).FirstOrDefault();//Max+1 or 0 refattach.ProcNum = ProcNum; //We want to help EHR users meet their measures. Therefore, we are going to make an educated guess as to who is making this referral. //We are doing this for non-EHR users as well because we think it might be nice automation. long provNumLastAppt = Appointments.GetProvNumFromLastApptForPat(PatNum); if (Security.CurUser.ProvNum != 0) { refattach.ProvNum = Security.CurUser.ProvNum; } else if (provNumLastAppt != 0) { refattach.ProvNum = provNumLastAppt; } else { refattach.ProvNum = Patients.GetProvNum(PatNum); } RefAttaches.Insert(refattach); SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred To " + Referrals.GetNameFL(refattach.ReferralNum)); if (PrefC.GetBool(PrefName.AutomaticSummaryOfCareWebmail)) { FormRefAttachEdit FormRAE = new FormRefAttachEdit(); FormRAE.RefAttachCur = refattach; FormRAE.ShowDialog(); //In order to help offices meet EHR Summary of Care measure 1 of Core Measure 15 of 17, we are going to send a summary of care to the patient portal behind the scenes. //We can send the summary of care to the patient instead of to the Dr. because of the following point in the Additional Information section of the Core Measure: //"The EP can send an electronic or paper copy of the summary care record directly to the next provider or can provide it to the patient to deliver to the next provider, if the patient can reasonably expected to do so and meet Measure 1." //We will only send the summary of care if the ref attach is a TO referral and is a transition of care. if (FormRAE.DialogResult == DialogResult.OK && refattach.RefType == ReferralType.RefTo && refattach.IsTransitionOfCare) { try { //This is like FormEhrClinicalSummary.butSendToPortal_Click such that the email gets treated like a web mail. Patient PatCur = Patients.GetPat(PatNum); string strCcdValidationErrors = EhrCCD.ValidateSettings(); if (strCcdValidationErrors != "") { throw new Exception(); } strCcdValidationErrors = EhrCCD.ValidatePatient(PatCur); if (strCcdValidationErrors != "") { throw new Exception(); } Provider prov = null; if (Security.CurUser.ProvNum != 0) { prov = Providers.GetProv(Security.CurUser.ProvNum); } else { prov = Providers.GetProv(PatCur.PriProv); } EmailMessage msgWebMail = new EmailMessage(); //New mail object msgWebMail.FromAddress = prov.GetFormalName(); //Adding from address msgWebMail.ToAddress = PatCur.GetNameFL(); //Adding to address msgWebMail.PatNum = PatCur.PatNum; //Adding patient number msgWebMail.SentOrReceived = EmailSentOrReceived.WebMailSent; //Setting to sent msgWebMail.ProvNumWebMail = prov.ProvNum; //Adding provider number msgWebMail.Subject = "Referral To " + FormRS.SelectedReferral.GetNameFL(); msgWebMail.BodyText = "You have been referred to another provider. Your summary of care is attached.\r\n" + "You may give a copy of this summary of care to the referred provider if desired.\r\n" + "The contact information for the doctor you are being referred to is as follows:\r\n" + "\r\n"; //Here we provide the same information that would go out on a Referral Slip. //When the user prints a Referral Slip, the doctor referred to information is included and contains the doctor's name, address, and phone. msgWebMail.BodyText += "Name: " + FormRS.SelectedReferral.GetNameFL() + "\r\n"; if (FormRS.SelectedReferral.Address.Trim() != "") { msgWebMail.BodyText += "Address: " + FormRS.SelectedReferral.Address.Trim() + "\r\n"; if (FormRS.SelectedReferral.Address2.Trim() != "") { msgWebMail.BodyText += "\t" + FormRS.SelectedReferral.Address2.Trim() + "\r\n"; } msgWebMail.BodyText += "\t" + FormRS.SelectedReferral.City + " " + FormRS.SelectedReferral.ST + " " + FormRS.SelectedReferral.Zip + "\r\n"; } if (FormRS.SelectedReferral.Telephone != "") { msgWebMail.BodyText += "Phone: (" + FormRS.SelectedReferral.Telephone.Substring(0, 3) + ")" + FormRS.SelectedReferral.Telephone.Substring(3, 3) + "-" + FormRS.SelectedReferral.Telephone.Substring(6) + "\r\n"; } msgWebMail.BodyText += "\r\n" + "To view the Summary of Care for the referral to this provider:\r\n" + "1) Download all attachments to the same folder. Do not rename the files.\r\n" + "2) Open the ccd.xml file in an internet browser."; msgWebMail.MsgDateTime = DateTime.Now; //Message time is now msgWebMail.PatNumSubj = PatCur.PatNum; //Subject of the message is current patient string ccd = ""; Cursor = Cursors.WaitCursor; ccd = EhrCCD.GenerateSummaryOfCare(Patients.GetPat(PatNum)); //Create summary of care, can throw exceptions but they're caught below msgWebMail.Attachments.Add(EmailAttaches.CreateAttach("ccd.xml", Encoding.UTF8.GetBytes(ccd))); //Create summary of care attachment, can throw exceptions but caught below msgWebMail.Attachments.Add(EmailAttaches.CreateAttach("ccd.xsl", Encoding.UTF8.GetBytes(FormEHR.GetEhrResource("CCD")))); //Create xsl attachment, can throw exceptions EmailMessages.Insert(msgWebMail); //Insert mail into DB for patient portal EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent(); newMeasureEvent.DateTEvent = DateTime.Now; newMeasureEvent.EventType = EhrMeasureEventType.SummaryOfCareProvidedToDr; newMeasureEvent.PatNum = PatCur.PatNum; newMeasureEvent.FKey = FormRAE.RefAttachCur.RefAttachNum; //Can be 0 if user didn't pick a referral for some reason. EhrMeasureEvents.Insert(newMeasureEvent); } catch { //We are just trying to be helpful so it doesn't really matter if something failed above. //They can simply go to the EHR dashboard and send the summary of care manually like they always have. They will get detailed validation errors there. MsgBox.Show(this, "There was a problem automatically sending a summary of care. Please go to the EHR dashboard to send a summary of care to meet the summary of care core measure."); } } } Cursor = Cursors.Default; FillGrid(); for (int i = 0; i < RefAttachList.Count; i++) { if (RefAttachList[i].ReferralNum == refattach.ReferralNum) { gridMain.SetSelected(i, true); } } }
private void butImport_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; OpenFileDialog openDlg = new OpenFileDialog(); string initDir = PrefC.GetString(PrefName.ExportPath); if (Directory.Exists(initDir)) { openDlg.InitialDirectory = initDir; } if (openDlg.ShowDialog() != DialogResult.OK) { Cursor = Cursors.Default; return; } try { //ImportCustomSheetDef(openDlg.FileName); SheetDef sheetdef = new SheetDef(); XmlSerializer serializer = new XmlSerializer(typeof(SheetDef)); if (openDlg.FileName != "") { if (!File.Exists(openDlg.FileName)) { throw new ApplicationException(Lan.g("FormSheetDefs", "File does not exist.")); } try { using (TextReader reader = new StreamReader(openDlg.FileName)) { sheetdef = (SheetDef)serializer.Deserialize(reader); } } catch { throw new ApplicationException(Lan.g("FormSheetDefs", "Invalid file format")); } } sheetdef.IsNew = true; //Users might be importing a sheet that was developed in an older version that does not support ItemColor. Default them to black if necessary. for (int i = 0; i < sheetdef.SheetFieldDefs.Count; i++) { //Static text, lines, and rectangles are the only field types that support ItemColor. if (sheetdef.SheetFieldDefs[i].FieldType != SheetFieldType.StaticText && sheetdef.SheetFieldDefs[i].FieldType != SheetFieldType.Line && sheetdef.SheetFieldDefs[i].FieldType != SheetFieldType.Rectangle) { continue; } //ItemColor will be set to "Empty" if this is a sheet that was exported from a previous version that didn't support ItemColor. //Color.Empty will actually draw but will be 'invisible' to the user. For this reason, we considered this a bug and defaulted the color to black. if (sheetdef.SheetFieldDefs[i].ItemColor == Color.Empty) { sheetdef.SheetFieldDefs[i].ItemColor = Color.Black; //Old sheet behavior was to always draw these field types in black. } } SheetDefs.InsertOrUpdate(sheetdef); HasSheetsChanged = true; //Flag as true so we know to refresh the grid in FormSheetDefs.cs ImportedSheetDefNum = sheetdef.SheetDefNum; //Set this so when we return to FormSheetDefs.cs we can select that row. } catch (ApplicationException ex) { Cursor = Cursors.Default; MessageBox.Show(ex.Message); return; } Cursor = Cursors.Default; MsgBox.Show(this, "Imported."); }
private void FillImage() { if (comboFieldName.Text == "") { return; } if (CloudStorage.IsCloudStorage) { textFullPath.Text = CloudStorage.PathTidy(ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), comboFieldName.Text)); } else { textFullPath.Text = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), comboFieldName.Text); } if (PrefC.AtoZfolderUsed == DataStorageType.LocalAtoZ && File.Exists(textFullPath.Text)) { GC.Collect(); try { pictureBox.Image = Image.FromFile(textFullPath.Text); } catch { pictureBox.Image = null; MsgBox.Show(this, "Invalid image type."); } } else if (comboFieldName.Text == "Patient Info.gif") //Interal image { pictureBox.Image = OpenDentBusiness.Properties.Resources.Patient_Info; textFullPath.Text = "Patient Info.gif (internal)"; } else if (CloudStorage.IsCloudStorage) { if (comboFieldName.Text == SheetFieldDefCur.FieldName && SheetFieldDefCur.ImageField != null) { pictureBox.Image = SheetFieldDefCur.ImageField; } else { FormProgress FormP = new FormProgress(); FormP.DisplayText = Lan.g(CloudStorage.LanThis, "Downloading..."); FormP.NumberFormat = "F"; FormP.NumberMultiplication = 1; FormP.MaxVal = 100; //Doesn't matter what this value is as long as it is greater than 0 FormP.TickMS = 1000; OpenDentalCloud.Core.TaskStateDownload state = CloudStorage.DownloadAsync(SheetUtil.GetImagePath(), comboFieldName.Text, new OpenDentalCloud.ProgressHandler(FormP.OnProgress)); if (FormP.ShowDialog() == DialogResult.Cancel) { state.DoCancel = true; return; } if (state == null || state.FileContent == null) { pictureBox.Image = null; } else { using (MemoryStream stream = new MemoryStream(state.FileContent)) { pictureBox.Image = new Bitmap(Image.FromStream(stream)); } } } } else { pictureBox.Image = null; } if (pictureBox.Image == null) { textWidth2.Text = ""; textHeight2.Text = ""; } else { textWidth2.Text = pictureBox.Image.Width.ToString(); textHeight2.Text = pictureBox.Image.Height.ToString(); } }
private void FillReasonList() { List <string> listValueSetOIDsReason = new List <string>(); string medicalReason = "2.16.840.1.113883.3.526.3.1007"; //'Medical Reason' value set string patientReason = "2.16.840.1.113883.3.526.3.1008"; //'Patient Reason' value set string systemReason = "2.16.840.1.113883.3.526.3.1009"; //'System Reason' value set string patientRefusedReason = "2.16.840.1.113883.3.600.1.1503"; //'Patient Reason Refused' value set string medicalOrOtherReason = "2.16.840.1.113883.3.600.1.1502"; //'Medical or Other reason not done' value set string limitedLifeExpectancy = "2.16.840.1.113883.3.526.3.1259"; //'Limited Life Expectancy' value set switch (SelectedItemIndex) { case 0: //BMIExam listValueSetOIDsReason = new List <string> { patientRefusedReason, medicalOrOtherReason }; break; case 1: //InfluenzaVaccination if (radioPatReason.Checked) { listValueSetOIDsReason = new List <string> { patientReason }; } else if (radioSysReason.Checked) { listValueSetOIDsReason = new List <string> { systemReason }; } else if (radioMedReason.Checked) { listValueSetOIDsReason = new List <string> { medicalReason }; } else //if new or loading a previously saved item not performed, no radio is selected, set the appropriate radio and fill the list { if (EhrNotPerfCur.IsNew) { radioMedReason.Checked = true; listValueSetOIDsReason = new List <string> { medicalReason }; //default to medical reason list if new and no radio selected yet } else //if previously saved, find the sub list this reason belongs to { List <List <string> > listSublists = new List <List <string> > { new List <string> { medicalReason }, new List <string> { patientReason }, new List <string> { systemReason } }; bool found = false; for (int i = 0; i < listSublists.Count; i++) { listEhrCodesReason = EhrCodes.GetForValueSetOIDs(listSublists[i], true); for (int j = 0; j < listEhrCodesReason.Count; j++) { if (listEhrCodesReason[j].CodeValue == EhrNotPerfCur.CodeValueReason && listEhrCodesReason[j].CodeSystem == EhrNotPerfCur.CodeSystemReason) { found = true; break; } } if (found) { if (i == 0) { radioMedReason.Checked = true; } else if (i == 1) { radioPatReason.Checked = true; } else { radioSysReason.Checked = true; } listValueSetOIDsReason = listSublists[i]; break; } } } } break; case 2: //TobaccoScreening listValueSetOIDsReason = new List <string> { medicalReason, limitedLifeExpectancy }; break; case 3: //DocumentCurrentMeds listValueSetOIDsReason = new List <string> { medicalOrOtherReason }; break; default: //should never happen break; } listEhrCodesReason = EhrCodes.GetForValueSetOIDs(listValueSetOIDsReason, true); //these are all SNOMEDCT codes and will only show if they exist in the snomed table. if (listEhrCodesReason.Count == 0) { MsgBox.Show(this, "There are no codes in the database for reasons not performed. You must run the Code System Importer tool in Setup | Chart | EHR to import the SNOMEDCT table in order to enter a valid reason."); } comboCodeReason.Items.Clear(); comboCodeReason.Items.Add("none"); comboCodeReason.SelectedIndex = 0; //default to 'none' if no reason set for the not performed item for (int i = 0; i < listEhrCodesReason.Count; i++) { comboCodeReason.Items.Add(listEhrCodesReason[i].CodeValue); if (EhrNotPerfCur.CodeValueReason == listEhrCodesReason[i].CodeValue && EhrNotPerfCur.CodeSystemReason == listEhrCodesReason[i].CodeSystem) { comboCodeReason.SelectedIndex = i + 1; //+1 for 'none' textCodeSystemReason.Text = listEhrCodesReason[i].CodeSystem; textDescriptionReason.Text = listEhrCodesReason[i].Description; } } }
private void butOK_Click(object sender, System.EventArgs e) { bool isDiscountPlanAdj = (Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "dp"); if (textAdjDate.errorProvider1.GetError(textAdjDate) != "" || textProcDate.errorProvider1.GetError(textProcDate) != "" || textAmount.errorProvider1.GetError(textAmount) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (PIn.Date(textAdjDate.Text).Date > DateTime.Today.Date && !PrefC.GetBool(PrefName.FutureTransDatesAllowed)) { MsgBox.Show(this, "Adjustment date can not be in the future."); return; } if (textAmount.Text == "") { MessageBox.Show(Lan.g(this, "Please enter an amount.")); return; } if (!isDiscountPlanAdj && listTypeNeg.SelectedIndex == -1 && listTypePos.SelectedIndex == -1) { MsgBox.Show(this, "Please select a type first."); return; } if (IsNew && AvaTax.IsEnabled() && listTypePos.SelectedIndex > -1 && (_listAdjPosCats[listTypePos.SelectedIndex].DefNum == AvaTax.SalesTaxAdjType || _listAdjPosCats[listTypePos.SelectedIndex].DefNum == AvaTax.SalesTaxReturnAdjType) && !Security.IsAuthorized(Permissions.SalesTaxAdjEdit)) { return; } if (PrefC.GetInt(PrefName.RigorousAdjustments) == 0 && _adjustmentCur.ProcNum == 0) { MsgBox.Show(this, "You must attach a procedure to the adjustment."); return; } if (_adjRemAmt < 0) { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Remaining amount is negative. Continue?", "Overpaid Procedure Warning")) { return; } } bool changeAdjSplit = false; List <PaySplit> listPaySplitsForAdjust = new List <PaySplit>(); if (IsNew) { //prevents backdating of initial adjustment if (!Security.IsAuthorized(Permissions.AdjustmentCreate, PIn.Date(textAdjDate.Text), true)) //Give message later. { if (!_checkZeroAmount) //Let user create as long as Amount is zero and has edit zero permissions. This was checked on load. { MessageBox.Show(Lans.g("Security", "Not authorized for") + "\r\n" + GroupPermissions.GetDesc(Permissions.AdjustmentCreate)); return; } } } else { //Editing an old entry will already be blocked if the date was too old, and user will not be able to click OK button //This catches it if user changed the date to be older. if (!Security.IsAuthorized(Permissions.AdjustmentEdit, PIn.Date(textAdjDate.Text))) { return; } if (_adjustmentCur.ProvNum != comboProv.GetSelectedProvNum()) { listPaySplitsForAdjust = PaySplits.GetForAdjustments(new List <long>() { _adjustmentCur.AdjNum }); foreach (PaySplit paySplit in listPaySplitsForAdjust) { if (!Security.IsAuthorized(Permissions.PaymentEdit, Payments.GetPayment(paySplit.PayNum).PayDate)) { return; } if (comboProv.GetSelectedProvNum() != paySplit.ProvNum && PrefC.GetInt(PrefName.RigorousAccounting) == (int)RigorousAdjustments.EnforceFully) { changeAdjSplit = true; break; } } if (changeAdjSplit && !MsgBox.Show(this, MsgBoxButtons.OKCancel, "The provider for the associated payment splits will be changed to match the provider on the " + "adjustment.")) { return; } } } //DateEntry not allowed to change DateTime datePreviousChange = _adjustmentCur.SecDateTEdit; _adjustmentCur.AdjDate = PIn.Date(textAdjDate.Text); _adjustmentCur.ProcDate = PIn.Date(textProcDate.Text); _adjustmentCur.ProvNum = comboProv.GetSelectedProvNum(); _adjustmentCur.ClinicNum = comboClinic.SelectedClinicNum; if (listTypePos.SelectedIndex != -1) { _adjustmentCur.AdjType = _listAdjPosCats[listTypePos.SelectedIndex].DefNum; _adjustmentCur.AdjAmt = PIn.Double(textAmount.Text); } if (listTypeNeg.SelectedIndex != -1) { _adjustmentCur.AdjType = _listAdjNegCats[listTypeNeg.SelectedIndex].DefNum; _adjustmentCur.AdjAmt = -PIn.Double(textAmount.Text); } if (isDiscountPlanAdj) { //AdjustmentCur.AdjType is already set to a "discount plan" adj type. _adjustmentCur.AdjAmt = -PIn.Double(textAmount.Text); } if (_checkZeroAmount && _adjustmentCur.AdjAmt != 0) { MsgBox.Show(this, "Amount has to be 0.00 due to security permission."); return; } _adjustmentCur.AdjNote = textNote.Text; try{ if (IsNew) { Adjustments.Insert(_adjustmentCur); SecurityLogs.MakeLogEntry(Permissions.AdjustmentCreate, _adjustmentCur.PatNum, _patCur.GetNameLF() + ", " + _adjustmentCur.AdjAmt.ToString("c")); TsiTransLogs.CheckAndInsertLogsIfAdjTypeExcluded(_adjustmentCur, _isTsiAdj); } else { Adjustments.Update(_adjustmentCur); SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, _adjustmentCur.PatNum, _patCur.GetNameLF() + ", " + _adjustmentCur.AdjAmt.ToString("c"), 0 , datePreviousChange); } } catch (Exception ex) { //even though it doesn't currently throw any exceptions MessageBox.Show(ex.Message); return; } if (changeAdjSplit) { PaySplits.UpdateProvForAdjust(_adjustmentCur, listPaySplitsForAdjust); } DialogResult = DialogResult.OK; }
///<summary>If using the Add button on FormEhrNotPerformed, an input box will allow the user to select from the list of available items that are not being performed. The SelectedItemIndex will hold the index of the item selected wich corresponds to the enum EhrNotPerformedItem. We will use this selected item index to set the EhrNotPerformed code and code system.</summary> private void FormEhrNotPerformedEdit_Load(object sender, EventArgs e) { if (IsDateReadOnly) { textDate.ReadOnly = true; } List <string> listValueSetOIDs = new List <string>(); switch (SelectedItemIndex) { case 0: //BMIExam listValueSetOIDs = new List <string> { "2.16.840.1.113883.3.600.1.681" }; //'BMI LOINC Value' value set break; case 1: //InfluenzaVaccination listValueSetOIDs = new List <string> { "2.16.840.1.113883.3.526.3.402", "2.16.840.1.113883.3.526.3.1254" }; //'Influenza Vaccination' and 'Influenza Vaccine' value sets radioMedReason.Visible = true; radioPatReason.Visible = true; radioSysReason.Visible = true; break; case 2: //TobaccoScreening listValueSetOIDs = new List <string> { "2.16.840.1.113883.3.526.3.1278" }; //'Tobacco Use Screening' value set break; case 3: //DocumentCurrentMeds listValueSetOIDs = new List <string> { "2.16.840.1.113883.3.600.1.462" }; //'Current Medications Documented SNMD' value set break; default: //should never happen break; } List <EhrCode> listEhrCodes = EhrCodes.GetForValueSetOIDs(listValueSetOIDs, true); if (listEhrCodes.Count == 0) //This should only happen if the EHR.dll does not exist or if the codes in the ehrcode list do not exist in the corresponding table { MsgBox.Show(this, "The codes used for Not Performed items do not exist in the table in your database. You should run the Code System Importer tool in Setup | Chart | EHR."); DialogResult = DialogResult.Cancel; return; } if (EhrNotPerfCur.IsNew) //if new, CodeValue and CodeSystem are not set, might have to select one { if (listEhrCodes.Count == 1) //only one code in the selected value set, use it { EhrNotPerfCur.CodeValue = listEhrCodes[0].CodeValue; EhrNotPerfCur.CodeSystem = listEhrCodes[0].CodeSystem; } else { List <string> listCodeDescripts = new List <string>(); for (int i = 0; i < listEhrCodes.Count; i++) { listCodeDescripts.Add(listEhrCodes[i].CodeValue + " - " + listEhrCodes[i].Description); } InputBox chooseItem = new InputBox(Lan.g(this, "Select the " + Enum.GetNames(typeof(EhrNotPerformedItem))[SelectedItemIndex] + " not being performed from the list below."), listCodeDescripts); if (SelectedItemIndex == (int)EhrNotPerformedItem.InfluenzaVaccination) { chooseItem.comboSelection.DropDownWidth = 730; } if (chooseItem.ShowDialog() != DialogResult.OK) { DialogResult = DialogResult.Cancel; return; } if (chooseItem.comboSelection.SelectedIndex == -1) { MsgBox.Show(this, "You must select the " + Enum.GetNames(typeof(EhrNotPerformedItem))[SelectedItemIndex] + " not being performed."); DialogResult = DialogResult.Cancel; return; } EhrNotPerfCur.CodeValue = listEhrCodes[chooseItem.comboSelection.SelectedIndex].CodeValue; EhrNotPerfCur.CodeSystem = listEhrCodes[chooseItem.comboSelection.SelectedIndex].CodeSystem; } } for (int i = 0; i < listEhrCodes.Count; i++) { if (listEhrCodes[i].CodeValue == EhrNotPerfCur.CodeValue && listEhrCodes[i].CodeSystem == EhrNotPerfCur.CodeSystem) { textDescription.Text = listEhrCodes[i].Description; } } textCode.Text = EhrNotPerfCur.CodeValue; textCodeSystem.Text = EhrNotPerfCur.CodeSystem; textDate.Text = EhrNotPerfCur.DateEntry.ToShortDateString(); textNote.Text = EhrNotPerfCur.Note; FillReasonList(); if (comboCodeReason.SelectedIndex > 0) { textCodeSystemReason.Text = listEhrCodesReason[comboCodeReason.SelectedIndex - 1].CodeSystem; textDescriptionReason.Text = listEhrCodesReason[comboCodeReason.SelectedIndex - 1].Description; } }
private void butPrint_Click(object sender, System.EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (IsNew) { if (!SaveToDB()) { return; } } else //not new //Only allowed to change date and bank account info, NOT attached checks. //We enforce security here based on date displayed, not date entered. //If user is trying to change date without permission: { DateTime date = PIn.PDate(textDate.Text); if (Security.IsAuthorized(Permissions.DepositSlips, date, true)) { if (!SaveToDB()) { return; } } //if security.NotAuthorized, then it simply skips the save process before printing } //refresh the lists because some items may not be highlighted PatPayList = Payments.GetForDeposit(DepositCur.DepositNum); ClaimPayList = ClaimPayments.GetForDeposit(DepositCur.DepositNum); Queries.TableQ = new DataTable(); for (int i = 0; i < 5; i++) //add 5 columns { Queries.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns } Queries.CurReport = new ReportOld(); Queries.CurReport.ColTotal = new double[Queries.TableQ.Columns.Count]; DataRow row; ArrayList patNumAL = new ArrayList(); for (int i = 0; i < PatPayList.Length; i++) { patNumAL.Add(PatPayList[i].PatNum); } int[] patNums = new int[patNumAL.Count]; patNumAL.CopyTo(patNums); Patient[] pats = Patients.GetMultPats(patNums); for (int i = 0; i < PatPayList.Length; i++) { row = Queries.TableQ.NewRow(); row[0] = PatPayList[i].PayDate.ToShortDateString(); row[1] = Patients.GetOnePat(pats, PatPayList[i].PatNum).GetNameLF(); row[2] = PatPayList[i].CheckNum; row[3] = PatPayList[i].BankBranch; row[4] = PatPayList[i].PayAmt.ToString("F"); Queries.TableQ.Rows.Add(row); Queries.CurReport.ColTotal[4] += PatPayList[i].PayAmt; } for (int i = 0; i < ClaimPayList.Length; i++) { row = Queries.TableQ.NewRow(); row[0] = ClaimPayList[i].CheckDate.ToShortDateString(); row[1] = ClaimPayList[i].CarrierName; row[2] = ClaimPayList[i].CheckNum; row[3] = ClaimPayList[i].BankBranch; row[4] = ClaimPayList[i].CheckAmt.ToString("F"); Queries.TableQ.Rows.Add(row); Queries.CurReport.ColTotal[4] += ClaimPayList[i].CheckAmt; } //done filling now set up table Queries.CurReport.ColWidth = new int[Queries.TableQ.Columns.Count]; Queries.CurReport.ColPos = new int[Queries.TableQ.Columns.Count + 1]; Queries.CurReport.ColPos[0] = 0; Queries.CurReport.ColCaption = new string[Queries.TableQ.Columns.Count]; Queries.CurReport.ColAlign = new HorizontalAlignment[Queries.TableQ.Columns.Count]; FormQuery FormQuery2 = new FormQuery(); FormQuery2.IsReport = true; FormQuery2.ResetGrid(); //necessary won't work without Queries.CurReport.Title = "Deposit Slip"; Queries.CurReport.SubTitle = new string[2]; Queries.CurReport.SubTitle[0] = ((Pref)PrefB.HList["PracticeTitle"]).ValueString; Queries.CurReport.SubTitle[1] = DepositCur.DateDeposit.ToShortDateString(); Queries.CurReport.Summary = new string[1]; Queries.CurReport.Summary[0] = DepositCur.BankAccountInfo; Queries.CurReport.ColPos[0] = 20; Queries.CurReport.ColPos[1] = 110; Queries.CurReport.ColPos[2] = 260; Queries.CurReport.ColPos[3] = 350; Queries.CurReport.ColPos[4] = 440; Queries.CurReport.ColPos[5] = 530; Queries.CurReport.ColCaption[0] = "Date"; Queries.CurReport.ColCaption[1] = "Name"; Queries.CurReport.ColCaption[2] = "Check Number"; Queries.CurReport.ColCaption[3] = "Bank-Branch"; Queries.CurReport.ColCaption[4] = "Amount"; Queries.CurReport.ColAlign[4] = HorizontalAlignment.Right; FormQuery2.ShowDialog(); DialogResult = DialogResult.OK; //this is imporant, since we don't want to insert the deposit slip twice. }
private void butOK_Click(object sender, System.EventArgs e) { if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date first."); return; } if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (gridMain.SelectedIndices.Length == 0) { MessageBox.Show(Lan.g(this, "At least one item must be selected, or use the delete button.")); return; } if (IsNew) { //prevents backdating of initial check if (!Security.IsAuthorized(Permissions.InsPayCreate, PIn.Date(textDate.Text))) { return; } //prevents attaching claimprocs with a date that is older than allowed by security. } else { //Editing an old entry will already be blocked if the date was too old, and user will not be able to click OK button. //This catches it if user changed the date to be older. if (!Security.IsAuthorized(Permissions.InsPayEdit, PIn.Date(textDate.Text))) { return; } } if (comboClinic.SelectedIndex == 0) { ClaimPaymentCur.ClinicNum = 0; } else { ClaimPaymentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } ClaimPaymentCur.CheckAmt = PIn.Double(textAmount.Text); ClaimPaymentCur.CheckDate = PIn.Date(textDate.Text); ClaimPaymentCur.CheckNum = textCheckNum.Text; ClaimPaymentCur.BankBranch = textBankBranch.Text; ClaimPaymentCur.CarrierName = textCarrierName.Text; ClaimPaymentCur.Note = textNote.Text; try{ ClaimPayments.Update(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } //this could be optimized to only save changes. //Would require a starting list to compare to. //But this isn't bad, since changes all saved at the very end List <int> selectedRows = new List <int>(); for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { selectedRows.Add(gridMain.SelectedIndices[i]); } for (int i = 0; i < splits.Count; i++) { if (selectedRows.Contains(i)) //row is selected { ClaimProcs.SetForClaimOld(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, true); //Audit trail isn't perfect, since it doesn't make an entry if you remove a claim from a payment. //And it always makes more audit trail entries when you click OK, even if you didn't actually attach new claims. //But since this will cover the vast majority if situations. if (IsNew) { SecurityLogs.MakeLogEntry(Permissions.InsPayCreate, splits[i].PatNum, Patients.GetLim(splits[i].PatNum).GetNameLF() + ", " + Lan.g(this, "Total Amt: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Claim Split: ") + splits[i].InsPayAmt.ToString("c")); } else { SecurityLogs.MakeLogEntry(Permissions.InsPayEdit, splits[i].PatNum, Patients.GetLim(splits[i].PatNum).GetNameLF() + ", " + Lan.g(this, "Total Amt: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Claim Split: ") + splits[i].InsPayAmt.ToString("c")); } } else //row not selected //If user had not been attaching their inspayments to checks, then this will cause such payments to annoyingly have their //date changed to the current date. This prompts them to call us. Then, we tell them to attach to checks. { ClaimProcs.SetForClaimOld(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, false); } } DialogResult = DialogResult.OK; }
private void checkShowImages_Click(object sender, EventArgs e) { MsgBox.Show(this, "You will need to restart Open Dental to see the effects."); }
private void butOK_Click(object sender, System.EventArgs e) { if (checkEnabled.Checked && textPluginDllName.Text != "") { if (ODBuild.IsWeb()) { MessageBox.Show(Lan.g(this, "Plugins are not allowed in Cloud mode.")); return; } string dllPath = ODFileUtils.CombinePaths(Application.StartupPath, textPluginDllName.Text); if (dllPath.Contains("[VersionMajMin]")) { Version vers = new Version(Application.ProductVersion); dllPath = dllPath.Replace("[VersionMajMin]", ""); //now stripped clean } if (!File.Exists(dllPath)) { MessageBox.Show(Lan.g(this, "Dll file not found:") + " " + dllPath); return; } } if (textPluginDllName.Text != "" && textPath.Text != "") { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "If both a path and a plug-in are specified, the path will be ignored. Continue anyway?")) { return; } } ProgramCur.ProgName = textProgName.Text; ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; ProgramCur.Path = textPath.Text; if (pathOverrideOld != textOverride.Text) { ProgramProperties.InsertOrUpdateLocalOverridePath(ProgramCur.ProgramNum, textOverride.Text); ProgramProperties.RefreshCache(); } ProgramCur.CommandLine = textCommandLine.Text; ProgramCur.PluginDllName = textPluginDllName.Text; ProgramCur.Note = textNote.Text; ProgramCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); if (IsNew) { Programs.Insert(ProgramCur); } else { Programs.Update(ProgramCur); } ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum); //then add one toolButItem for each highlighted row in listbox ToolButItem ToolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { ToolButItemCur = new ToolButItem(); ToolButItemCur.ProgramNum = ProgramCur.ProgramNum; ToolButItemCur.ButtonText = textButtonText.Text; ToolButItemCur.ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i]; ToolButItems.Insert(ToolButItemCur); } DialogResult = DialogResult.OK; }