Exemplo n.º 1
0
        private void butExport_Click(object sender, EventArgs e)
        {
            string ccd = "";

            try {
                ccd = EhrCCD.GenerateElectronicCopy(PatCur);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            dlg.SelectedPath = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath());         //Default to patient image folder.
            DialogResult result = dlg.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            if (File.Exists(Path.Combine(dlg.SelectedPath, "ccd.xml")))
            {
                if (MessageBox.Show("Overwrite existing ccd.xml?", "", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            File.WriteAllText(Path.Combine(dlg.SelectedPath, "ccd.xml"), ccd);
            File.WriteAllText(Path.Combine(dlg.SelectedPath, "ccd.xsl"), FormEHR.GetEhrResource("CCD"));
            RecordRequestAndProvide();
            MessageBox.Show("Exported");
        }
Exemplo n.º 2
0
 private void FormQualityMeasures_Load(object sender, EventArgs e)
 {
     Cursor         = Cursors.WaitCursor;
     listProvsKeyed = new List <Provider>();
     for (int i = 0; i < ProviderC.ListShort.Count; i++)
     {
         if (FormEHR.ProvKeyIsValid(ProviderC.ListShort[i].LName, ProviderC.ListShort[i].FName, true, ProviderC.ListShort[i].EhrKey))
         {
             listProvsKeyed.Add(ProviderC.ListShort[i]);
         }
     }
     if (listProvsKeyed.Count == 0)
     {
         Cursor = Cursors.Default;
         MsgBox.Show(this, "No providers found with ehr keys.");
         return;
     }
     for (int i = 0; i < listProvsKeyed.Count; i++)
     {
         comboProv.Items.Add(listProvsKeyed[i].GetLongDesc());
         if (Security.CurUser.ProvNum == listProvsKeyed[i].ProvNum)
         {
             comboProv.SelectedIndex = i;
         }
     }
     textDateStart.Text = (new DateTime(DateTime.Now.Year, 1, 1)).ToShortDateString();
     textDateEnd.Text   = (new DateTime(DateTime.Now.Year, 12, 31)).ToShortDateString();
     FillGrid();
     Cursor = Cursors.Default;
 }
Exemplo n.º 3
0
        private void FormSnomeds_Load(object sender, EventArgs e)
        {
            _showingInfoButton      = CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowInfobutton;
            _showingInfobuttonShift = (_showingInfoButton?1:0);
            if (IsSelectionMode || IsMultiSelectMode)
            {
                butClose.Text = Lan.g(this, "Cancel");
            }
            else
            {
                butOK.Visible = false;
            }
            if (IsMultiSelectMode)
            {
                gridMain.SelectionMode = GridSelectionMode.MultiExtended;
            }
            ActiveControl = textCode;
            //This check is here to prevent Snomeds from being used in non-member nations.
            List <EhrQuarterlyKey> ehrKeys = EhrQuarterlyKeys.GetAllKeys();

            groupBox1.Visible = false;
            for (int i = 0; i < ehrKeys.Count; i++)
            {
                if (FormEHR.QuarterlyKeyIsValid(ehrKeys[i].YearValue.ToString(), ehrKeys[i].QuarterValue.ToString(), ehrKeys[i].PracticeName, ehrKeys[i].KeyValue))
                {
                    //EHR has been valid.
                    groupBox1.Visible = true;
                    break;
                }
            }
        }
Exemplo n.º 4
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!FormEHR.ProvKeyIsValid(ProvCur.LName, ProvCur.FName, checkHasReportAccess.Checked, textEhrKey.Text))
     {
         MsgBox.Show(this, "Invalid provider key.  Check capitalization, exact spelling, and report access status.");
         return;
     }
     ProvCur.EhrHasReportAccess = checkHasReportAccess.Checked;
     ProvCur.EhrKey             = textEhrKey.Text;
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 5
0
 private void butOK_Click(object sender, EventArgs e)
 {
     //if(textEhrKey.Text=="") {
     //	MessageBox.Show("Key must not be blank");
     //	return;
     //}
     try{
         float fte = float.Parse(textFullTimeEquiv.Text);
         if (fte <= 0)
         {
             MessageBox.Show("FTE must be greater than 0.");
             return;
         }
         if (fte > 1)
         {
             MessageBox.Show("FTE must be 1 or less.");
             return;
         }
     }
     catch {
         //not allowed to be blank. Usually 1.
         MessageBox.Show("Invalid FTE.");
         return;
     }
     if (textEhrKey.Text != "")
     {
         if (!FormEHR.ProvKeyIsValid(textLName.Text, textFName.Text, checkHasReportAccess.Checked, textEhrKey.Text))
         {
             MessageBox.Show("Invalid provider key");
             return;
         }
     }
     KeyCur.LName           = textLName.Text;
     KeyCur.FName           = textFName.Text;
     KeyCur.HasReportAccess = checkHasReportAccess.Checked;
     KeyCur.ProvKey         = textEhrKey.Text;
     KeyCur.FullTimeEquiv   = PIn.Float(textFullTimeEquiv.Text);
     KeyCur.Notes           = textNotes.Text;
     if (KeyCur.IsNew)
     {
         EhrProvKeys.Insert(KeyCur);
     }
     else
     {
         EhrProvKeys.Update(KeyCur);
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 6
0
        private void butExport_Click(object sender, EventArgs e)
        {
            string ccd = "";

            try {
                FormEhrExportCCD FormEEC = new FormEhrExportCCD(PatCur);
                FormEEC.ShowDialog();
                if (FormEEC.DialogResult == DialogResult.OK)
                {
                    ccd = FormEEC.CCD;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            dlg.SelectedPath = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath());         //Default to patient image folder.
            DialogResult result = dlg.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            if (File.Exists(Path.Combine(dlg.SelectedPath, "ccd.xml")))
            {
                if (MessageBox.Show("Overwrite existing ccd.xml?", "", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            File.WriteAllText(Path.Combine(dlg.SelectedPath, "ccd.xml"), ccd);
            File.WriteAllText(Path.Combine(dlg.SelectedPath, "ccd.xsl"), FormEHR.GetEhrResource("CCD"));
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.ClinicalSummaryProvidedToPt;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            EhrMeasureEvents.Insert(newMeasureEvent);
            FillGridEHRMeasureEvents();
            MessageBox.Show("Exported");
        }
Exemplo n.º 7
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (!PrefC.GetBool(PrefName.ShowFeatureEhr))
     {
         MsgBox.Show(this, "You must go to Setup, Show Features, and activate EHR before entering keys.");
         return;
     }
     if (textYear.Text == "")
     {
         MessageBox.Show("Please enter a year.");
         return;
     }
     if (textQuarter.Text == "")
     {
         MessageBox.Show("Please enter a quarter.");
         return;
     }
     if (textYear.errorProvider1.GetError(textYear) != "" ||
         textQuarter.errorProvider1.GetError(textQuarter) != "")
     {
         MessageBox.Show("Please fix errors first.");
         return;
     }
     if (!FormEHR.QuarterlyKeyIsValid(textYear.Text, textQuarter.Text, PrefC.GetString(PrefName.PracticeTitle), textKey.Text))
     {
         MsgBox.Show(this, "Invalid quarterly key");
         return;
     }
     KeyCur.YearValue    = PIn.Int(textYear.Text);
     KeyCur.QuarterValue = PIn.Int(textQuarter.Text);
     KeyCur.KeyValue     = textKey.Text;
     KeyCur.PracticeName = PrefC.GetString(PrefName.PracticeTitle);
     if (KeyCur.IsNew)
     {
         EhrQuarterlyKeys.Insert(KeyCur);
     }
     else
     {
         EhrQuarterlyKeys.Update(KeyCur);
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 8
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textYear.Text == "")
     {
         MessageBox.Show("Please enter a year.");
         return;
     }
     if (textYear.errorProvider1.GetError(textYear) != "")
     {
         MessageBox.Show("Invalid year, must be two digits.");
         return;
     }
     if (!FormEHR.ProvKeyIsValid(textLName.Text, textFName.Text, PIn.Int(textYear.Text), textKey.Text))
     {
         MsgBox.Show(this, "Invalid provider key");
         return;
     }
     _keyCur.LName     = textLName.Text;
     _keyCur.FName     = textFName.Text;
     _keyCur.YearValue = PIn.Int(textYear.Text);
     _keyCur.ProvKey   = textKey.Text;
     if (_keyCur.IsNew)
     {
         bool isFirstKey = false;
         if (!PrefC.GetBool(PrefName.IsAlertRadiologyProcsEnabled))
         {
             isFirstKey = !EhrProvKeys.HasEhrKeys();
         }
         EhrProvKeys.Insert(_keyCur);
         //if radiology procs alert is disabled and this is the first ehrprovkey, enable the alert (alert handled by the OpenDentalService)
         if (!PrefC.GetBool(PrefName.IsAlertRadiologyProcsEnabled) && isFirstKey)
         {
             Prefs.UpdateBool(PrefName.IsAlertRadiologyProcsEnabled, true);
             DataValid.SetInvalid(InvalidType.Prefs);
         }
     }
     else
     {
         EhrProvKeys.Update(_keyCur);
     }
     DialogResult = DialogResult.OK;
 }
 private void FormQualityMeasures_Load(object sender, EventArgs e)
 {
     Cursor         = Cursors.WaitCursor;
     listProvsKeyed = new List <Provider>();
     _listProviders = Providers.GetDeepCopy(true);
     for (int i = 0; i < _listProviders.Count; i++)
     {
         string            ehrKey       = "";
         int               yearValue    = 0;
         List <EhrProvKey> listProvKeys = EhrProvKeys.GetKeysByFLName(_listProviders[i].LName, _listProviders[i].FName);
         if (listProvKeys.Count != 0)
         {
             ehrKey    = listProvKeys[0].ProvKey;
             yearValue = listProvKeys[0].YearValue;
         }
         if (FormEHR.ProvKeyIsValid(_listProviders[i].LName, _listProviders[i].FName, yearValue, ehrKey))
         {
             //EHR has been valid.
             listProvsKeyed.Add(_listProviders[i]);
         }
     }
     if (listProvsKeyed.Count == 0)
     {
         Cursor = Cursors.Default;
         MessageBox.Show("No providers found with ehr keys.");
         return;
     }
     for (int i = 0; i < listProvsKeyed.Count; i++)
     {
         comboProv.Items.Add(listProvsKeyed[i].GetLongDesc());
         if (Security.CurUser.ProvNum == listProvsKeyed[i].ProvNum)
         {
             comboProv.SelectedIndex = i;
         }
     }
     textDateStart.Text = (new DateTime(DateTime.Now.Year, 1, 1)).ToShortDateString();
     textDateEnd.Text   = (new DateTime(DateTime.Now.Year, 12, 31)).ToShortDateString();
     FillGrid();
     Cursor = Cursors.Default;
 }
Exemplo n.º 10
0
        private void FormSnomeds_Load(object sender, EventArgs e)
        {
            _showingInfoButton      = CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowInfobutton;
            _showingInfobuttonShift = (_showingInfoButton?1:0);
            if (IsSelectionMode || IsMultiSelectMode)
            {
                butClose.Text = Lan.g(this, "Cancel");
            }
            else
            {
                butOK.Visible = false;
            }
            if (IsMultiSelectMode)
            {
                gridMain.SelectionMode = GridSelectionMode.MultiExtended;
            }
            ActiveControl = textCode;
            //This check is here to prevent Snomeds from being used in non-member nations.
            groupBox1.Visible = false;
            Provider prov = Providers.GetProv(Security.CurUser.ProvNum);

            if (prov == null)
            {
                return;
            }
            string            ehrKey       = "";
            int               yearValue    = 0;
            List <EhrProvKey> listProvKeys = EhrProvKeys.GetKeysByFLName(prov.LName, prov.FName);

            if (listProvKeys.Count != 0)
            {
                ehrKey    = listProvKeys[0].ProvKey;
                yearValue = listProvKeys[0].YearValue;
            }
            if (FormEHR.ProvKeyIsValid(prov.LName, prov.FName, yearValue, ehrKey))
            {
                //EHR has been valid.
                groupBox1.Visible = true;
            }
        }
Exemplo n.º 11
0
 private void FormOpenDental_Load(object sender, System.EventArgs e)
 {
     Splash.Dispose();
     Version versionOd=Assembly.GetAssembly(typeof(FormOpenDental)).GetName().Version;
     Version versionObBus=Assembly.GetAssembly(typeof(Db)).GetName().Version;
     if(versionOd!=versionObBus) {
         MessageBox.Show("Mismatched program file versions. Please run the Open Dental setup file again on this computer.");//No MsgBox or Lan.g() here, because we don't want to access the database if there is a version conflict.
         Application.Exit();
         return;
     }
     allNeutral();
     string odUser="";
     string odPassHash="";
     string webServiceUri="";
     YN webServiceIsEcw=YN.Unknown;
     string odPassword="";
     string serverName="";
     string databaseName="";
     string mySqlUser="";
     string mySqlPassword="";
     if(CommandLineArgs.Length!=0) {
         for(int i=0;i<CommandLineArgs.Length;i++) {
             if(CommandLineArgs[i].StartsWith("UserName="******"');
             }
             if(CommandLineArgs[i].StartsWith("PassHash=") && CommandLineArgs[i].Length>9) {
                 odPassHash=CommandLineArgs[i].Substring(9).Trim('"');
             }
             if(CommandLineArgs[i].StartsWith("WebServiceUri=") && CommandLineArgs[i].Length>14) {
                 webServiceUri=CommandLineArgs[i].Substring(14).Trim('"');
             }
             if(CommandLineArgs[i].StartsWith("WebServiceIsEcw=") && CommandLineArgs[i].Length>16) {
                 if(CommandLineArgs[i].Substring(16).Trim('"')=="True") {
                     webServiceIsEcw=YN.Yes;
                 }
                 else {
                     webServiceIsEcw=YN.No;
                 }
             }
             if(CommandLineArgs[i].StartsWith("OdPassword="******"');
             }
             if(CommandLineArgs[i].StartsWith("ServerName=") && CommandLineArgs[i].Length>11) {
                 serverName=CommandLineArgs[i].Substring(11).Trim('"');
             }
             if(CommandLineArgs[i].StartsWith("DatabaseName=") && CommandLineArgs[i].Length>13) {
                 databaseName=CommandLineArgs[i].Substring(13).Trim('"');
             }
             if(CommandLineArgs[i].StartsWith("MySqlUser="******"');
             }
             if(CommandLineArgs[i].StartsWith("MySqlPassword="******"');
             }
         }
     }
     YN noShow=YN.Unknown;
     if(webServiceUri!=""){//a web service was specified
         if(odUser!="" && odPassword!=""){//and both a username and password were specified
             noShow=YN.Yes;
         }
     }
     else if(databaseName!=""){
         noShow=YN.Yes;
     }
     FormChooseDatabase formChooseDb=new FormChooseDatabase();
     formChooseDb.OdUser=odUser;
     formChooseDb.OdPassHash=odPassHash;
     formChooseDb.WebServiceUri=webServiceUri;
     formChooseDb.WebServiceIsEcw=webServiceIsEcw;
     formChooseDb.OdPassword=odPassword;
     formChooseDb.ServerName=serverName;
     formChooseDb.DatabaseName=databaseName;
     formChooseDb.MySqlUser=mySqlUser;
     formChooseDb.MySqlPassword=mySqlPassword;
     formChooseDb.NoShow=noShow;//either unknown or yes
     formChooseDb.GetConfig();
     formChooseDb.GetCmdLine();
     while(true) {//Most users will loop through once.  If user tries to connect to a db with replication failure, they will loop through again.
         if(formChooseDb.NoShow==YN.Yes) {
             if(!formChooseDb.TryToConnect()) {
                 formChooseDb.ShowDialog();
                 if(formChooseDb.DialogResult==DialogResult.Cancel) {
                     Application.Exit();
                     return;
                 }
             }
         }
         else {
             formChooseDb.ShowDialog();
             if(formChooseDb.DialogResult==DialogResult.Cancel) {
                 Application.Exit();
                 return;
             }
         }
         Cursor=Cursors.WaitCursor;
         Splash=new FormSplash();
         if(CommandLineArgs.Length==0) {
             Splash.Show();
         }
         if(!PrefsStartup()){//looks for the AtoZ folder here, but would like to eventually move that down to after login
             Cursor=Cursors.Default;
             Splash.Dispose();
             Application.Exit();
             return;
         }
         if(ReplicationServers.Server_id!=0 && ReplicationServers.Server_id==PrefC.GetInt(PrefName.ReplicationFailureAtServer_id)) {
             MsgBox.Show(this,"This database is temporarily unavailable.  Please connect instead to your alternate database at the other location.");
             formChooseDb.NoShow=YN.No;//This ensures they will get a choose db window next time through the loop.
             ReplicationServers.Server_id=-1;
             continue;
         }
         break;
     }
     if(Programs.UsingEcwTight()) {
         Splash.Dispose();//We don't show splash screen when bridging to eCW.
     }
     //We no longer do this shotgun approach because it can slow the loading time.
     //RefreshLocalData(InvalidType.AllLocal);
     List<InvalidType> invalidTypes=new List<InvalidType>();
     invalidTypes.Add(InvalidType.Prefs);
     invalidTypes.Add(InvalidType.Defs);
     invalidTypes.Add(InvalidType.Providers);//obviously heavily used
     invalidTypes.Add(InvalidType.Programs);//already done above, but needs to be done explicitly to trigger the PostCleanup
     invalidTypes.Add(InvalidType.ToolBut);//so program buttons will show in all the toolbars
     if(Programs.UsingEcwTight()) {
         lightSignalGrid1.Visible=false;
     }
     else{
         invalidTypes.Add(InvalidType.Signals);//so when mouse moves over light buttons, it won't crash
     }
     Plugins.LoadAllPlugins(this);//moved up from right after optimizing tooth chart graphics.  New position might cause problems.
     //It was moved because RefreshLocalData()=>RefreshLocalDataPostCleanup()=>ContrChart2.InitializeLocalData()=>LayoutToolBar() has a hook.
     RefreshLocalData(invalidTypes.ToArray());
     FillSignalButtons(null);
     ContrManage2.InitializeOnStartup();//so that when a signal is received, it can handle it.
     //Lan.Refresh();//automatically skips if current culture is en-US
     //LanguageForeigns.Refresh(CultureInfo.CurrentCulture);//automatically skips if current culture is en-US
     DataValid.BecameInvalid += new OpenDental.ValidEventHandler(DataValid_BecameInvalid);
     signalLastRefreshed=MiscData.GetNowDateTime();
     if(PrefC.GetInt(PrefName.ProcessSigsIntervalInSecs)==0) {
         timerSignals.Enabled=false;
     }
     else {
         timerSignals.Interval=PrefC.GetInt(PrefName.ProcessSigsIntervalInSecs)*1000;
         timerSignals.Enabled=true;
     }
     timerTimeIndic.Enabled=true;
     myOutlookBar.Buttons[0].Caption=Lan.g(this,"Appts");
     myOutlookBar.Buttons[1].Caption=Lan.g(this,"Family");
     myOutlookBar.Buttons[2].Caption=Lan.g(this,"Account");
     myOutlookBar.Buttons[3].Caption=Lan.g(this,"Treat' Plan");
     //myOutlookBar.Buttons[4].Caption=Lan.g(this,"Chart");//??done in RefreshLocalData
     myOutlookBar.Buttons[5].Caption=Lan.g(this,"Images");
     myOutlookBar.Buttons[6].Caption=Lan.g(this,"Manage");
     foreach(MenuItem menuItem in mainMenu.MenuItems){
         TranslateMenuItem(menuItem);
     }
     if(CultureInfo.CurrentCulture.Name=="en-US"){
         //for the business layer, this functionality is duplicated in the Lan class.  Need for SL.
         CultureInfo cInfo=(CultureInfo)CultureInfo.CurrentCulture.Clone();
         cInfo.DateTimeFormat.ShortDatePattern="MM/dd/yyyy";
         Application.CurrentCulture=cInfo;
         //
         //if(CultureInfo.CurrentCulture.TwoLetterISOLanguageName=="en"){
         menuItemTranslation.Visible=false;
     }
     if(!File.Exists("Help.chm")){
         menuItemHelpWindows.Visible=false;
     }
     if(Environment.OSVersion.Platform==PlatformID.Unix){//Create A to Z unsupported on Unix for now.
         menuItemCreateAtoZFolders.Visible=false;
     }
     if(!PrefC.GetBool(PrefName.ADAdescriptionsReset)) {
         ProcedureCodes.ResetADAdescriptions();
         Prefs.UpdateBool(PrefName.ADAdescriptionsReset,true);
     }
     Splash.Dispose();
     //Choose a default DirectX format when no DirectX format has been specified and running in DirectX tooth chart mode.
     //ComputerPref localComputerPrefs=ComputerPrefs.GetForLocalComputer();
     if(ComputerPrefs.LocalComputer.GraphicsSimple==DrawingMode.DirectX && ComputerPrefs.LocalComputer.DirectXFormat=="") {
         //MessageBox.Show(Lan.g(this,"Optimizing tooth chart graphics. This may take a few minutes. You will be notified when the process is complete."));
         ComputerPrefs.LocalComputer.DirectXFormat=FormGraphics.GetPreferredDirectXFormat(this);
         if(ComputerPrefs.LocalComputer.DirectXFormat=="invalid") {
             //No valid local DirectX format could be found.
             //Simply revert to OpenGL.
             ComputerPrefs.LocalComputer.GraphicsSimple=DrawingMode.OpenGL;
         }
         ComputerPrefs.Update(ComputerPrefs.LocalComputer);
         ContrChart2.InitializeOnStartup();
         //MsgBox.Show(this,"Done optimizing tooth chart graphics.");
     }
     if(Security.CurUser==null) {//It could already be set if using web service because login from ChooseDatabase window.
         if(Programs.UsingEcwTight() && odUser!="") {//only leave it null if a user was passed in on the commandline.  If starting OD manually, it will jump into the else.
             //leave user as null
         }
         else {
             if(odUser!="" && odPassword!=""){//if a username and password were passed in
                 Userod user=Userods.GetUserByName(odUser,Programs.UsingEcwTight());
                 if(user!=null){
                     if(Userods.CheckTypedPassword(odPassword,user.Password)){//password matches
                         Security.CurUser=user.Copy();
                         if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
                             string pw=odPassword;
                             if(Programs.UsingEcwTight()) {//ecw requires hash, but non-ecw requires actual password
                                 pw=Userods.EncryptPassword(pw,true);
                             }
                             Security.PasswordTyped=pw;
                         }
                         //TasksCheckOnStartup is one thing that doesn't get done because login window wasn't used
                     }
                 }
             }
             if(Security.CurUser==null) {//normal manual log in process
                 Userod adminUser=Userods.GetAdminUser();
                 if(adminUser.Password=="") {
                     Security.CurUser=adminUser.Copy();
                 }
                 else {
                     FormLogOn_=new FormLogOn();
                     FormLogOn_.ShowDialog(this);
                     if(FormLogOn_.DialogResult==DialogResult.Cancel) {
                         Cursor=Cursors.Default;
                         Application.Exit();
                         return;
                     }
                 }
             }
         }
     }
     if(userControlTasks1.Visible) {
         userControlTasks1.InitializeOnStartup();
     }
     myOutlookBar.SelectedIndex=Security.GetModule(0);//for eCW, this fails silently.
     if(Programs.UsingEcwTight()) {
         myOutlookBar.SelectedIndex=4;//Chart module
         //ToolBarMain.Height=0;//this should force the modules further up on the screen
         //ToolBarMain.Visible=false;
         LayoutControls();
     }
     if(Programs.UsingOrion) {
         myOutlookBar.SelectedIndex=1;//Family module
     }
     myOutlookBar.Invalidate();
     LayoutToolBar();
     SetModuleSelected();
     Cursor=Cursors.Default;
     if(myOutlookBar.SelectedIndex==-1){
         MsgBox.Show(this,"You do not have permission to use any modules.");
     }
     Bridges.Trojan.StartupCheck();
     FormUAppoint.StartThreadIfEnabled();
     Bridges.ICat.StartFileWatcher();
     if(PrefC.GetBool(PrefName.DockPhonePanelShow)){
         #if !DEBUG
             if(Process.GetProcessesByName("WebCamOD").Length==0) {
                 try {
                     Process.Start("WebCamOD.exe");
                 }
                 catch { }//for example, if working from home.
             }
         #endif
     }
     #if !TRIALONLY
         if(PrefC.GetDate(PrefName.BackupReminderLastDateRun).AddMonths(1)<DateTime.Today) {
             FormBackupReminder FormBR=new FormBackupReminder();
             FormBR.ShowDialog();
             if(FormBR.DialogResult==DialogResult.OK){
                 Prefs.UpdateDateT(PrefName.BackupReminderLastDateRun,DateTime.Today);
             }
             else{
                 Application.Exit();
                 return;
             }
         }
     #endif
     FillPatientButton(0,"",false,"",0);
     ThreadCommandLine=new Thread(new ThreadStart(Listen));
     if(!IsSecondInstance) {//can't use a port that's already in use.
         //js We can't do this yet.  I tried it already, and it consumes nearly 100% CPU.  Not while testing, but later.
         //So until we really need to do it, it's easiest no just not start the thread for now.
         //ThreadCommandLine.Start();
     }
     //if(CommandLineArgs.Length>0) {
     ProcessCommandLine(CommandLineArgs);
     //}
     try {
         Computers.UpdateHeartBeat(Environment.MachineName);
     }
     catch { }
     string dllPathEHR=ODFileUtils.CombinePaths(Application.StartupPath,"EHR.dll");
     if(PrefC.GetBoolSilent(PrefName.ShowFeatureEhr,false)) {
         #if EHRTEST
             FormEHR=new FormEHR();
             ContrChart2.InitializeLocalData();//because toolbar is now missing the EHR button.  Only a problem if a db conversion is done when opening the program.
         #else
             FormEHR=null;
             AssemblyEHR=null;
             if(File.Exists(dllPathEHR)) {//EHR.dll is available, so load it up
                 AssemblyEHR=Assembly.LoadFile(dllPathEHR);
                 Type type=AssemblyEHR.GetType("EHR.FormEHR");//namespace.class
                 FormEHR=Activator.CreateInstance(type);
             }
         #endif
     }
     dateTimeLastActivity=DateTime.Now;
     timerLogoff.Enabled=true;
     timerReplicationMonitor.Enabled=true;
     Plugins.HookAddCode(this,"FormOpenDental.Load_end");
 }
Exemplo n.º 12
0
        private void butExport_Click(object sender, EventArgs e)
        {
            string strCcdValidationErrors = EhrCCD.ValidateSettings();

            if (strCcdValidationErrors != "")            //Do not even try to export if global settings are invalid.
            {
                MessageBox.Show(strCcdValidationErrors); //We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there.
                return;
            }
            FolderBrowserDialog dlg    = new FolderBrowserDialog();
            DialogResult        result = dlg.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            DateTime dateNow    = DateTime.Now;
            string   folderPath = ODFileUtils.CombinePaths(dlg.SelectedPath, (dateNow.Year + "_" + dateNow.Month + "_" + dateNow.Day));

            if (Directory.Exists(folderPath))
            {
                int loopCount = 1;
                while (Directory.Exists(folderPath + "_" + loopCount))
                {
                    loopCount++;
                }
                folderPath = folderPath + "_" + loopCount;
            }
            try {
                Directory.CreateDirectory(folderPath);
            }
            catch {
                MessageBox.Show("Error, Could not create folder");
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            Patient patCur;
            string  fileName;
            int     numSkipped      = 0;   //Number of patients skipped. Set to -1 if only one patient was selected and had CcdValidationErrors.
            string  patientsSkipped = "";  //Names of the patients that were skipped, so we can tell the user which ones didn't export correctly.

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                patCur = Patients.GetPat((long)gridMain.Rows[gridMain.SelectedIndices[i]].Tag);              //Cannot use GetLim because more information is needed in the CCD message generation below.
                strCcdValidationErrors = EhrCCD.ValidatePatient(patCur);
                if (strCcdValidationErrors != "")
                {
                    if (gridMain.SelectedIndices.Length == 1)
                    {
                        numSkipped = -1;                       //Set to -1 so we know below to not show the "exported" message.
                        MessageBox.Show(Lan.g(this, "Patient not exported due to the following errors") + ":\r\n" + strCcdValidationErrors);
                        continue;
                    }
                    //If one patient is missing the required information for export, then simply skip the patient. We do not want to popup a message,
                    //because it would be hard to get through the export if many patients were missing required information.
                    numSkipped++;
                    patientsSkipped += "\r\n" + patCur.LName + ", " + patCur.FName;
                    continue;
                }
                fileName = "";
                string lName = patCur.LName;
                for (int j = 0; j < lName.Length; j++)             //Strip all non-letters from FName
                {
                    if (Char.IsLetter(lName, j))
                    {
                        fileName += lName.Substring(j, 1);
                    }
                }
                fileName += "_";
                string fName = patCur.FName;
                for (int k = 0; k < fName.Length; k++)             //Strip all non-letters from LName
                {
                    if (Char.IsLetter(fName, k))
                    {
                        fileName += fName.Substring(k, 1);
                    }
                }
                fileName += "_" + patCur.PatNum;              //LName_FName_PatNum
                string ccd = EhrCCD.GeneratePatientExport(patCur);
                try {
                    File.WriteAllText(ODFileUtils.CombinePaths(folderPath, fileName + ".xml"), ccd);
                }
                catch {
                    MessageBox.Show("Error, Could not create xml file");
                    this.Cursor = Cursors.Default;
                    return;
                }
            }
            if (numSkipped == -1)               //Will be -1 if only one patient was selected, and it did not export correctly.
            {
                this.Cursor = Cursors.Default;
                return;                //Don't display "Exported" to the user because the CCD was not exported.
            }
            try {
                File.WriteAllText(ODFileUtils.CombinePaths(folderPath, "CCD.xsl"), FormEHR.GetEhrResource("CCD"));
            }
            catch {
                MessageBox.Show("Error, Could not create stylesheet file");
            }
            string strMsg = Lan.g(this, "Exported");

            if (numSkipped > 0)
            {
                strMsg += ". " + Lan.g(this, "Patients skipped due to missing information") + ": " + numSkipped + patientsSkipped;
                MsgBoxCopyPaste msgCP = new MsgBoxCopyPaste(strMsg);
                msgCP.Show();
            }
            else
            {
                MessageBox.Show(strMsg);
            }
            this.Cursor = Cursors.Default;
        }
Exemplo n.º 13
0
        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);
                }
            }
        }
Exemplo n.º 14
0
		private void Tool_EHR_Click(bool onLoadShowOrders) {
			//Quarterly key check was removed from here so that any customer can use EHR tools
			//But we require a EHR subscription for them to obtain their MU reports.
			FormEHR FormE = new FormEHR();
			FormE.PatNum=PatCur.PatNum;
			FormE.PatNotCur=PatientNoteCur;
			FormE.PatFamCur=FamCur;
			FormE.ShowDialog();
			if(FormE.DialogResult!=DialogResult.OK) {
				return;
			}
			if(FormE.ResultOnClosing==EhrFormResult.PatientSelect) {
				OnPatientSelected(Patients.GetPat(FormE.PatNum));
				ModuleSelected(FormE.PatNum);
			}
		}
Exemplo n.º 15
0
        private void butSendToPortal_Click(object sender, EventArgs e)
        {
            //Validate
            string strCcdValidationErrors = EhrCCD.ValidateSettings();

            if (strCcdValidationErrors != "")            //Do not even try to export if global settings are invalid.
            {
                MessageBox.Show(strCcdValidationErrors); //We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there.
                return;
            }
            strCcdValidationErrors = EhrCCD.ValidatePatient(PatCur);          //Patient cannot be null, because a patient must be selected before the EHR dashboard will open.
            if (strCcdValidationErrors != "")
            {
                MessageBox.Show(strCcdValidationErrors);                //We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there.
                return;
            }
            Provider prov = null;

            if (Security.CurUser.ProvNum != 0)           //If the current user is a provider.
            {
                prov = Providers.GetProv(Security.CurUser.ProvNum);
            }
            else
            {
                prov = Providers.GetProv(PatCur.PriProv);              //PriProv is not 0, because EhrCCD.ValidatePatient() will block if PriProv is 0.
            }
            try {
                //Create the Clinical Summary.
                FormEhrExportCCD FormEEC = new FormEhrExportCCD(PatCur);
                FormEEC.ShowDialog();
                if (FormEEC.DialogResult != DialogResult.OK)               //Canceled
                {
                    return;
                }
                //Save the clinical summary (ccd.xml) and style sheet (ccd.xsl) as webmail message attachments.
                //TODO: It would be more patient friendly if we instead generated a PDF file containing the Clinical Summary printout, or if we simply displayed the Clinical Summary in the portal.
                //The CMS definition does not prohibit sending human readable files, and sending a PDF to the portal mimics printing the Clinical Summary and handing to patient.
                Random             rnd             = new Random();
                string             attachPath      = EmailAttaches.GetAttachPath();
                List <EmailAttach> listAttachments = new List <EmailAttach>();
                EmailAttach        attachCcd       = new EmailAttach(); //Save Clinical Summary to file in the email attachments folder.
                attachCcd.DisplayedFileName = "ccd.xml";
                attachCcd.ActualFileName    = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".xml";
                listAttachments.Add(attachCcd);
                FileAtoZ.WriteAllText(FileAtoZ.CombinePaths(attachPath, attachCcd.ActualFileName), FormEEC.CCD, "Uploading Attachment for Clinical Summary...");
                EmailAttach attachSs = new EmailAttach();                                                                         //Style sheet attachment.
                attachSs.DisplayedFileName = "ccd.xsl";
                attachSs.ActualFileName    = attachCcd.ActualFileName.Substring(0, attachCcd.ActualFileName.Length - 4) + ".xsl"; //Same base name as the CCD.  The base names must match or the file will not display properly in internet browsers.
                listAttachments.Add(attachSs);
                FileAtoZ.WriteAllText(FileAtoZ.CombinePaths(attachPath, attachSs.ActualFileName), FormEHR.GetEhrResource("CCD"),
                                      "Uploading Attachment for Clinical Summary...");
                //Create and save the webmail message containing the attachments.
                EmailMessage msgWebMail = new EmailMessage();
                msgWebMail.FromAddress    = prov.GetFormalName();
                msgWebMail.ToAddress      = PatCur.GetNameFL();
                msgWebMail.PatNum         = PatCur.PatNum;
                msgWebMail.SentOrReceived = EmailSentOrReceived.WebMailSent;
                msgWebMail.ProvNumWebMail = prov.ProvNum;
                msgWebMail.Subject        = "Clinical Summary";
                msgWebMail.BodyText       = "To view the clinical summary:\r\n1) Download all attachments to the same folder.  Do not rename the files.\r\n2) Open the ccd.xml file in an internet browser.";
                msgWebMail.MsgDateTime    = DateTime.Now;
                msgWebMail.PatNumSubj     = PatCur.PatNum;
                msgWebMail.Attachments    = listAttachments;
                EmailMessages.Insert(msgWebMail);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.ClinicalSummaryProvidedToPt;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            EhrMeasureEvents.Insert(newMeasureEvent);
            FillGridEHRMeasureEvents();            //This will cause the measure event to show in the grid below the popup message on the next line.  Reassures the user that the event was immediately recorded.
            MsgBox.Show(this, "Clinical Summary Sent");
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textYear.Text == "")
            {
                MessageBox.Show("Please enter a year.");
                return;
            }
            if (textQuarter.Text == "")
            {
                MessageBox.Show("Please enter a quarter.");
                return;
            }
            if (textPracticeTitle.Text == "")
            {
                MessageBox.Show("Please enter a practice title.");
                return;
            }
            if (textYear.errorProvider1.GetError(textYear) != "" ||
                textQuarter.errorProvider1.GetError(textQuarter) != "")
            {
                MessageBox.Show("Please fix errors first.");
                return;
            }
            int quarterValue   = PIn.Int(textQuarter.Text);
            int yearValue      = PIn.Int(textYear.Text);
            int monthOfQuarter = 1;

            if (quarterValue == 2)
            {
                monthOfQuarter = 4;
            }
            if (quarterValue == 3)
            {
                monthOfQuarter = 7;
            }
            if (quarterValue == 4)
            {
                monthOfQuarter = 10;
            }
            DateTime firstDayOfQuarter   = new DateTime(2000 + yearValue, monthOfQuarter, 1);
            DateTime earliestReleaseDate = firstDayOfQuarter.AddMonths(-1);

            if (DateTime.Today < earliestReleaseDate)
            {
                MessageBox.Show("Quarterly keys cannot be released more than one month in advance.");
                return;
            }
            if (!FormEHR.QuarterlyKeyIsValid(textYear.Text, textQuarter.Text, textPracticeTitle.Text, textEhrKey.Text))
            {
                MsgBox.Show(this, "Invalid quarterly key");
                return;
            }
            KeyCur.YearValue    = PIn.Int(textYear.Text);
            KeyCur.QuarterValue = PIn.Int(textQuarter.Text);
            KeyCur.PracticeName = textPracticeTitle.Text;
            KeyCur.KeyValue     = textEhrKey.Text;
            KeyCur.Notes        = textNotes.Text;
            if (KeyCur.IsNew)
            {
                EhrQuarterlyKeys.Insert(KeyCur);
            }
            else
            {
                EhrQuarterlyKeys.Update(KeyCur);
            }
            DialogResult = DialogResult.OK;
        }