private void gridMu_CellClick(object sender,ODGridClickEventArgs e) { FormMedical FormMed; if(e.Col==3) { switch(listMu[e.Row].MeasureType) { case EhrMeasureType.ProblemList: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Medical; //Close(); break; case EhrMeasureType.MedicationList: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Medical; //Close(); break; case EhrMeasureType.AllergyList: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Medical; //Close(); break; case EhrMeasureType.Demographics: FormPatientEdit FormPatEdit=new FormPatientEdit(PatCur, PatFamCur); FormPatEdit.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.PatientEdit; //Close(); break; case EhrMeasureType.Education: FormEhrEduResourcesPat FormEDUPat = new FormEhrEduResourcesPat(); FormEDUPat.patCur=PatCur; FormEDUPat.ShowDialog(); FillGridMu(); break; case EhrMeasureType.TimelyAccess: case EhrMeasureType.ElectronicCopyAccess: FormPatientPortal FormPatPort=new FormPatientPortal(); FormPatPort.PatCur=PatCur; FormPatPort.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Online; //Close(); break; case EhrMeasureType.ProvOrderEntry: case EhrMeasureType.CPOE_MedOrdersOnly: case EhrMeasureType.CPOE_PreviouslyOrdered: //LaunchOrdersWindow(); break; case EhrMeasureType.Rx: //no action available break; case EhrMeasureType.VitalSigns: case EhrMeasureType.VitalSignsBMIOnly: case EhrMeasureType.VitalSignsBPOnly: case EhrMeasureType.VitalSigns2014: FormVitalsigns FormVital=new FormVitalsigns(); FormVital.PatNum=PatNum; FormVital.ShowDialog(); FillGridMu(); break; case EhrMeasureType.Smoking: FormEhrPatientSmoking FormPS=new FormEhrPatientSmoking(); FormPS.PatCur=PatCur; FormPS.ShowDialog(); PatCur=Patients.GetPat(PatNum); FillGridMu(); break; case EhrMeasureType.Lab: if(DataConnection.DBtype==DatabaseType.Oracle) { MsgBox.Show(this,"Labs not supported with Oracle"); break; } FormEhrLabOrders FormLP=new FormEhrLabOrders(); FormLP.PatCur=PatCur; FormLP.ShowDialog(); FillGridMu(); break; case EhrMeasureType.ElectronicCopy: if(listMu[e.Row].Action=="Provide elect copy to Pt") { FormEhrElectronicCopy FormE=new FormEhrElectronicCopy(); FormE.PatCur=PatCur; FormE.ShowDialog(); FillGridMu(); } break; case EhrMeasureType.ClinicalSummaries: FormEhrClinicalSummary FormCS=new FormEhrClinicalSummary(); FormCS.PatCur=PatCur; FormCS.ShowDialog(); FillGridMu(); break; case EhrMeasureType.Reminders: FormEhrReminders FormRem = new FormEhrReminders(); FormRem.PatCur=PatCur; FormRem.ShowDialog(); FillGridMu(); break; case EhrMeasureType.MedReconcile: int compare=EhrMeasures.CompareReferralsToReconciles(PatNum); if(compare==1 || compare==0) {//Referral count is less than reconcile count or both are zero. FormReferralSelect FormRS=new FormReferralSelect(); FormRS.IsDoctorSelectionMode=true; FormRS.IsSelectionMode=true; FormRS.ShowDialog(); if(FormRS.DialogResult!=DialogResult.OK) { return; } List<RefAttach> RefAttachList=RefAttaches.RefreshFiltered(PatNum,false,0); RefAttach refattach=new RefAttach(); refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum; refattach.PatNum=PatNum; refattach.IsFrom=true; refattach.RefDate=DateTimeOD.Today; if(FormRS.SelectedReferral.IsDoctor) {//whether using ehr or not refattach.IsTransitionOfCare=true; } int order=0; for(int i=0;i<RefAttachList.Count;i++) { if(RefAttachList[i].ItemOrder > order) { order=RefAttachList[i].ItemOrder; } } refattach.ItemOrder=order+1; RefAttaches.Insert(refattach); SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd,PatNum,"Referred From "+Referrals.GetNameFL(refattach.ReferralNum)); } else if(compare==-1) {//The referral count is greater than the reconcile count. //So we do not need to show the referral window, we just need to reconcile below. } FormEhrSummaryOfCare FormMedRec=new FormEhrSummaryOfCare(); FormMedRec.PatCur=PatCur; FormMedRec.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.MedReconcile; //Close(); break; case EhrMeasureType.SummaryOfCare: FormEhrSummaryOfCare FormSoC=new FormEhrSummaryOfCare(); FormSoC.PatCur=PatCur; FormSoC.ShowDialog(); FillGridMu(); break; case EhrMeasureType.SummaryOfCareElectronic: FormEhrSummaryOfCare FormSoCE=new FormEhrSummaryOfCare(); FormSoCE.PatCur=PatCur; FormSoCE.ShowDialog(); FillGridMu(); break; case EhrMeasureType.SecureMessaging: //Patient Sent break; case EhrMeasureType.FamilyHistory: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); break; case EhrMeasureType.ElectronicNote: //Sign a Note break; case EhrMeasureType.CPOE_LabOrdersOnly: if(DataConnection.DBtype==DatabaseType.Oracle) { MsgBox.Show(this,"Labs not supported with Oracle"); break; } FormEhrLabOrders FormLab=new FormEhrLabOrders(); FormLab.PatCur=PatCur; FormLab.ShowDialog(); FillGridMu(); break; case EhrMeasureType.CPOE_RadiologyOrdersOnly: if(DataConnection.DBtype==DatabaseType.Oracle) { MsgBox.Show(this,"Labs not supported with Oracle"); break; } FormEhrLabOrders FormRad=new FormEhrLabOrders(); FormRad.PatCur=PatCur; FormRad.ShowDialog(); FillGridMu(); break; case EhrMeasureType.LabImages: if(DataConnection.DBtype==DatabaseType.Oracle) { MsgBox.Show(this,"Labs not supported with Oracle"); break; } FormEhrLabOrders FormLO=new FormEhrLabOrders(); FormLO.PatCur=PatCur; FormLO.ShowDialog(); FillGridMu(); break; } } if(e.Col==4) { switch(listMu[e.Row].MeasureType) { case EhrMeasureType.MedReconcile: int compare=EhrMeasures.CompareReferralsToReconciles(PatNum); if(compare==1 || compare==0) { FormReferralSelect FormRS=new FormReferralSelect(); FormRS.IsDoctorSelectionMode=true; FormRS.IsSelectionMode=true; FormRS.ShowDialog(); if(FormRS.DialogResult==DialogResult.OK) { List<RefAttach> RefAttachList=RefAttaches.RefreshFiltered(PatNum,false,0); RefAttach refattach=new RefAttach(); refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum; refattach.PatNum=PatNum; refattach.IsFrom=true; refattach.RefDate=DateTimeOD.Today; if(FormRS.SelectedReferral.IsDoctor) {//whether using ehr or not //we're not going to ask. That's stupid. //if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Is this an incoming transition of care from another provider?")){ refattach.IsTransitionOfCare=true; } int order=0; for(int i=0;i<RefAttachList.Count;i++) { if(RefAttachList[i].ItemOrder > order) { order=RefAttachList[i].ItemOrder; } } refattach.ItemOrder=order+1; RefAttaches.Insert(refattach); SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd,PatNum,"Referred From "+Referrals.GetNameFL(refattach.ReferralNum)); FormMedicationReconcile FormMedRec=new FormMedicationReconcile(); FormMedRec.PatCur=PatCur; FormMedRec.ShowDialog(); } } else if(compare==-1) { FormMedicationReconcile FormMedRec=new FormMedicationReconcile(); FormMedRec.PatCur=PatCur; FormMedRec.ShowDialog(); } FillGridMu(); //ResultOnClosing=EhrFormResult.Referrals; //Close(); break; case EhrMeasureType.SummaryOfCare: case EhrMeasureType.SummaryOfCareElectronic: FormReferralsPatient FormRefSum=new FormReferralsPatient(); FormRefSum.PatNum=PatCur.PatNum; FormRefSum.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Referrals; //Close(); break; case EhrMeasureType.Lab: //Redundant now that everything is done from one window break; } } }
private void gridMu_CellClick(object sender,ODGridClickEventArgs e) { FormMedical FormMed; if(e.Col==3) { switch(listMu[e.Row].MeasureType) { case EhrMeasureType.ProblemList: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Medical; //Close(); break; case EhrMeasureType.MedicationList: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Medical; //Close(); break; case EhrMeasureType.AllergyList: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Medical; //Close(); break; case EhrMeasureType.Demographics: FormPatientEdit FormPatEdit=new FormPatientEdit(PatCur, PatFamCur); FormPatEdit.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.PatientEdit; //Close(); break; case EhrMeasureType.Education: FormEhrEduResourcesPat FormEDUPat = new FormEhrEduResourcesPat(); FormEDUPat.patCur=PatCur; FormEDUPat.ShowDialog(); FillGridMu(); break; case EhrMeasureType.TimelyAccess: case EhrMeasureType.ElectronicCopyAccess: FormPatientPortal FormPatPort=new FormPatientPortal(); FormPatPort.PatCur=PatCur; FormPatPort.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Online; //Close(); break; case EhrMeasureType.ProvOrderEntry: case EhrMeasureType.CPOE_MedOrdersOnly: case EhrMeasureType.CPOE_PreviouslyOrdered: //LaunchOrdersWindow(); break; case EhrMeasureType.Rx: //no action available break; case EhrMeasureType.VitalSigns: case EhrMeasureType.VitalSignsBMIOnly: case EhrMeasureType.VitalSignsBPOnly: case EhrMeasureType.VitalSigns2014: FormVitalsigns FormVital=new FormVitalsigns(); FormVital.PatNum=PatNum; FormVital.ShowDialog(); FillGridMu(); break; case EhrMeasureType.Smoking: FormEhrPatientSmoking FormPS=new FormEhrPatientSmoking(); FormPS.PatCur=PatCur; FormPS.ShowDialog(); PatCur=Patients.GetPat(PatNum); FillGridMu(); break; case EhrMeasureType.Lab: FormEhrLabOrders FormLP=new FormEhrLabOrders(); FormLP.PatCur=PatCur; FormLP.ShowDialog(); FillGridMu(); break; case EhrMeasureType.ElectronicCopy: if(listMu[e.Row].Action=="Provide elect copy to Pt") { FormEhrElectronicCopy FormE=new FormEhrElectronicCopy(); FormE.PatCur=PatCur; FormE.ShowDialog(); FillGridMu(); } break; case EhrMeasureType.ClinicalSummaries: FormEhrClinicalSummary FormCS=new FormEhrClinicalSummary(); FormCS.PatCur=PatCur; FormCS.ShowDialog(); FillGridMu(); break; case EhrMeasureType.Reminders: FormEhrReminders FormRem = new FormEhrReminders(); FormRem.PatCur=PatCur; FormRem.ShowDialog(); FillGridMu(); break; case EhrMeasureType.MedReconcile: FormEhrSummaryOfCare FormMedRec=new FormEhrSummaryOfCare(); FormMedRec.PatCur=PatCur; FormMedRec.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.MedReconcile; //Close(); break; case EhrMeasureType.SummaryOfCare: FormEhrSummaryOfCare FormSoC=new FormEhrSummaryOfCare(); FormSoC.PatCur=PatCur; FormSoC.ShowDialog(); FillGridMu(); break; case EhrMeasureType.SummaryOfCareElectronic: FormEhrSummaryOfCare FormSoCE=new FormEhrSummaryOfCare(); FormSoCE.PatCur=PatCur; FormSoCE.ShowDialog(); FillGridMu(); break; case EhrMeasureType.SecureMessaging: //Patient Sent break; case EhrMeasureType.FamilyHistory: FormMed=new FormMedical(PatNotCur,PatCur); FormMed.ShowDialog(); FillGridMu(); break; case EhrMeasureType.ElectronicNote: //Sign a Note break; case EhrMeasureType.CPOE_LabOrdersOnly: FormEhrLabOrders FormLab=new FormEhrLabOrders(); FormLab.PatCur=PatCur; FormLab.ShowDialog(); FillGridMu(); break; case EhrMeasureType.CPOE_RadiologyOrdersOnly: FormEhrLabOrders FormRad=new FormEhrLabOrders(); FormRad.PatCur=PatCur; FormRad.ShowDialog(); FillGridMu(); break; case EhrMeasureType.LabImages: FormEhrLabOrders FormLO=new FormEhrLabOrders(); FormLO.PatCur=PatCur; FormLO.ShowDialog(); FillGridMu(); break; } } if(e.Col==4) { switch(listMu[e.Row].MeasureType) { case EhrMeasureType.MedReconcile: FormReferralsPatient FormRefMed=new FormReferralsPatient(); FormRefMed.PatNum=PatCur.PatNum; FormRefMed.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Referrals; //Close(); break; case EhrMeasureType.SummaryOfCare: case EhrMeasureType.SummaryOfCareElectronic: FormReferralsPatient FormRefSum=new FormReferralsPatient(); FormRefSum.PatNum=PatCur.PatNum; FormRefSum.ShowDialog(); FillGridMu(); //ResultOnClosing=EhrFormResult.Referrals; //Close(); break; case EhrMeasureType.Lab: //Redundant now that everything is done from one window break; } } }
private void gridPat_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(Plugins.HookMethod(this,"ContrFamily.gridPat_CellDoubleClick",PatCur)) { return; } if(TerminalActives.PatIsInUse(PatCur.PatNum)){ MsgBox.Show(this,"Patient is currently entering info at a reception terminal. Please try again later."); return; } if(gridPat.Rows[e.Row].Tag!=null){ if(gridPat.Rows[e.Row].Tag.ToString()=="Referral"){ //RefAttach refattach=(RefAttach)gridPat.Rows[e.Row].Tag; FormReferralsPatient FormRE=new FormReferralsPatient(); FormRE.PatNum=PatCur.PatNum; FormRE.ShowDialog(); } else if(gridPat.Rows[e.Row].Tag.ToString()=="References") { FormReference FormR=new FormReference(); FormR.ShowDialog(); if(FormR.GotoPatNum!=0) { Patient pat=Patients.GetPat(FormR.GotoPatNum); OnPatientSelected(pat); GotoModule.GotoFamily(FormR.GotoPatNum); return; } if(FormR.DialogResult!=DialogResult.OK) { return; } for(int i=0;i<FormR.SelectedCustRefs.Count;i++) { CustRefEntry custEntry=new CustRefEntry(); custEntry.DateEntry=DateTime.Now; custEntry.PatNumCust=PatCur.PatNum; custEntry.PatNumRef=FormR.SelectedCustRefs[i].PatNum; CustRefEntries.Insert(custEntry); } } else if(gridPat.Rows[e.Row].Tag.GetType()==typeof(CustRefEntry)) { FormReferenceEntryEdit FormRE=new FormReferenceEntryEdit((CustRefEntry)gridPat.Rows[e.Row].Tag); FormRE.ShowDialog(); } else if(gridPat.Rows[e.Row].Tag.ToString().Equals("Payor Types")) { FormPayorTypes FormPT = new FormPayorTypes(); FormPT.PatCur=PatCur; FormPT.ShowDialog(); } else {//patfield string tag=gridPat.Rows[e.Row].Tag.ToString(); tag=tag.Substring(8);//strips off all but the number: PatField1 int index=PIn.Int(tag); PatField field=PatFields.GetByName(PatFieldDefs.List[index].FieldName,PatFieldList); if(field==null) { field=new PatField(); field.PatNum=PatCur.PatNum; field.FieldName=PatFieldDefs.List[index].FieldName; if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Currency) { FormPatFieldCurrencyEdit FormPF=new FormPatFieldCurrencyEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } } else { if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Currency) { FormPatFieldCurrencyEdit FormPF=new FormPatFieldCurrencyEdit(field); FormPF.ShowDialog(); } } } } else{ string email=PatCur.Email; long siteNum=PatCur.SiteNum; // FormPatientEdit FormP=new FormPatientEdit(PatCur,FamCur); FormP.IsNew=false; FormP.ShowDialog(); //there are many things which may have changed that need to trigger refresh: //FName, LName, MiddleI, Preferred, SiteNum, or ChartNumber should refresh title bar. //Email change should change email but enabled. //Instead of checking for each of those: /* if(email!=PatCur.Email){//PatCur.EmailChanged){//do it this way later OnPatientSelected(PatCur.PatNum,PatCur.GetNameLF(),PatCur.Email!="",PatCur.ChartNumber); } if(siteNum!=PatCur.SiteNum){ OnPatientSelected(PatCur.PatNum,PatCur.GetNameLF(),PatCur.Email!="",PatCur.ChartNumber); }*/ if(FormP.DialogResult==DialogResult.OK) { OnPatientSelected(PatCur); } } ModuleSelected(PatCur.PatNum); }
private void gridPtInfo_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(Plugins.HookMethod(this,"ContrChart.gridPtInfo_CellDoubleClick",PatCur,FamCur,e,PatientNoteCur)) { return; } if(TerminalActives.PatIsInUse(PatCur.PatNum)) { MsgBox.Show(this,"Patient is currently entering info at a reception terminal. Please try again later."); return; } if(gridPtInfo.Rows[e.Row].Tag!=null) { if(gridPtInfo.Rows[e.Row].Tag.ToString()=="med") { FormMedical FormM=new FormMedical(PatientNoteCur,PatCur); FormM.ShowDialog(); ModuleSelected(PatCur.PatNum); return; } if(gridPtInfo.Rows[e.Row].Tag.GetType()==typeof(RegistrationKey)) { FormRegistrationKeyEdit FormR=new FormRegistrationKeyEdit(); FormR.RegKey=(RegistrationKey)gridPtInfo.Rows[e.Row].Tag; FormR.ShowDialog(); FillPtInfo(); return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="EhrProvKeys") { FormEhrProvKeysCustomer FormPK=new FormEhrProvKeysCustomer(); FormPK.Guarantor=PatCur.Guarantor; FormPK.ShowDialog(); ModuleSelected(PatCur.PatNum); return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="Referral") { //RefAttach refattach=(RefAttach)gridPat.Rows[e.Row].Tag; FormReferralsPatient FormRE=new FormReferralsPatient(); FormRE.PatNum=PatCur.PatNum; FormRE.ShowDialog(); ModuleSelected(PatCur.PatNum); return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="References") { FormReference FormR=new FormReference(); FormR.ShowDialog(); if(FormR.GotoPatNum!=0) { Patient pat=Patients.GetPat(FormR.GotoPatNum); OnPatientSelected(pat); GotoModule.GotoFamily(FormR.GotoPatNum); return; } if(FormR.DialogResult!=DialogResult.OK) { return; } for(int i=0;i<FormR.SelectedCustRefs.Count;i++) { CustRefEntry custEntry=new CustRefEntry(); custEntry.DateEntry=DateTime.Now; custEntry.PatNumCust=PatCur.PatNum; custEntry.PatNumRef=FormR.SelectedCustRefs[i].PatNum; CustRefEntries.Insert(custEntry); } FillPtInfo(); return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="Patient Portal") { FormPatientPortal FormPP=new FormPatientPortal(); FormPP.PatCur=PatCur; FormPP.ShowDialog(); if(FormPP.DialogResult==DialogResult.OK) { FillPtInfo(); } return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="Payor Types") { FormPayorTypes FormPT=new FormPayorTypes(); FormPT.PatCur=PatCur; FormPT.ShowDialog(); if(FormPT.DialogResult==DialogResult.OK) { FillPtInfo(); } return; } if(gridPtInfo.Rows[e.Row].Tag.GetType()==typeof(CustRefEntry)) { FormReferenceEntryEdit FormRE=new FormReferenceEntryEdit((CustRefEntry)gridPtInfo.Rows[e.Row].Tag); FormRE.ShowDialog(); FillPtInfo(); return; } else {//patfield string tag=gridPtInfo.Rows[e.Row].Tag.ToString(); tag=tag.Substring(8);//strips off all but the number: PatField1 int index=PIn.Int(tag); PatField field=PatFields.GetByName(PatFieldDefs.List[index].FieldName,PatFieldList); if(field==null) { field=new PatField(); field.PatNum=PatCur.PatNum; field.FieldName=PatFieldDefs.List[index].FieldName; if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } } else { if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.ShowDialog(); } } } } else { string email=PatCur.Email; long siteNum=PatCur.SiteNum; FormPatientEdit FormP=new FormPatientEdit(PatCur,FamCur); FormP.IsNew=false; FormP.ShowDialog(); if(FormP.DialogResult==DialogResult.OK) { OnPatientSelected(PatCur); } } ModuleSelected(PatCur.PatNum); }
private void Tool_EHR_Click(bool onLoadShowOrders) { #if EHRTEST //so we can step through for debugging. /* EhrQuarterlyKey keyThisQ=EhrQuarterlyKeys.GetKeyThisQuarter(); if(keyThisQ==null) { MessageBox.Show("No quarterly key entered for this quarter."); return; } if(!((FormEHR)FormOpenDental.FormEHR).QuarterlyKeyIsValid((DateTime.Today.Year-2000).ToString(),EhrQuarterlyKeys.MonthToQuarter(DateTime.Today.Month).ToString(), PrefC.GetString(PrefName.PracticeTitle),keyThisQ.KeyValue)) { MessageBox.Show("Invalid quarterly key."); return; } */ ((FormEHR)FormOpenDental.FormEHR).PatNum=PatCur.PatNum; ((FormEHR)FormOpenDental.FormEHR).OnShowLaunchOrders=onLoadShowOrders; ((FormEHR)FormOpenDental.FormEHR).ShowDialog(); if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.None) { //return; } if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.RxEdit) { FormRxEdit FormRXE=new FormRxEdit(PatCur,RxPats.GetRx(((FormEHR)FormOpenDental.FormEHR).LaunchRxNum)); FormRXE.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false);//recursive. The only way out of the loop is EhrFormResult.None. } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.RxSelect) { FormRxSelect FormRS=new FormRxSelect(PatCur); FormRS.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Medical) { FormMedical formM=new FormMedical(PatientNoteCur,PatCur); formM.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.PatientEdit) { FormPatientEdit formP=new FormPatientEdit(PatCur,FamCur); formP.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Online) { FormEhrOnlineAccess formO=new FormEhrOnlineAccess(); formO.PatCur=PatCur; formO.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedReconcile) { FormMedicationReconcile FormMR=new FormMedicationReconcile(); FormMR.PatCur=PatCur; FormMR.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Referrals) { FormReferralsPatient formRP=new FormReferralsPatient(); formRP.PatNum=PatCur.PatNum; formRP.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedicationPatEdit) { FormMedPat formMP=new FormMedPat(); formMP.MedicationPatCur=MedicationPats.GetOne(((FormEHR)FormOpenDental.FormEHR).LaunchMedicationPatNum); formMP.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(true); } else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedicationPatNew) { //This cannot happen unless a provider is logged in with a valid ehr key FormMedications FormM=new FormMedications(); FormM.IsSelectionMode=true; FormM.ShowDialog(); if(FormM.DialogResult==DialogResult.OK) { Medication med=Medications.GetMedicationFromDb(FormM.SelectedMedicationNum); if(med.RxCui==0 //if the med has no Cui, it won't trigger an alert || RxAlertL.DisplayAlerts(PatCur.PatNum,med.RxCui,0))//user sees alert and wants to continue { MedicationPat medicationPat=new MedicationPat(); medicationPat.PatNum=PatCur.PatNum; medicationPat.MedicationNum=FormM.SelectedMedicationNum; medicationPat.ProvNum=Security.CurUser.ProvNum; medicationPat.DateStart=DateTime.Today; FormMedPat FormMP=new FormMedPat(); FormMP.MedicationPatCur=medicationPat; FormMP.IsNew=true; FormMP.IsNewMedOrder=true; FormMP.ShowDialog(); if(FormMP.DialogResult==DialogResult.OK) { ModuleSelected(PatCur.PatNum); } } } Tool_EHR_Click(true); } #else Type type=FormOpenDental.AssemblyEHR.GetType("EHR.FormEHR");//namespace.class object[] args; EhrQuarterlyKey keyThisQ=EhrQuarterlyKeys.GetKeyThisQuarter(); if(keyThisQ==null) { MessageBox.Show("No quarterly key entered for this quarter."); return; } args=new object[] { (DateTime.Today.Year-2000).ToString(),EhrQuarterlyKeys.MonthToQuarter(DateTime.Today.Month).ToString(), PrefC.GetString(PrefName.PracticeTitle),keyThisQ.KeyValue }; if(!(bool)type.InvokeMember("QuarterlyKeyIsValid",System.Reflection.BindingFlags.InvokeMethod,null,FormOpenDental.FormEHR,args)) { MessageBox.Show("Invalid quarterly key."); return; } args=new object[] {PatCur.PatNum}; type.InvokeMember("PatNum",System.Reflection.BindingFlags.SetField,null,FormOpenDental.FormEHR,args); type.InvokeMember("ShowDialog",System.Reflection.BindingFlags.InvokeMethod,null,FormOpenDental.FormEHR,null); if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.None) { return; } if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.RxEdit) { long launchRxNum=(long)type.InvokeMember("LaunchRxNum",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null); FormRxEdit FormRXE=new FormRxEdit(PatCur,RxPats.GetRx(launchRxNum)); FormRXE.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.RxSelect) { FormRxSelect FormRS=new FormRxSelect(PatCur); FormRS.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Medical) { FormMedical formM=new FormMedical(PatientNoteCur,PatCur); formM.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.PatientEdit) { FormPatientEdit formP=new FormPatientEdit(PatCur,FamCur); formP.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Online) { FormEhrOnlineAccess formO=new FormEhrOnlineAccess(); formO.PatCur=PatCur; formO.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedReconcile) { FormMedicationReconcile FormMR=new FormMedicationReconcile(); FormMR.PatCur=PatCur; FormMR.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Referrals) { FormReferralsPatient formRP=new FormReferralsPatient(); formRP.PatNum=PatCur.PatNum; formRP.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(false); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedicationPatEdit) { long medicationPatNum=(long)type.InvokeMember("LaunchMedicationPatNum",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null); FormMedPat formMP=new FormMedPat(); formMP.MedicationPatCur=MedicationPats.GetOne(medicationPatNum); formMP.ShowDialog(); ModuleSelected(PatCur.PatNum); Tool_EHR_Click(true); } else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedicationPatNew) { //This cannot happen unless a provider is logged in with a valid ehr key FormMedications FormM=new FormMedications(); FormM.IsSelectionMode=true; FormM.ShowDialog(); if(FormM.DialogResult==DialogResult.OK) { Medication med=Medications.GetMedicationFromDb(FormM.SelectedMedicationNum); if(med.RxCui==0 //if the med has no Cui, it won't trigger an alert || RxAlertL.DisplayAlerts(PatCur.PatNum,med.RxCui,0))//user sees alert and wants to continue { MedicationPat medicationPat=new MedicationPat(); medicationPat.PatNum=PatCur.PatNum; medicationPat.MedicationNum=FormM.SelectedMedicationNum; medicationPat.ProvNum=Security.CurUser.ProvNum; FormMedPat FormMP=new FormMedPat(); FormMP.MedicationPatCur=medicationPat; FormMP.IsNew=true; FormMP.ShowDialog(); if(FormMP.DialogResult==DialogResult.OK) { ModuleSelected(PatCur.PatNum); } } } Tool_EHR_Click(true); } #endif }
//private void butAddPt_Click(object sender, System.EventArgs e) { private void ToolButAdd_Click() { //At HQ, we cannot allow users to add patients to reseller families. if(PrefC.GetBool(PrefName.DockPhonePanelShow) && Resellers.IsResellerFamily(PatCur.Guarantor)) { MsgBox.Show(this,"Cannot add patients to a reseller family."); return; } Patient tempPat=new Patient(); tempPat.LName =PatCur.LName; tempPat.PatStatus =PatientStatus.Patient; tempPat.Address =PatCur.Address; tempPat.Address2 =PatCur.Address2; tempPat.City =PatCur.City; tempPat.State =PatCur.State; tempPat.Zip =PatCur.Zip; tempPat.HmPhone =PatCur.HmPhone; tempPat.Guarantor =PatCur.Guarantor; tempPat.CreditType =PatCur.CreditType; tempPat.PriProv =PatCur.PriProv; tempPat.SecProv =PatCur.SecProv; tempPat.FeeSched =PatCur.FeeSched; tempPat.BillingType=PatCur.BillingType; tempPat.AddrNote =PatCur.AddrNote; tempPat.ClinicNum =PatCur.ClinicNum;//this is probably better in case they don't have user.ClinicNums set. //tempPat.ClinicNum =Security.CurUser.ClinicNum; if(Patients.GetPat(tempPat.Guarantor).SuperFamily!=0) { tempPat.SuperFamily=PatCur.SuperFamily; } Patients.Insert(tempPat,false); CustReference custRef=new CustReference(); custRef.PatNum=tempPat.PatNum; CustReferences.Insert(custRef); FormPatientEdit FormPE=new FormPatientEdit(tempPat,FamCur); FormPE.IsNew=true; FormPE.ShowDialog(); if(FormPE.DialogResult==DialogResult.OK){ OnPatientSelected(tempPat); ModuleSelected(tempPat.PatNum); } else{ ModuleSelected(PatCur.PatNum); } }
private void gridPtInfo_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(Plugins.HookMethod(this,"ContrChart.gridPtInfo_CellDoubleClick",PatCur,FamCur,e,PatientNoteCur)) { return; } if(TerminalActives.PatIsInUse(PatCur.PatNum)) { MsgBox.Show(this,"Patient is currently entering info at a reception terminal. Please try again later."); return; } if(gridPtInfo.Rows[e.Row].Tag!=null) { if(gridPtInfo.Rows[e.Row].Tag.ToString()=="med") { FormMedical FormM=new FormMedical(PatientNoteCur,PatCur); FormM.ShowDialog(); ModuleSelected(PatCur.PatNum); return; } if(gridPtInfo.Rows[e.Row].Tag.GetType()==typeof(RegistrationKey)) { FormRegistrationKeyEdit FormR=new FormRegistrationKeyEdit(); FormR.RegKey=(RegistrationKey)gridPtInfo.Rows[e.Row].Tag; FormR.ShowDialog(); FillPtInfo(); return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="EhrProvKeys") { FormEhrProvKeysCustomer FormPK=new FormEhrProvKeysCustomer(); FormPK.Guarantor=PatCur.Guarantor; FormPK.ShowDialog(); ModuleSelected(PatCur.PatNum); return; } if(gridPtInfo.Rows[e.Row].Tag.ToString()=="Referral") { //RefAttach refattach=(RefAttach)gridPat.Rows[e.Row].Tag; FormReferralsPatient FormRE=new FormReferralsPatient(); FormRE.PatNum=PatCur.PatNum; FormRE.ShowDialog(); ModuleSelected(PatCur.PatNum); return; } else {//patfield string tag=gridPtInfo.Rows[e.Row].Tag.ToString(); tag=tag.Substring(8);//strips off all but the number: PatField1 int index=PIn.Int(tag); PatField field=PatFields.GetByName(PatFieldDefs.List[index].FieldName,PatFieldList); if(field==null) { field=new PatField(); field.PatNum=PatCur.PatNum; field.FieldName=PatFieldDefs.List[index].FieldName; if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } } else { if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.ShowDialog(); } } } } else { string email=PatCur.Email; long siteNum=PatCur.SiteNum; FormPatientEdit FormP=new FormPatientEdit(PatCur,FamCur); FormP.IsNew=false; FormP.ShowDialog(); if(FormP.DialogResult==DialogResult.OK) { OnPatientSelected(PatCur.PatNum,PatCur.GetNameLF(),PatCur.Email!="",PatCur.ChartNumber); } } ModuleSelected(PatCur.PatNum); }
///<summary>Remember, this button is not even visible if SelectionModeOnly.</summary> private void butAddPt_Click(object sender, System.EventArgs e){ #if(TRIALONLY) MsgBox.Show(this,"Trial version. Maximum 30 patients"); if(Patients.GetNumberPatients()>30){ MsgBox.Show(this,"Maximum reached"); return; } #endif if(textLName.Text=="" && textFName.Text=="" && textChartNumber.Text==""){ MessageBox.Show(Lan.g(this,"Not allowed to add a new patient until you have done a search to see if that patient already exists. Hint: just type a few letters into the Last Name box above.")); return; } Patient PatCur=new Patient(); if(textLName.Text.Length>1){//eg Sp PatCur.LName=textLName.Text.Substring(0,1).ToUpper()+textLName.Text.Substring(1); } if(textFName.Text.Length>1){ PatCur.FName=textFName.Text.Substring(0,1).ToUpper()+textFName.Text.Substring(1); } PatCur.PatStatus=PatientStatus.Patient; PatCur.BillingType=PrefC.GetLong(PrefName.PracticeDefaultBillType); PatCur.PriProv=PrefC.GetLong(PrefName.PracticeDefaultProv); if(PrefC.GetBool(PrefName.ShowFeatureEhr)) { PatCur.Gender=PatientGender.Unknown; } PatCur.ClinicNum=Security.CurUser.ClinicNum; Patients.Insert(PatCur,false); CustReference custRef=new CustReference(); custRef.PatNum=PatCur.PatNum; CustReferences.Insert(custRef); Patient PatOld=PatCur.Copy(); PatCur.Guarantor=PatCur.PatNum; Patients.Update(PatCur,PatOld); Family FamCur=Patients.GetFamily(PatCur.PatNum); FormPatientEdit FormPE=new FormPatientEdit(PatCur,FamCur); FormPE.IsNew=true; FormPE.ShowDialog(); if(FormPE.DialogResult==DialogResult.OK){ NewPatientAdded=true; SelectedPatNum=PatCur.PatNum; DialogResult=DialogResult.OK; } }
private void gridPatInfo_CellDoubleClick(object sender,ODGridClickEventArgs e) { if(TerminalActives.PatIsInUse(PatCur.PatNum)) { MsgBox.Show(this,"Patient is currently entering info at a reception terminal. Please try again later."); return; } if(gridPatInfo.Rows[e.Row].Tag!=null) { //patfield string tag=gridPatInfo.Rows[e.Row].Tag.ToString(); tag=tag.Substring(8);//strips off all but the number: PatField1 int index=PIn.Int(tag); PatField field=PatFields.GetByName(PatFieldDefs.List[index].FieldName,_patFieldList); if(field==null) { field=new PatField(); field.PatNum=PatCur.PatNum; field.FieldName=PatFieldDefs.List[index].FieldName; if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Currency) { FormPatFieldCurrencyEdit FormPF=new FormPatFieldCurrencyEdit(field); FormPF.IsNew=true; FormPF.ShowDialog(); } } else { if(PatFieldDefs.List[index].FieldType==PatFieldType.Text) { FormPatFieldEdit FormPF=new FormPatFieldEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.PickList) { FormPatFieldPickEdit FormPF=new FormPatFieldPickEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Date) { FormPatFieldDateEdit FormPF=new FormPatFieldDateEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Checkbox) { FormPatFieldCheckEdit FormPF=new FormPatFieldCheckEdit(field); FormPF.ShowDialog(); } if(PatFieldDefs.List[index].FieldType==PatFieldType.Currency) { FormPatFieldCurrencyEdit FormPF=new FormPatFieldCurrencyEdit(field); FormPF.ShowDialog(); } } } else { FormPatientEdit FormP=new FormPatientEdit(PatCur,FamCur); FormP.IsNew=false; FormP.ShowDialog(); if(FormP.DialogResult==DialogResult.OK) { OnPatientSelected(PatCur); } } ModuleSelected(PatCur.PatNum); }
//private void butAddPt_Click(object sender, System.EventArgs e) { private void ToolButAdd_Click() { Patient tempPat=new Patient(); tempPat.LName =PatCur.LName; tempPat.PatStatus =PatientStatus.Patient; tempPat.Address =PatCur.Address; tempPat.Address2 =PatCur.Address2; tempPat.City =PatCur.City; tempPat.State =PatCur.State; tempPat.Zip =PatCur.Zip; tempPat.HmPhone =PatCur.HmPhone; tempPat.Guarantor =PatCur.Guarantor; tempPat.CreditType =PatCur.CreditType; tempPat.PriProv =PatCur.PriProv; tempPat.SecProv =PatCur.SecProv; tempPat.FeeSched =PatCur.FeeSched; tempPat.BillingType=PatCur.BillingType; tempPat.AddrNote =PatCur.AddrNote; tempPat.ClinicNum =PatCur.ClinicNum;//this is probably better in case they don't have user.ClinicNums set. //tempPat.ClinicNum =Security.CurUser.ClinicNum; if(Patients.GetPat(tempPat.Guarantor).SuperFamily!=0) { tempPat.SuperFamily=PatCur.SuperFamily; } Patients.Insert(tempPat,false); FormPatientEdit FormPE=new FormPatientEdit(tempPat,FamCur); FormPE.IsNew=true; FormPE.ShowDialog(); if(FormPE.DialogResult==DialogResult.OK){ OnPatientSelected(tempPat.PatNum,tempPat.GetNameLF(),tempPat.Email!="",tempPat.ChartNumber); ModuleSelected(tempPat.PatNum); } else{ ModuleSelected(PatCur.PatNum); } }
///<summary>Remember, this button is not even visible if SelectionModeOnly.</summary> private void butAddPt_Click(object sender, System.EventArgs e){ #if(TRIALONLY) MsgBox.Show(this,"Trial version. Maximum 30 patients"); if(Patients.GetNumberPatients()>30){ MsgBox.Show(this,"Maximum reached"); return; } #endif if(textLName.Text=="" && textFName.Text=="" && textChartNumber.Text==""){ MessageBox.Show(Lan.g(this,"Not allowed to add a new patient until you have done a search to see if that patient already exists. Hint: just type a few letters into the Last Name box above.")); return; } Patient PatCur=new Patient(); if(textLName.Text.Length>1){//eg Sp PatCur.LName=textLName.Text.Substring(0,1).ToUpper()+textLName.Text.Substring(1); } if(textFName.Text.Length>1){ PatCur.FName=textFName.Text.Substring(0,1).ToUpper()+textFName.Text.Substring(1); } PatCur.PatStatus=PatientStatus.Patient; PatCur.BillingType=PrefC.GetLong(PrefName.PracticeDefaultBillType); //Explicitly use the combo clinic instead of FormOpenDental.ClinicNum becuase the combo box should default to that clinic unless manually changed by the user. if(!PrefC.GetBool(PrefName.EasyNoClinics) && comboClinic.SelectedIndex!=0) {//not no clinics and all isn't selected //Set the patients primary provider to the clinic default provider. PatCur.PriProv=Providers.GetDefaultProvider(_listClinics[comboClinic.SelectedIndex-1].ClinicNum).ProvNum; } else { //Set the patients primary provider to the practice default provider. PatCur.PriProv=Providers.GetDefaultProvider().ProvNum; } if(PrefC.GetBool(PrefName.ShowFeatureEhr)) { PatCur.Gender=PatientGender.Unknown; } PatCur.ClinicNum=FormOpenDental.ClinicNum; Patients.Insert(PatCur,false); CustReference custRef=new CustReference(); custRef.PatNum=PatCur.PatNum; CustReferences.Insert(custRef); Patient PatOld=PatCur.Copy(); PatCur.Guarantor=PatCur.PatNum; Patients.Update(PatCur,PatOld); Family FamCur=Patients.GetFamily(PatCur.PatNum); FormPatientEdit FormPE=new FormPatientEdit(PatCur,FamCur); FormPE.IsNew=true; FormPE.ShowDialog(); if(FormPE.DialogResult==DialogResult.OK){ NewPatientAdded=true; SelectedPatNum=PatCur.PatNum; DialogResult=DialogResult.OK; } }