private void gridPayPlan_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			DataTable table=DataSetMain.Tables["payplan"];
			if(table.Rows[e.Row]["PayPlanNum"].ToString()!="0") {//Payment plan
				PayPlan payplan=PayPlans.GetOne(PIn.Long(table.Rows[e.Row]["PayPlanNum"].ToString()));
				FormPayPlan2=new FormPayPlan(PatCur,payplan);
				FormPayPlan2.ShowDialog();
				if(FormPayPlan2.GotoPatNum!=0) {
					ModuleSelected(FormPayPlan2.GotoPatNum,false);
					return;
				}
				bool isSelectingFamily=gridAcctPat.GetSelectedIndex()==this.DataSetMain.Tables["patient"].Rows.Count-1;
				ModuleSelected(PatCur.PatNum,isSelectingFamily);
			}
			else {//Installment Plan
				FormInstallmentPlanEdit FormIPE= new FormInstallmentPlanEdit();
				FormIPE.InstallmentPlanCur = InstallmentPlans.GetOne(PIn.Long(table.Rows[e.Row]["InstallmentPlanNum"].ToString()));
				FormIPE.IsNew=false;
				FormIPE.ShowDialog();
				ModuleSelected(PatCur.PatNum);
			}
		}
		private void toolBarButPayPlan_Click() {
			PayPlan payPlan=new PayPlan();
			payPlan.PatNum=PatCur.PatNum;
			payPlan.Guarantor=PatCur.Guarantor;
			payPlan.PayPlanDate=DateTimeOD.Today;
			payPlan.CompletedAmt=PatCur.EstBalance;
			PayPlans.Insert(payPlan);
			FormPayPlan FormPP=new FormPayPlan(PatCur,payPlan);
			FormPP.TotalAmt=PatCur.EstBalance;
			FormPP.IsNew=true;
			FormPP.ShowDialog();
			if(FormPP.GotoPatNum!=0){
				ModuleSelected(FormPP.GotoPatNum);//switches to other patient.
			}
			else{
				ModuleSelected(PatCur.PatNum);
			}
		}
		private void gridAccount_CellDoubleClick(object sender, OpenDental.UI.ODGridClickEventArgs e) {
			if(ViewingInRecall) return;
			Actscrollval=gridAccount.ScrollValue;
			DataTable table=DataSetMain.Tables["account"];
			if(table.Rows[e.Row]["ProcNum"].ToString()!="0"){
				Procedure proc=Procedures.GetOneProc(PIn.Long(table.Rows[e.Row]["ProcNum"].ToString()),true);
				Patient pat=FamCur.GetPatient(proc.PatNum);
				FormProcEdit FormPE=new FormProcEdit(proc,pat,FamCur);
				FormPE.ShowDialog();
			}
			else if(table.Rows[e.Row]["AdjNum"].ToString()!="0"){
				Adjustment adj=Adjustments.GetOne(PIn.Long(table.Rows[e.Row]["AdjNum"].ToString()));
				FormAdjust FormAdj=new FormAdjust(PatCur,adj);
				FormAdj.ShowDialog();
			}
			else if(table.Rows[e.Row]["PayNum"].ToString()!="0"){
				Payment PaymentCur=Payments.GetPayment(PIn.Long(table.Rows[e.Row]["PayNum"].ToString()));
				/*
				if(PaymentCur.PayType==0){//provider income transfer
					FormProviderIncTrans FormPIT=new FormProviderIncTrans();
					FormPIT.PatNum=PatCur.PatNum;
					FormPIT.PaymentCur=PaymentCur;
					FormPIT.IsNew=false;
					FormPIT.ShowDialog();
				}
				else{*/
				FormPayment FormPayment2=new FormPayment(PatCur,FamCur,PaymentCur);
				FormPayment2.IsNew=false;
				FormPayment2.ShowDialog();
				//}
			}
			else if(table.Rows[e.Row]["ClaimNum"].ToString()!="0"){//claims and claimpayments
				Claim claim=Claims.GetClaim(PIn.Long(table.Rows[e.Row]["ClaimNum"].ToString()));
				Patient pat=FamCur.GetPatient(claim.PatNum);
				FormClaimEdit FormClaimEdit2=new FormClaimEdit(claim,pat,FamCur);
				FormClaimEdit2.IsNew=false;
				FormClaimEdit2.ShowDialog();
			}
			else if(table.Rows[e.Row]["StatementNum"].ToString()!="0"){
				Statement stmt=Statements.CreateObject(PIn.Long(table.Rows[e.Row]["StatementNum"].ToString()));
				FormStatementOptions FormS=new FormStatementOptions();
				FormS.StmtCur=stmt;
				FormS.ShowDialog();
			}
			else if(table.Rows[e.Row]["PayPlanNum"].ToString()!="0"){
				PayPlan payplan=PayPlans.GetOne(PIn.Long(table.Rows[e.Row]["PayPlanNum"].ToString()));
				FormPayPlan2=new FormPayPlan(PatCur,payplan);
				FormPayPlan2.ShowDialog();
				if(FormPayPlan2.GotoPatNum!=0){
					ModuleSelected(FormPayPlan2.GotoPatNum,false);
					return;
				}
			}
			bool isSelectingFamily=gridAcctPat.GetSelectedIndex()==this.DataSetMain.Tables["patient"].Rows.Count-1;
			ModuleSelected(PatCur.PatNum,isSelectingFamily);
		}