コード例 #1
0
        private void butChangePatientFrom_Click(object sender, EventArgs e)
        {
            FormInsPlans formIP = new FormInsPlans();

            formIP.IsSelectMode = true;
            if (formIP.ShowDialog() == DialogResult.OK)
            {
                _fromInsPlan             = formIP.SelectedPlan;
                textCarrierNameFrom.Text = Carriers.GetName(_fromInsPlan.CarrierNum);
            }
        }
コード例 #2
0
ファイル: FormOpenDental.cs プロジェクト: nampn/ODental
 private void menuItemInsPlans_Click(object sender, System.EventArgs e)
 {
     FormInsPlans FormIP = new FormInsPlans();
     FormIP.ShowDialog();
     RefreshCurrentModule();
 }
コード例 #3
0
ファイル: FormPatientAddAll.cs プロジェクト: nampn/ODental
 private void butPick2_Click(object sender,EventArgs e)
 {
     FormInsPlans FormIP=new FormInsPlans();
     FormIP.empText=textEmployer2.Text;
     FormIP.carrierText=textCarrier2.Text;
     FormIP.IsSelectMode=true;
     FormIP.ShowDialog();
     if(FormIP.DialogResult==DialogResult.Cancel) {
         return;
     }
     selectedPlan2=FormIP.SelectedPlan.Copy();
     //Non-synched fields:
     //selectedPlan2.SubscriberID=textSubscriberID.Text;//later
     //selectedPlan2.DateEffective=DateTime.MinValue;
     //selectedPlan2.DateTerm=DateTime.MinValue;
     //PlanCur.ReleaseInfo=checkRelease.Checked;
     //PlanCur.AssignBen=checkAssign.Checked;
     //PlanCur.SubscNote=textSubscNote.Text;
     //Benefits will be created when click OK.
     textEmployer2.Text=Employers.GetName(selectedPlan2.EmployerNum);
     FillCarrier2(selectedPlan2.CarrierNum);
     textGroupName2.Text=selectedPlan2.GroupName;
     textGroupNum2.Text=selectedPlan2.GroupNum;
 }
コード例 #4
0
ファイル: FormRpLaserLabels.cs プロジェクト: nampn/ODental
 private void butInsCo_Click(object sender,EventArgs e)
 {
     FormInsPlans FormIP = new FormInsPlans();
     FormIP.IsSelectMode = true;
     FormIP.ShowDialog();
     if(FormIP.DialogResult == DialogResult.Cancel) {
         return;
     }
     FillFromInsCoList(FormIP.SelectedPlan.CarrierNum);
 }
コード例 #5
0
		///<summary>Button not visible if SubCur=null, editing from big list.</summary>
		private void butPick_Click(object sender,EventArgs e) {
			FormInsPlans FormIP=new FormInsPlans();
			FormIP.empText=textEmployer.Text;
			FormIP.carrierText=textCarrier.Text;
			FormIP.IsSelectMode=true;
			FormIP.ShowDialog();
			if(FormIP.DialogResult==DialogResult.Cancel) {
				return;
			}
			if(!IsNewPlan && !MsgBox.Show(this,true,"Are you sure you want to use the selected plan?  You should NOT use this if the patient is changing insurance.  Use the Drop button instead.")) {
				return;
			}
			if(FormIP.SelectedPlan.PlanNum==0) {//user clicked Blank
				PlanCur=new InsPlan();
				PlanCur.PlanNum=PlanNumOriginal;
			}
			else {//user selected an existing plan
				PlanCur=FormIP.SelectedPlan;
			}
			FillFormWithPlanCur(true);
			//We need to pass patPlanNum in to RefreshForPlan to get patient level benefits:
			long patPlanNum=0;
			if(PatPlanCur!=null){
				patPlanNum=PatPlanCur.PatPlanNum;
			}
			if(FormIP.SelectedPlan.PlanNum==0){//user clicked blank
				benefitList=new List<Benefit>();
			}
			else {//user selected an existing plan
				benefitList=Benefits.RefreshForPlan(PlanCur.PlanNum,patPlanNum);
			}
			FillBenefits();
			if(IsNewPlan || FormIP.SelectedPlan.PlanNum==0) {//New plan or user clicked blank.
				//Leave benefitListOld alone so that it will trigger deletion of the orphaned benefits later.
			}
			else{
				//Replace benefitListOld so that we only cause changes to be save that are made after this point.
				benefitListOld=new List<Benefit>();
				for(int i=0;i<benefitList.Count;i++) {
					benefitListOld.Add(benefitList[i].Copy());
				}
			}
			//benefitListOld=new List<Benefit>(benefitList);//this was not the proper way to make a shallow copy.
			PlanCurOriginal=PlanCur.Copy();
			FillOtherSubscribers();
			//PlanNumOriginal is NOT reset here.
			//It's now similar to if we'd just opened a new form, except for SubCur still needs to be changed.
		}
コード例 #6
0
		///<summary>Returns false if validation fails.  Returns true if all required insurance fields exist, import fields have valid values, and the insurance plan has been imported successfully.  The user will have the option to pick an existing ins plan.  If any fields on the selected plan do not exactly match the imported fields, they will be prompted to choose between the selected plan's values or to create a new ins plan with the import values.  After validating, the actual import of the new ins plan takes place.  That might consist of dropping the current plan and replacing it or simply inserting the new plan.</summary>
		private bool ValidateAndImportInsurance(bool isPrimary) {
			string insStr="";
			string insWarnStr="";
			byte ordinal;
			if(isPrimary) {
				insStr="ins1";
				insWarnStr="primary insurance";
				ordinal=1;
			}
			else {
				insStr="ins2";
				insWarnStr="secondary insurance";
				ordinal=2;
			}
			//Load up every insurance row related to the particular ins.
			SheetImportRow relationRow=GetImportRowByFieldName(insStr+"Relat");
			SheetImportRow subscriberRow=GetImportRowByFieldName(insStr+"Subscriber");
			SheetImportRow subscriberIdRow=GetImportRowByFieldName(insStr+"SubscriberID");
			SheetImportRow carrierNameRow=GetImportRowByFieldName(insStr+"CarrierName");
			SheetImportRow carrierPhoneRow=GetImportRowByFieldName(insStr+"CarrierPhone");
			SheetImportRow employerNameRow=GetImportRowByFieldName(insStr+"EmployerName");
			SheetImportRow groupNameRow=GetImportRowByFieldName(insStr+"GroupName");
			SheetImportRow groupNumRow=GetImportRowByFieldName(insStr+"GroupNum");
			//Check if the required insurance fields exist on this sheet.
			//NOTE: Employer, group name and group num are optional fields.
			//Checking for nulls in the required fields still needs to be here in this method in case the user has the required fields for one insurance plan but not enough for the other.  They will hit this code ONLY if they have flagged one of the fields on the "other" insurance plan for import that does not have all of the required fields.
			if(relationRow==null 
				|| subscriberRow==null
				|| subscriberIdRow==null
				|| carrierNameRow==null
				|| carrierPhoneRow==null) 
			{
				MessageBox.Show(Lan.g(this,"Required ")+insWarnStr+Lan.g(this," fields are missing on this sheet.  You cannot import ")+insWarnStr
					+Lan.g(this," with this sheet until it contains all of required fields.  Required fields: Relationship, Subscriber, SubscriberID, CarrierName, and CarrierPhone."));
				return false;
			}
			if(relationRow.ImpValObj==null 
				|| subscriberRow.ImpValObj==null
				|| (string)subscriberIdRow.ImpValObj==""
				|| carrierNameRow.ImpValObj==null
				|| carrierPhoneRow.ImpValObj==null) {
				MessageBox.Show(Lan.g(this,"Cannot import ")+insWarnStr+Lan.g(this," until all required fields have been set.  Required fields: Relationship, Subscriber, SubscriberID, CarrierName, and CarrierPhone."));
				return false;
			}
			InsPlan plan=null;
			InsSub sub=null;
			long insSubNum=0;
			long employerNum=0;
			//Get the employer from the db.  If no matching employer found, a new one will automatically get created.
			if(employerNameRow!=null && employerNameRow.ImpValDisplay.Trim()!="") {
				employerNum=Employers.GetEmployerNum(employerNameRow.ImpValDisplay);
			}
			Patient subscriber=(Patient)subscriberRow.ImpValObj;
			//Have user pick a plan------------------------------------------------------------------------------------------------------------
			bool planIsNew=false;
			List<InsSub> subList=InsSubs.GetListForSubscriber(subscriber.PatNum);
			FormInsPlans FormIP=new FormInsPlans();
			FormIP.carrierText=carrierNameRow.ImpValDisplay;
			if(employerNameRow!=null) {
				FormIP.empText=employerNameRow.ImpValDisplay;
			}
			if(groupNameRow!=null) {
				FormIP.groupNameText=groupNameRow.ImpValDisplay;
			}
			if(groupNumRow!=null) {
				FormIP.groupNumText=groupNumRow.ImpValDisplay;
			}
			FormIP.IsSelectMode=true;
			FormIP.ShowDialog();
			if(FormIP.DialogResult!=DialogResult.OK) {
				return false;
			}
			plan=FormIP.SelectedPlan;
			if(plan.PlanNum==0) {
				//User clicked blank plan, so a new plan will be created using the import values.
				planIsNew=true;
			}
			else {//An existing plan was selected so see if the plan is already subscribed to by the subscriber or create a new inssub.  Patplan will be taken care of later.
				for(int i=0;i<subList.Count;i++) {
					if(subList[i].PlanNum==plan.PlanNum) {
						sub=subList[i];
						insSubNum=sub.InsSubNum;
					}
				}
				if(sub==null) {//Create a new inssub if subscriber is not subscribed to this plan yet.
					sub=new InsSub();
					sub.PlanNum=plan.PlanNum;
					sub.Subscriber=subscriber.PatNum;
					sub.SubscriberID=subscriberIdRow.ImpValDisplay;
					sub.ReleaseInfo=true;
					sub.AssignBen=true;
					insSubNum=InsSubs.Insert(sub);
				}
			}
			//User picked a plan but the information they want to import might be different than the chosen plan.  Give them options to use current values or created a new plan.
			//It's still okay to let the user return at this point in order to change importing information.
			DialogResult result;
			//Carrier check-----------------------------------------------------------------------------------------
			if(!planIsNew && plan.CarrierNum!=((Carrier)carrierNameRow.ImpValObj).CarrierNum) {
				result=InsuranceImportQuestion("carrier",isPrimary);
				//Yes means the user wants to keep the information on the plan they picked, nothing to do.
				if(result==DialogResult.No) {
					planIsNew=true;
				}
				if(result==DialogResult.Cancel) {
					return false;
				}
			}
			//Employer check----------------------------------------------------------------------------------------
			if(!planIsNew && employerNum>0 && plan.EmployerNum!=employerNum) {
				result=InsuranceImportQuestion("employer",isPrimary);
				if(result==DialogResult.No) {
					planIsNew=true;
				}
				if(result==DialogResult.Cancel) {
					return false;
				}
			}
			//Subscriber check--------------------------------------------------------------------------------------
			if(!planIsNew && sub.Subscriber!=((Patient)subscriberRow.ImpValObj).PatNum) {
				result=InsuranceImportQuestion("subscriber",isPrimary);
				if(result==DialogResult.No) {
					planIsNew=true;
				}
				if(result==DialogResult.Cancel) {
					return false;
				}
			}
			if(!planIsNew && sub.SubscriberID!=subscriberIdRow.ImpValDisplay) {
				result=InsuranceImportQuestion("subscriber id",isPrimary);
				if(result==DialogResult.No) {
					planIsNew=true;
				}
				if(result==DialogResult.Cancel) {
					return false;
				}
			}
			//Group name check--------------------------------------------------------------------------------------
			if(groupNameRow!=null && !planIsNew && plan.GroupName!=groupNameRow.ImpValDisplay) {
				result=InsuranceImportQuestion("group name",isPrimary);
				if(result==DialogResult.No) {
					planIsNew=true;
				}
				if(result==DialogResult.Cancel) {
					return false;
				}
			}
			//Group num check---------------------------------------------------------------------------------------
			if(groupNumRow!=null && !planIsNew && plan.GroupNum!=groupNumRow.ImpValDisplay) {
				result=InsuranceImportQuestion("group num",isPrimary);
				if(result==DialogResult.No) {
					planIsNew=true;
				}
				if(result==DialogResult.Cancel) {
					return false;
				}
			}
			//Create a new plan-------------------------------------------------------------------------------------
			if(planIsNew) {
				plan=new InsPlan();
				if(employerNum>0) {
					plan.EmployerNum=employerNum;
				}
				plan.PlanType="";
				plan.CarrierNum=((Carrier)carrierNameRow.ImpValObj).CarrierNum;
				if(groupNameRow!=null) {
					plan.GroupName=groupNameRow.ImpValDisplay;
				}
				if(groupNumRow!=null) {
					plan.GroupNum=groupNumRow.ImpValDisplay;
				}
				InsPlans.Insert(plan);
				sub=new InsSub();
				sub.PlanNum=plan.PlanNum;
				sub.Subscriber=subscriber.PatNum;
				sub.SubscriberID=subscriberIdRow.ImpValDisplay;
				sub.ReleaseInfo=true;
				sub.AssignBen=true;
				insSubNum=InsSubs.Insert(sub);
				Benefit ben;
				for(int i=0;i<CovCatC.ListShort.Count;i++) {
					if(CovCatC.ListShort[i].DefaultPercent==-1) {
						continue;
					}
					ben=new Benefit();
					ben.BenefitType=InsBenefitType.CoInsurance;
					ben.CovCatNum=CovCatC.ListShort[i].CovCatNum;
					ben.PlanNum=plan.PlanNum;
					ben.Percent=CovCatC.ListShort[i].DefaultPercent;
					ben.TimePeriod=BenefitTimePeriod.CalendarYear;
					ben.CodeNum=0;
					Benefits.Insert(ben);
				}
				//Zero deductible diagnostic
				if(CovCats.GetForEbenCat(EbenefitCategory.Diagnostic)!=null) {
					ben=new Benefit();
					ben.CodeNum=0;
					ben.BenefitType=InsBenefitType.Deductible;
					ben.CovCatNum=CovCats.GetForEbenCat(EbenefitCategory.Diagnostic).CovCatNum;
					ben.PlanNum=plan.PlanNum;
					ben.TimePeriod=BenefitTimePeriod.CalendarYear;
					ben.MonetaryAmt=0;
					ben.Percent=-1;
					ben.CoverageLevel=BenefitCoverageLevel.Individual;
					Benefits.Insert(ben);
				}
				//Zero deductible preventive
				if(CovCats.GetForEbenCat(EbenefitCategory.RoutinePreventive)!=null) {
					ben=new Benefit();
					ben.CodeNum=0;
					ben.BenefitType=InsBenefitType.Deductible;
					ben.CovCatNum=CovCats.GetForEbenCat(EbenefitCategory.RoutinePreventive).CovCatNum;
					ben.PlanNum=plan.PlanNum;
					ben.TimePeriod=BenefitTimePeriod.CalendarYear;
					ben.MonetaryAmt=0;
					ben.Percent=-1;
					ben.CoverageLevel=BenefitCoverageLevel.Individual;
					Benefits.Insert(ben);
				}
			}
			//Delete the old patplan-------------------------------------------------------------------------------------------------------------
			if(isPrimary && PatPlan1!=null) {//Importing primary and currently has primary ins.
				PatPlans.DeleteNonContiguous(PatPlan1.PatPlanNum);
			}
			if(!isPrimary && PatPlan2!=null) {//Importing secondary and currently has secondary ins.
				PatPlans.DeleteNonContiguous(PatPlan2.PatPlanNum);
			}
			//Then attach new patplan to the plan------------------------------------------------------------------------------------------------
			PatPlan patplan=new PatPlan();
			patplan.Ordinal=ordinal;//Not allowed to be 0.
			patplan.PatNum=PatCur.PatNum;
			patplan.InsSubNum=insSubNum;
			patplan.Relationship=((Relat)relationRow.ImpValObj);
			PatPlans.Insert(patplan);
			//After new plan has been imported, recompute all estimates for this patient because their coverage is now different.  Also set patient.HasIns to the correct value.
			List<ClaimProc> claimProcs=ClaimProcs.Refresh(PatCur.PatNum);
			List<Procedure> procs=Procedures.Refresh(PatCur.PatNum);
			List<PatPlan> patPlans=PatPlans.Refresh(PatCur.PatNum);
			subList=InsSubs.RefreshForFam(Fam);
			List<InsPlan> planList=InsPlans.RefreshForSubList(subList);
			List<Benefit> benList=Benefits.Refresh(patPlans,subList);
			Procedures.ComputeEstimatesForAll(PatCur.PatNum,claimProcs,procs,planList,patPlans,benList,PatCur.Age,subList);
			Patients.SetHasIns(PatCur.PatNum);
			return true;
		}