Exemple #1
0
		///<summary>Gets new List for the specified family.  The only insSubs it misses are for claims with no current coverage.  These are handled as needed.</summary>
		public static List<InsSub> RefreshForFam(Family Fam) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetObject<List<InsSub>>(MethodBase.GetCurrentMethod(),Fam);
			}
			//The command is written in a nested fashion in order to be compatible with both MySQL and Oracle.
			string command=
				"SELECT D.* FROM inssub D,"+
				"((SELECT A.InsSubNum FROM inssub A WHERE";
			//subscribers in family
			for(int i=0;i<Fam.ListPats.Length;i++) {
				if(i>0) {
					command+=" OR";
				}
				command+=" A.Subscriber="+POut.Long(Fam.ListPats[i].PatNum);
			}
			//in union, distinct is implied
			command+=") UNION (SELECT B.InsSubNum FROM inssub B,patplan P WHERE B.InsSubNum=P.InsSubNum AND (";
			for(int i=0;i<Fam.ListPats.Length;i++) {
				if(i>0) {
					command+=" OR";
				}
				command+=" P.PatNum="+POut.Long(Fam.ListPats[i].PatNum);
			}
			command+="))) C "
				+"WHERE D.InsSubNum=C.InsSubNum "
				+"ORDER BY "+DbHelper.UnionOrderBy("DateEffective",4);
			return Crud.InsSubCrud.SelectMany(command);
		}
Exemple #2
0
 public FormGuardianEdit(Guardian guardianCur,Family fam)
 {
     InitializeComponent();
     GuardianCur=guardianCur;
     Fam=fam;
     Lan.F(this);
 }
Exemple #3
0
		///<summary></summary>
		public FormClaimPayPreAuth(Patient patCur,Family famCur,List<InsPlan> planList,List<PatPlan> patPlanList,List<InsSub> subList) {
			InitializeComponent();// Required for Windows Form Designer support
			FamCur=famCur;
			PatCur=patCur;
			PlanList=planList;
			SubList=subList;
			PatPlanList=patPlanList;
			Lan.F(this);
		}
		private void RefreshModuleData(long patNum) {
			if(patNum==0) {
				PatCur=null;
				FamCur=null;
				return;
			}
			FamCur=Patients.GetFamily(patNum);
			PatCur=FamCur.GetPatient(patNum);
		}
Exemple #5
0
		///<summary></summary>
		public FormFamilyMemberSelect(Family fam)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			Lan.F(this);
			Fam=fam;
		}
Exemple #6
0
		///<summary></summary>
		public FormSubscriberSelect(Family famCur)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			Lan.F(this);
			FamCur=famCur;
		}
Exemple #7
0
		///<summary></summary>
		public FormApptsOther(long patNum) {//Patient pat,Family fam){
			InitializeComponent();
			FamCur=Patients.GetFamily(patNum);
			PatCur=FamCur.GetPatient(patNum);
			Lan.F(this);
			for(int i=0;i<listFamily.Columns.Count;i++){
				listFamily.Columns[i].Text=Lan.g(this,listFamily.Columns[i].Text);
			}
			AptNumsSelected=new List<long>();
		}
Exemple #8
0
		///<summary></summary>
		public FormEtrans835ClaimPay(Hx835_Claim claimPaid,Claim claim,Patient patCur,Family famCur,List<InsPlan> planList,List<PatPlan> patPlanList,List<InsSub> subList) {
			InitializeComponent();
			_claimPaid=claimPaid;
			_claim=claim;
			_famCur=famCur;
			_patCur=patCur;
			_listPlans=planList;
			_listInsSubs=subList;
			_listPatPlans=patPlanList;
			Lan.F(this);
		}
Exemple #9
0
		///<summary>Determines which menu Item was selected from the Patient dropdown list and returns the patNum for that patient. This will not be activated when click on 'FAMILY' or on separator, because they do not have events attached.  Calling class then does a ModuleSelected.</summary>
		public static long ButtonSelect(ContextMenu menu,object sender,Family fam) {
			//No need to check RemotingRole; no call to db.
			int index=menu.MenuItems.IndexOf((MenuItem)sender);
			//Patients.PatIsLoaded=true;
			if(index<buttonLastFivePatNums.Count) {
				return (long)buttonLastFivePatNums[index];
			}
			if(fam==null) {
				return 0;//will never happen
			}
			return fam.ListPats[index-buttonLastFivePatNums.Count-2].PatNum;
		}
Exemple #10
0
 ///<summary></summary>
 public FormApptsOther(long patNum)
 {
     //Patient pat,Family fam){
     InitializeComponent();
     FamCur=Patients.GetFamily(patNum);
     PatCur=FamCur.GetPatient(patNum);
     tbApts.CellDoubleClicked += new OpenDental.ContrTable.CellEventHandler(tbApts_CellDoubleClicked);
     Lan.F(this);
     for(int i=0;i<listFamily.Columns.Count;i++){
         listFamily.Columns[i].Text=Lan.g(this,listFamily.Columns[i].Text);
     }
 }
Exemple #11
0
		///<summary>The current patient will already be on the button.  This adds the family members when user clicks dropdown arrow. Can handle null values for pat and fam.  Need to supply the menu to fill as well as the EventHandler to set for each item (all the same).</summary>
		public static void AddFamilyToMenu(ContextMenu menu,EventHandler onClick,long patNum,Family fam) {
			//No need to check RemotingRole; no call to db.
			//fill menu
			menu.MenuItems.Clear();
			for(int i=0;i<buttonLastFiveNames.Count;i++) {
				menu.MenuItems.Add(buttonLastFiveNames[i].ToString(),onClick);
			}
			menu.MenuItems.Add("-");
			menu.MenuItems.Add("FAMILY");
			if(patNum!=0 && fam!=null) {
				for(int i=0;i<fam.ListPats.Length;i++) {
					menu.MenuItems.Add(fam.ListPats[i].GetNameLF(),onClick);
				}
			}
		}
Exemple #12
0
		///<summary>Returns a Family object for the supplied patNum.  Use Family.GetPatient to extract the desired patient from the family.</summary>
		public static Family GetFamily(long patNum) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetObject<Family>(MethodBase.GetCurrentMethod(),patNum);
			}
			string command=//GetFamilySelectCommand(patNum);
				"SELECT patient.*,CASE WHEN Guarantor!=PatNum THEN 1 ELSE 0 END AS IsNotGuar FROM patient WHERE Guarantor = ("
				+"SELECT Guarantor FROM patient WHERE PatNum="+POut.Long(patNum)+") "
				+"ORDER BY IsNotGuar,Birthdate";
			Family fam=new Family();
			List<Patient> patients=Crud.PatientCrud.SelectMany(command);
			foreach(Patient patient in patients) {
				patient.Age = DateToAge(patient.Birthdate);
			}
			fam.ListPats=new Patient[patients.Count];
			patients.CopyTo(fam.ListPats,0);
			return fam;
		}
Exemple #13
0
 private void FormSheetImport_Load(object sender,EventArgs e)
 {
     if(SheetCur!=null) {
         pat=Patients.GetPat(SheetCur.PatNum);
     }
     else {
         throw new NotImplementedException();//js this broke with the move to dot net 4.0.
         /*
         pat=Patients.GetPat(DocCur.PatNum);
         CAcroApp acroApp=null;
         try {
             acroApp=new AcroAppClass();//Initialize Acrobat by creating App object
         }
         catch {
             MsgBox.Show(this,"Requires Acrobat 9 Pro to be installed on this computer.");
             DialogResult=DialogResult.Cancel;
             return;
         }
         //acroApp.Show();// Show Acrobat Viewer
         //acroApp.Hide();//This is annoying if Acrobat is already open for some other reason.
         CAcroAVDoc avDoc=new AcroAVDocClass();
         string pathToPdf=CodeBase.ODFileUtils.CombinePaths(ImageStore.GetPatientFolder(pat),DocCur.FileName);
         if(!avDoc.Open(pathToPdf,"")){
             MessageBox.Show(Lan.g(this,"Could not open")+" "+pathToPdf);
             DialogResult=DialogResult.Cancel;
             return;
         }
         IAFormApp formApp=new AFormAppClass();//Create a IAFormApp object so we can access the form fields in the open document
         IFields myFields=(IFields)formApp.Fields;// Get the IFields object associated with the form
         IEnumerator myEnumerator = myFields.GetEnumerator();// Get the IEnumerator object for myFields
         dictAcrobatFields=new Dictionary<string,string>();
         IField myField;
         string nameClean;
         string valClean;
         while(myEnumerator.MoveNext()) {
             myField=(IField)myEnumerator.Current;// Get the IField object
             if(myField.Value==null){
                 continue;
             }
             //if the form was designed in LiveCycle, the names will look like this: topmostSubform[0].page1[0].SSN[0]
             //Whereas, if it was designed in Acrobat, the names will look like this: SSN
             //So...
             nameClean=myField.Name;
             if(nameClean.Contains("[") && nameClean.Contains(".")) {
                 nameClean=nameClean.Substring(nameClean.LastIndexOf(".")+1);
                 nameClean=nameClean.Substring(0,nameClean.IndexOf("["));
             }
             if(nameClean=="misc") {
                 int suffix=1;
                 nameClean=nameClean+suffix.ToString();
                 while(dictAcrobatFields.ContainsKey(nameClean)) {//untested.
                     suffix++;
                     nameClean=nameClean+suffix.ToString();
                 }
             }
             valClean=myField.Value;
             if(valClean=="Off") {
                 valClean="";
             }
             //myField.Type//possible values include text,radiobutton,checkbox
             //MessageBox.Show("Raw:"+myField.Name+"  Name:"+nameClean+"  Value:"+myField.Value);
             if(dictAcrobatFields.ContainsKey(nameClean)) {
                 continue;
             }
             dictAcrobatFields.Add(nameClean,valClean);
             //name:topmostSubform[0].page1[0].SSN[0]
         }
         //acroApp.Hide();//Doesn't work well enough
         //this.BringToFront();//Doesn't work
         //acroApp.Minimize();
         acroApp.Exit();
         acroApp=null;
         */
     }
     fam=Patients.GetFamily(pat.PatNum);
     AddressSameForFam=true;
     for(int i=0;i<fam.ListPats.Length;i++) {
         if(pat.HmPhone!=fam.ListPats[i].HmPhone
             || pat.Address!=fam.ListPats[i].Address
             || pat.Address2!=fam.ListPats[i].Address2
             || pat.City!=fam.ListPats[i].City
             || pat.State!=fam.ListPats[i].State
             || pat.Zip!=fam.ListPats[i].Zip)
         {
             AddressSameForFam=false;
             break;
         }
     }
     patPlanList=PatPlans.Refresh(pat.PatNum);
     subList=InsSubs.RefreshForFam(fam);
     planList=InsPlans.RefreshForSubList(subList);
     if(patPlanList.Count==0) {
         patPlan1=null;
         plan1=null;
         sub1=null;
         ins1Relat=null;
         carrier1=null;
     }
     else {
         patPlan1=patPlanList[0];
         sub1=InsSubs.GetSub(patPlan1.InsSubNum,subList);
         plan1=InsPlans.GetPlan(sub1.PlanNum,planList);
         ins1Relat=patPlan1.Relationship;
         carrier1=Carriers.GetCarrier(plan1.CarrierNum);
     }
     if(patPlanList.Count<2) {
         patPlan2=null;
         plan2=null;
         sub2=null;
         ins2Relat=null;
         carrier2=null;
     }
     else {
         patPlan2=patPlanList[1];
         sub2=InsSubs.GetSub(patPlan2.InsSubNum,subList);
         plan2=InsPlans.GetPlan(sub2.PlanNum,planList);
         ins2Relat=patPlan2.Relationship;
         carrier2=Carriers.GetCarrier(plan2.CarrierNum);
     }
     FillRows();
     FillGrid();
 }
Exemple #14
0
        ///<summary>Adds the xml for one statement.</summary>
        public static void GenerateOneStatement(XmlWriter writer,Statement stmt,Patient pat,Family fam,DataSet dataSet)
        {
            Patient guar=fam.ListPats[0];
            writer.WriteStartElement("Statement");
            //writer.WriteAttributeString("CreditCardChoice",PrefC.GetString(PrefName.BillingElectCreditCardChoices"));
            //remit address----------------------------------------------------------
            writer.WriteStartElement("RemitAddress");
            if(!PrefC.GetBool(PrefName.EasyNoClinics) && Clinics.List.Length>0 //if using clinics
                && Clinics.GetClinic(guar.ClinicNum)!=null)//and this guar is assigned to a clinic
            {
                Clinic clinic=Clinics.GetClinic(guar.ClinicNum);
                writer.WriteElementString("Name",clinic.Description);
                writer.WriteElementString("Address",clinic.Address);
                writer.WriteElementString("Address2",clinic.Address2);
                writer.WriteElementString("City",clinic.City);
                writer.WriteElementString("State",clinic.State);
                writer.WriteElementString("Zip",clinic.Zip);
                string phone="";
                if(clinic.Phone.Length==10) {
                    phone="("+clinic.Phone.Substring(0,3)+")"+clinic.Phone.Substring(3,3)+"-"+clinic.Phone.Substring(6);
                }
                writer.WriteElementString("Phone",phone);
            }
            else{//not using clinics
                writer.WriteElementString("Name",PrefC.GetString(PrefName.PracticeTitle));
                writer.WriteElementString("Address",PrefC.GetString(PrefName.PracticeAddress));
                writer.WriteElementString("Address2",PrefC.GetString(PrefName.PracticeAddress2));
                writer.WriteElementString("City",PrefC.GetString(PrefName.PracticeCity));
                writer.WriteElementString("State",PrefC.GetString(PrefName.PracticeST));
                writer.WriteElementString("Zip",PrefC.GetString(PrefName.PracticeZip));
                writer.WriteElementString("Phone",PrefC.GetString(PrefName.PracticePhone));
            }
            writer.WriteEndElement();//RemitAddress
            //Patient-------------------------------------------------------------------------------
            writer.WriteStartElement("Patient");
            writer.WriteElementString("Name",guar.GetNameFLFormal());
            writer.WriteElementString("AccountNum",guar.PatNum.ToString());
            writer.WriteElementString("Address",guar.Address);
            writer.WriteElementString("Address2",guar.Address2);
            writer.WriteElementString("City",guar.City);
            writer.WriteElementString("State",guar.State);
            writer.WriteElementString("Zip",guar.Zip);
            writer.WriteEndElement();//Patient
            //Account summary-----------------------------------------------------------------------
            writer.WriteStartElement("AccountSummary");
            if(PrefC.GetLong(PrefName.StatementsCalcDueDate)==-1){
                writer.WriteElementString("DueDate",Lan.g("FormRpStatement","Upon Receipt"));
            }
            else{
                DateTime dueDate=DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
                writer.WriteElementString("DueDate",dueDate.ToString("MM/dd/yyyy"));
            }
            writer.WriteElementString("StatementDate",stmt.DateSent.ToString("MM/dd/yyyy"));
            DataTable tableAccount=null;
            for(int i=0;i<dataSet.Tables.Count;i++) {
                if(dataSet.Tables[i].TableName.StartsWith("account")) {
                    tableAccount=dataSet.Tables[i];
                }
            }
            //on a regular printed statement, the amount due at the top might be different from the balance at the middle right.
            //This is because of payment plan balances.
            //But in e-bills, there is only one amount due.
            //Insurance estimate is already subtracted, and payment plan balance is already added.
            double amountDue=guar.BalTotal;
            //add payplan due amt:
            for(int m=0;m<dataSet.Tables["misc"].Rows.Count;m++) {
                if(dataSet.Tables["misc"].Rows[m]["descript"].ToString()=="payPlanDue") {
                    amountDue+=PIn.Double(dataSet.Tables["misc"].Rows[m]["value"].ToString());
                }
            }
            if(PrefC.GetBool(PrefName.BalancesDontSubtractIns)) {
                writer.WriteElementString("EstInsPayments","");
                writer.WriteElementString("AmountDue",amountDue.ToString("F2"));
            }
            else{//this is typical
                writer.WriteElementString("EstInsPayments",guar.InsEst.ToString("F2"));
                amountDue-=guar.InsEst;
                writer.WriteElementString("AmountDue",amountDue.ToString("F2"));
            }
            writer.WriteElementString("Bal_0_30",guar.Bal_0_30.ToString("F2"));
            writer.WriteElementString("Bal_31_60",guar.Bal_31_60.ToString("F2"));
            writer.WriteElementString("Bal_61_90",guar.Bal_61_90.ToString("F2"));
            writer.WriteElementString("BalOver90",guar.BalOver90.ToString("F2"));
            writer.WriteEndElement();//AccountSummary
            //Notes-----------------------------------------------------------------------------------
            writer.WriteStartElement("Notes");
            if(stmt.NoteBold!="") {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor",ColorToHexString(Color.DarkRed));
                writer.WriteCData(stmt.NoteBold);
                writer.WriteEndElement();//Note
            }
            if(stmt.Note!="") {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor",ColorToHexString(Color.Black));
                writer.WriteCData(stmt.Note);
                writer.WriteEndElement();//Note
            }
            writer.WriteEndElement();//Notes
            //Detail items------------------------------------------------------------------------------
            writer.WriteStartElement("DetailItems");
            string descript;
            string fulldesc;
            string procCode;
            string tth;
            string[] lineArray;
            List<string> lines;
            DateTime date;
            int seq=0;
            for(int i=0;i<tableAccount.Rows.Count;i++) {
                procCode=tableAccount.Rows[i]["ProcCode"].ToString();
                tth=tableAccount.Rows[i]["tth"].ToString();
                descript=tableAccount.Rows[i]["description"].ToString();
                fulldesc=procCode+" "+tth+" "+descript;
                lineArray=fulldesc.Split(new string[] { "\r\n" },StringSplitOptions.RemoveEmptyEntries);
                lines=new List<string>(lineArray);
                //We assume that the line limit is 40 char.
                if(lines[0].Length>40) {
                    string newline=lines[0].Substring(40);
                    lines[0]=lines[0].Substring(0,40);//first half
                    lines.Insert(1,newline);//second half
                }
                for(int li=0;li<lines.Count;li++) {
                    writer.WriteStartElement("Item");
                    writer.WriteAttributeString("sequence",seq.ToString());
                    if(li==0) {
                        date=(DateTime)tableAccount.Rows[i]["DateTime"];
                        writer.WriteElementString("Date",date.ToString("MM/dd/yyyy"));
                        writer.WriteElementString("PatientName",tableAccount.Rows[i]["patient"].ToString());
                    }
                    else {
                        writer.WriteElementString("Date","");
                        writer.WriteElementString("PatientName","");
                    }
                    writer.WriteElementString("Description",lines[li]);
                    if(li==0) {
                        writer.WriteElementString("Charges",tableAccount.Rows[i]["charges"].ToString());
                        writer.WriteElementString("Credits",tableAccount.Rows[i]["credits"].ToString());
                        writer.WriteElementString("Balance",tableAccount.Rows[i]["balance"].ToString());
                    }
                    else {
                        writer.WriteElementString("Charges","");
                        writer.WriteElementString("Credits","");
                        writer.WriteElementString("Balance","");
                    }
                    writer.WriteEndElement();//Item
                    seq++;
                }

            }
            writer.WriteEndElement();//DetailItems
            writer.WriteEndElement();//Statement
        }
Exemple #15
0
 ///<summary></summary>
 public FormPaySplitEdit(Family famCur)
 {
     //PaySplit paySplitCur,Family famCur){
     InitializeComponent();
     FamCur=famCur;
     Lan.F(this);
 }
Exemple #16
0
		///<summary></summary>
		public void ModuleUnselected() {
			FamCur=null;
			foreach(Control c in this.Controls) {
				if(c.GetType()==typeof(AxAcroPDFLib.AxAcroPDF)) {
					Controls.Remove(c);
					c.Dispose();
				}
			}
			//Cancel current image capture.
			xRayImageController.KillXRayThread();
			_patNumLast=0;//Clear out the last pat num so that a security log gets entered that the module was "visited" or "refreshed".
			Plugins.HookAddCode(this,"ContrImages.ModuleUnselected_end");
		}
Exemple #17
0
		///<summary>Adds the xml for one statement.</summary>
		public static void GenerateOneStatement(XmlWriter writer,Statement stmt,Patient pat,Family fam,DataSet dataSet) {
			writer.WriteStartElement("Statement");
			writer.WriteStartElement("RecipientAddress");
			Patient guar=fam.ListPats[0];
			writer.WriteElementString("Name",guar.GetNameFLFormal());
			if(PrefC.GetBool(PrefName.StatementAccountsUseChartNumber)) {
				writer.WriteElementString("Account",guar.ChartNumber);
			}
			else {
				writer.WriteElementString("Account",POut.Long(guar.PatNum));
			}
			writer.WriteElementString("Address1",guar.Address);
			writer.WriteElementString("Address2",guar.Address2);
			writer.WriteElementString("City",guar.City);
			writer.WriteElementString("State",guar.State);
			writer.WriteElementString("Zip",guar.Zip);
			string email="";
			Def billingDef=DefC.GetDef(DefCat.BillingTypes,guar.BillingType);
			if(billingDef.ItemValue=="E") {
				email=guar.Email;
			}
			writer.WriteElementString("EMail",email);
			writer.WriteEndElement();//RecipientAddress
			//Account summary-----------------------------------------------------------------------
			if(stmt.DateRangeFrom.Year<1880) {//make up a statement date.
				writer.WriteElementString("PriorStatementDate",DateTime.Today.AddMonths(-1).ToString("MM/dd/yyyy"));
			}
			else {
				writer.WriteElementString("PriorStatementDate",stmt.DateRangeFrom.AddDays(-1).ToString("MM/dd/yyyy"));
			}
			DateTime dueDate;
			if(PrefC.GetLong(PrefName.StatementsCalcDueDate)==-1) {
				dueDate=DateTime.Today.AddDays(10);
			}
			else {
				dueDate=DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
			}
			writer.WriteElementString("DueDate",dueDate.ToString("MM/dd/yyyy"));
			writer.WriteElementString("StatementDate",stmt.DateSent.ToString("MM/dd/yyyy"));
			double balanceForward=0;
			for(int r=0;r<dataSet.Tables["misc"].Rows.Count;r++) {
				if(dataSet.Tables["misc"].Rows[r]["descript"].ToString()=="balanceForward") {
					balanceForward=PIn.Double(dataSet.Tables["misc"].Rows[r]["value"].ToString());
				}
			}
			writer.WriteElementString("PriorBalance",balanceForward.ToString("F2"));
			DataTable tableAccount=null;
			for(int i=0;i<dataSet.Tables.Count;i++) {
				if(dataSet.Tables[i].TableName.StartsWith("account")) {
					tableAccount=dataSet.Tables[i];
				}
			}
			double credits=0;
			for(int i=0;i<tableAccount.Rows.Count;i++) {
				credits+=PIn.Double(tableAccount.Rows[i]["creditsDouble"].ToString());
			}
			writer.WriteElementString("Credits",credits.ToString("F2"));
			decimal payPlanDue=0;
			double amountDue=guar.BalTotal;
			for(int m=0;m<dataSet.Tables["misc"].Rows.Count;m++) {
				if(dataSet.Tables["misc"].Rows[m]["descript"].ToString()=="payPlanDue") {
					payPlanDue+=PIn.Decimal(dataSet.Tables["misc"].Rows[m]["value"].ToString());//This will be an option once more users are using it.
				}
			}
			writer.WriteElementString("PayPlanDue",payPlanDue.ToString("F2"));
			if(PrefC.GetBool(PrefName.BalancesDontSubtractIns)) {
				writer.WriteElementString("EstInsPayments","");//optional.
			}
			else {//this is typical
				writer.WriteElementString("EstInsPayments",guar.InsEst.ToString("F2"));//optional.
				amountDue-=guar.InsEst;
			}
			InstallmentPlan installPlan=InstallmentPlans.GetOneForFam(guar.PatNum);
			if(installPlan!=null) {
				//show lesser of normal total balance or the monthly payment amount.
				if(installPlan.MonthlyPayment < amountDue) {
					amountDue=installPlan.MonthlyPayment;
				}
			}
			writer.WriteElementString("AmountDue",amountDue.ToString("F2"));
			writer.WriteElementString("Bal_0_30",guar.Bal_0_30.ToString("F2"));//optional
			writer.WriteElementString("PastDue30",guar.Bal_31_60.ToString("F2"));//optional
			writer.WriteElementString("PastDue60",guar.Bal_61_90.ToString("F2"));//optional
			writer.WriteElementString("PastDue90",guar.BalOver90.ToString("F2"));//optional
			//Notes-----------------------------------------------------------------------------------
			writer.WriteStartElement("Notes");
			if(stmt.NoteBold!="") {
				writer.WriteStartElement("Note");
				writer.WriteAttributeString("FgColor","Red");
				writer.WriteCData(stmt.NoteBold);
				writer.WriteEndElement();//Note
			}
			if(stmt.Note!="") {
				writer.WriteStartElement("Note");
				writer.WriteCData(stmt.Note);
				writer.WriteEndElement();//Note
			}
			writer.WriteEndElement();//Notes
			//Detail items------------------------------------------------------------------------------
			writer.WriteStartElement("DetailItems");
			//string note;
			string descript;
			string fulldesc;
			string procCode;
			string tth;
			//string linedesc;
			string[] lineArray;
			List<string> lines;
			DateTime date;
			int seq=0;
			for(int i=0;i<tableAccount.Rows.Count;i++) {
				procCode=tableAccount.Rows[i]["ProcCode"].ToString();
				tth=tableAccount.Rows[i]["tth"].ToString();
				descript=tableAccount.Rows[i]["description"].ToString();
				if(tth=="") {
					fulldesc=descript;
				}
				else {
					fulldesc=tth+" "+descript;
				}
				if(fulldesc==""){
					fulldesc=" ";
				}
				lineArray=fulldesc.Split(new string[] { "\r\n" },StringSplitOptions.RemoveEmptyEntries);
				lines=new List<string>(lineArray);
				//The specs say that the line limit is 30 char.  But in testing, it will take 50 char.
				//We will use 40 char to be safe.
				if(lines[0].Length>40) {
					string newline=lines[0].Substring(40);
					lines[0]=lines[0].Substring(0,40);//first half
					lines.Insert(1,newline);//second half
				}
				for(int li=0;li<lines.Count;li++) {
					writer.WriteStartElement("DetailItem");//has a child item. We won't add optional child note
					writer.WriteAttributeString("sequence",seq.ToString());
					writer.WriteElementString("ProcCode",procCode);
					writer.WriteStartElement("Item");
					if(li==0) {
						date=(DateTime)tableAccount.Rows[i]["DateTime"];
						writer.WriteElementString("Date",date.ToString("MM/dd/yyyy"));
						writer.WriteElementString("PatientName",tableAccount.Rows[i]["patient"].ToString());
					}
					else {
						writer.WriteElementString("Date","");
						writer.WriteElementString("PatientName","");
					}
					writer.WriteElementString("Description",lines[li]);
					if(li==0) {
						writer.WriteElementString("Charges",tableAccount.Rows[i]["charges"].ToString());
						writer.WriteElementString("Credits",tableAccount.Rows[i]["credits"].ToString());
						writer.WriteElementString("Balance",tableAccount.Rows[i]["balance"].ToString());
					}
					else {
						writer.WriteElementString("Charges","");
						writer.WriteElementString("Credits","");
						writer.WriteElementString("Balance","");
					}
					writer.WriteEndElement();//Item
					writer.WriteEndElement();//DetailItem
					seq++;
				}
			}
			writer.WriteEndElement();//DetailItems
			writer.WriteEndElement();//Statement
		}
Exemple #18
0
		private void FormInsPlansSelect_Load(object sender, System.EventArgs e) {
			if(!ViewRelat){
				labelRelat.Visible=false;
				listRelat.Visible=false;
			}
			//usage: eg. from coverage.  Since can be totally new subscriber, get all plans for them.
			FamCur=Patients.GetFamily(PatNum);
			PatCur=FamCur.GetPatient(PatNum);
			SubList=InsSubs.RefreshForFam(FamCur);
			PlanList=InsPlans.RefreshForSubList(SubList);
			FillPlanData();
			if(!ShowNoneButton) {
				butNone.Visible=false;
			}
    }
		///<summary></summary>
		public void ModuleUnselected() {
			FamCur=null;
			//Cancel current image capture.
			xRayImageController.KillXRayThread();
			Plugins.HookAddCode(this,"ContrImages.ModuleUnselected_end");
		}
Exemple #20
0
 ///<summary>procCur can be null if not editing from within an actual procedure.  If the save is to happen within this window, then set saveToDb true.  If the object is to be altered here, but saved in a different window, then saveToDb=false.</summary>
 public FormClaimProc(ClaimProc claimProcCur,Procedure procCur,Family famCur,Patient patCur,List<InsPlan> planList,List<ClaimProcHist> histList,ref List<ClaimProcHist> loopList,List<PatPlan> patPlanList,bool saveToDb,List<InsSub> subList)
 {
     ClaimProcCur=claimProcCur;//always work directly with the original object.  Revert if we change our mind.
     ClaimProcOld=ClaimProcCur.Copy();
     proc=procCur;
     FamCur=famCur;
     PatCur=patCur;
     PlanList=planList;
     SubList=subList;
     HistList=histList;
     LoopList=loopList;
     PatPlanList=patPlanList;
     SaveToDb=saveToDb;
     InitializeComponent();// Required for Windows Form Designer support
     //can't use Lan.F because of complexity of label use
     Lan.C(this, new System.Windows.Forms.Control[]
         {
             this,
             this.label1,
             this.label9,
             this.label30,
             this.labelProcDate,
             this.label28,
             this.label29,
             this.groupClaim,
             this.radioEstimate,
             this.radioClaim,
             this.labelCodeSent,
             this.labelFeeBilled,
             this.labelRemarks,
             this.labelNotInClaim,
             this.checkNoBillIns,
             this.labelFee,
             this.labelCopayAmt,
             this.label4,
             this.groupClaimInfo,
             this.labelDedApplied,
             this.labelPaidOtherIns,
             this.labelInsPayEst,
             this.labelInsPayAmt,
             this.labelWriteOff,
             this.labelDateEntry
             //this.butRecalc
     });
     Lan.C("All", new System.Windows.Forms.Control[] {
         butOK,
         butCancel,
         butDelete,
     });
 }
		private void FormApptEdit_Load(object sender, System.EventArgs e){
			tbTime.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbTime_CellClicked);
			if(IsNew){
				if(!Security.IsAuthorized(Permissions.AppointmentCreate)){
					DialogResult=DialogResult.Cancel;
					return;
				}
			}
			else{
				if(!Security.IsAuthorized(Permissions.AppointmentEdit)){
					butOK.Enabled=false;
					butDelete.Enabled=false;
					butPin.Enabled=false;
					butTask.Enabled=false;
					gridProc.Enabled=false;
					listQuickAdd.Enabled=false;
					butAdd.Enabled=false;
					butDeleteProc.Enabled=false;
				}
			}
			//The four objects below are needed when adding procs to this appt.
			fam=Patients.GetFamily(AptCur.PatNum);
			pat=fam.GetPatient(AptCur.PatNum);
			SubList=InsSubs.RefreshForFam(fam);
			PlanList=InsPlans.RefreshForSubList(SubList);
			if(PrefC.GetBool(PrefName.EasyHideDentalSchools)) {
				butRequirement.Visible=false;
				textRequirement.Visible=false;
			}
			if(PrefC.GetBool(PrefName.ShowFeatureEhr)) {
				butSyndromicObservations.Visible=true;
				labelSyndromicObservations.Visible=true;
			}
			if(PrefC.GetBool(PrefName.EasyNoClinics)) {
				labelClinic.Visible=false;
				comboClinic.Visible=false;
			}
			if(PrefC.GetBool(PrefName.EasyHidePublicHealth)) {
				labelInsPlan1.Visible=false;
				textInsPlan1.Visible=false;
				butInsPlan1.Visible=false;
				labelInsPlan2.Visible=false;
				textInsPlan2.Visible=false;
				butInsPlan2.Visible=false;
			}
			if(!PinIsVisible){
				butPin.Visible=false;
			}
			if(AptCur.AptStatus==ApptStatus.Planned) {
				Text = Lan.g(this, "Edit Planned Appointment") + " - " + DS.Tables["Patient"].Rows[0]["value"].ToString(); 
				labelStatus.Visible=false;
				comboStatus.Visible=false;
				butDelete.Visible=false;
			}
			else if (AptCur.AptStatus == ApptStatus.PtNote) {
				labelApptNote.Text="Patient NOTE:";
				Text = Lan.g(this, "Edit Patient Note") + " - " + DS.Tables["Patient"].Rows[0]["value"].ToString() + " on " + AptCur.AptDateTime.DayOfWeek + ", " + AptCur.AptDateTime;
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Patient Note"));
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Completed Pt. Note"));
				comboStatus.SelectedIndex = (int)AptCur.AptStatus - 7;
				labelQuickAdd.Visible = false;
				labelStatus.Visible=false;
				gridProc.Visible=false;
				listQuickAdd.Visible=false;
				butAdd.Visible=false;
				butDeleteProc.Visible=false;
				//textNote.Width = 400;
			}
			else if ( AptCur.AptStatus == ApptStatus.PtNoteCompleted) {
				labelApptNote.Text = "Completed Patient NOTE:";
				Text = Lan.g(this, "Edit Completed Patient Note") + " - " + DS.Tables["Patient"].Rows[0]["value"].ToString() + " on " + AptCur.AptDateTime.DayOfWeek + ", " + AptCur.AptDateTime;
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Patient Note"));
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Completed Pt. Note"));
				comboStatus.SelectedIndex = (int)AptCur.AptStatus - 7;
				labelQuickAdd.Visible = false;
				labelStatus.Visible = false;
				gridProc.Visible= false;
				listQuickAdd.Visible = false;
				butAdd.Visible=false;
				butDeleteProc.Visible=false;
				//textNote.Width = 400;
			}
			else {
				Text = Lan.g(this, "Edit Appointment") + " - " + DS.Tables["Patient"].Rows[0]["value"].ToString() + " on " + AptCur.AptDateTime.DayOfWeek + ", " + AptCur.AptDateTime ;
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Scheduled"));
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Complete"));
				comboStatus.Items.Add(Lan.g("enumApptStatus", "UnschedList"));
				comboStatus.Items.Add(Lan.g("enumApptStatus", "ASAP"));
				comboStatus.Items.Add(Lan.g("enumApptStatus", "Broken"));
				comboStatus.SelectedIndex=(int)AptCur.AptStatus-1;
			}
			if(AptCur.AptStatus==ApptStatus.UnschedList) {
				if(Programs.UsingEcwTightOrFullMode()) {
					comboStatus.Enabled=true;
				}
				else if(HL7Defs.GetOneDeepEnabled()!=null && !HL7Defs.GetOneDeepEnabled().ShowAppts) {
					comboStatus.Enabled=true;
				}
				else {
					comboStatus.Enabled=false;
				}
			}
			//convert time pattern from 5 to current increment.
			strBTime=new StringBuilder();
			for(int i=0;i<AptCur.Pattern.Length;i++) {
				strBTime.Append(AptCur.Pattern.Substring(i,1));
				if(PrefC.GetLong(PrefName.AppointmentTimeIncrement)==10) {
					i++;
				}
				if(PrefC.GetLong(PrefName.AppointmentTimeIncrement)==15) {
					i++;
					i++;
				}
			}
			comboUnschedStatus.Items.Add(Lan.g(this,"none"));
			comboUnschedStatus.SelectedIndex=0;
			for(int i=0;i<DefC.Short[(int)DefCat.RecallUnschedStatus].Length;i++) {
				comboUnschedStatus.Items.Add(DefC.Short[(int)DefCat.RecallUnschedStatus][i].ItemName);
				if(DefC.Short[(int)DefCat.RecallUnschedStatus][i].DefNum==AptCur.UnschedStatus)
					comboUnschedStatus.SelectedIndex=i+1;
			}
			for(int i=0;i<DefC.Short[(int)DefCat.ApptConfirmed].Length;i++) {
				comboConfirmed.Items.Add(DefC.Short[(int)DefCat.ApptConfirmed][i].ItemName);
				if(DefC.Short[(int)DefCat.ApptConfirmed][i].DefNum==AptCur.Confirmed) {
					comboConfirmed.SelectedIndex=i;
				}
			}
			checkTimeLocked.Checked=AptCur.TimeLocked;
			textNote.Text=AptCur.Note;
			for(int i=0;i<DefC.Short[(int)DefCat.ApptProcsQuickAdd].Length;i++) {
				listQuickAdd.Items.Add(DefC.Short[(int)DefCat.ApptProcsQuickAdd][i].ItemName);
			}
			comboClinic.Items.Add(Lan.g(this,"none"));
			comboClinic.SelectedIndex=0;
			for(int i=0;i<Clinics.List.Length;i++) {
				comboClinic.Items.Add(Clinics.List[i].Description);
				if(Clinics.List[i].ClinicNum==AptCur.ClinicNum)
					comboClinic.SelectedIndex=i+1;
			}
			if(IsNew) {
				//Try to auto-select a provider when in Orion mode. Only for new appointments so we don't change historical data.
				AptCur.ProvNum=Providers.GetOrionProvNum(AptCur.ProvNum);
			}
			for(int i=0;i<ProviderC.ListShort.Count;i++) {
				comboProvNum.Items.Add(ProviderC.ListShort[i].Abbr);
				if(ProviderC.ListShort[i].ProvNum==AptCur.ProvNum)
					comboProvNum.SelectedIndex=i;
			}
			comboProvHyg.Items.Add(Lan.g(this,"none"));
			comboProvHyg.SelectedIndex=0;
			for(int i=0;i<ProviderC.ListShort.Count;i++) {
				comboProvHyg.Items.Add(ProviderC.ListShort[i].Abbr);
				if(ProviderC.ListShort[i].ProvNum==AptCur.ProvHyg)
					comboProvHyg.SelectedIndex=i+1;
			}
			checkIsHygiene.Checked=AptCur.IsHygiene;
			comboAssistant.Items.Add(Lan.g(this,"none"));
			comboAssistant.SelectedIndex=0;
			for(int i=0;i<Employees.ListShort.Length;i++) {
				comboAssistant.Items.Add(Employees.ListShort[i].FName);
				if(Employees.ListShort[i].EmployeeNum==AptCur.Assistant)
					comboAssistant.SelectedIndex=i+1;
			}
			textLabCase.Text=DS.Tables["Misc"].Rows[0]["labDescript"].ToString();
			textTimeArrived.ContextMenu=contextMenuTimeArrived;
			textTimeSeated.ContextMenu=contextMenuTimeSeated;
			textTimeDismissed.ContextMenu=contextMenuTimeDismissed;
			if(AptCur.DateTimeAskedToArrive.TimeOfDay>TimeSpan.FromHours(0)) {
				textTimeAskedToArrive.Text=AptCur.DateTimeAskedToArrive.ToShortTimeString();
			}
			if(AptCur.DateTimeArrived.TimeOfDay>TimeSpan.FromHours(0)){
				textTimeArrived.Text=AptCur.DateTimeArrived.ToShortTimeString();
			}
			if(AptCur.DateTimeSeated.TimeOfDay>TimeSpan.FromHours(0)){
				textTimeSeated.Text=AptCur.DateTimeSeated.ToShortTimeString();
			}
			if(AptCur.DateTimeDismissed.TimeOfDay>TimeSpan.FromHours(0)){
				textTimeDismissed.Text=AptCur.DateTimeDismissed.ToShortTimeString();
			}
			textInsPlan1.Text=InsPlans.GetCarrierName(AptCur.InsPlan1,PlanList);
			textInsPlan2.Text=InsPlans.GetCarrierName(AptCur.InsPlan2,PlanList);
			textRequirement.Text=DS.Tables["Misc"].Rows[0]["requirements"].ToString();
			//IsNewPatient is set well before opening this form.
			checkIsNewPatient.Checked=AptCur.IsNewPatient;
			butColor.BackColor=AptCur.ColorOverride;
			if(ApptDrawing.MinPerIncr==5) {
				tbTime.TopBorder[0,12]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,24]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,36]=System.Drawing.Color.Black;
			}
			else if(ApptDrawing.MinPerIncr==10) {
				tbTime.TopBorder[0,6]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,12]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,18]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,24]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,30]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,36]=System.Drawing.Color.Black;
			}
			else if(ApptDrawing.MinPerIncr==15){
				tbTime.TopBorder[0,4]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,8]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,12]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,16]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,20]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,24]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,28]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,32]=System.Drawing.Color.Black;
				tbTime.TopBorder[0,36]=System.Drawing.Color.Black;
			}
			if(Programs.UsingEcwTightOrFullMode()) {
				//These buttons are ONLY for eCW, not any other HL7 interface.
				butComplete.Visible=true;
				butPDF.Visible=true;
				//for eCW, we need to hide some things--------------------
				if(Bridges.ECW.AptNum==AptCur.AptNum) {
					butDelete.Visible=false;
				}
				butPin.Visible=false;
				butTask.Visible=false;
				butAddComm.Visible=false;
				if(HL7Msgs.MessageWasSent(AptCur.AptNum)) {
					butComplete.Text="Revise";
					//if(!Security.IsAuthorized(Permissions.Setup,true)) {
					//	butComplete.Enabled=false;
					//	butPDF.Enabled=false;
					//}
					butOK.Enabled=false;
					gridProc.Enabled=false;
					listQuickAdd.Enabled=false;
					butAdd.Enabled=false;
					butDeleteProc.Enabled=false;
				}
				else {//hl7 was not sent for this appt
					butComplete.Text="Finish && Send";
					if(Bridges.ECW.AptNum != AptCur.AptNum) {
						butComplete.Enabled=false;
					}
					butPDF.Enabled=false;
				}
			}
			else {
				butComplete.Visible=false;
				butPDF.Visible=false;
			}
			//Hide text message button sometimes
			if(pat.WirelessPhone=="" || !Programs.IsEnabled(ProgramName.CallFire)) {
				butText.Enabled=false;
			}
			else {//Pat has a wireless phone number and CallFire is enabled
				if(pat.TxtMsgOk==YN.Unknown) {
					butText.Enabled=!PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo);//Not enabled since TxtMsgOk is ?? and "Treat ?? As No" is true.
				}
				else {
					butText.Enabled=(pat.TxtMsgOk==YN.Yes);
				}
			}
			FillProcedures();
			SetProceduresForECW();
			FillPatient();//Must be after FillProcedures(), so that the initial amount for the appointment can be calculated.
			FillTime();
			FillComm();
			FillFields();
			textNote.Focus();
			textNote.SelectionStart = 0;
			#if DEBUG
				Text="AptNum"+AptCur.AptNum;
			#endif
			Plugins.HookAddCode(this,"FormApptEdit.Load_End",pat,butText);
		}
		private void FormProcGroup_Load(object sender, System.EventArgs e){
			IsOpen=true;
			IsStartingUp=true;
			//ProcList gets set in ContrChart where this form is created.
			PatCur=Patients.GetPat(GroupCur.PatNum);
			FamCur=Patients.GetFamily(GroupCur.PatNum);
			GroupOld=GroupCur.Copy();
			ProcListOld=new List<Procedure>();
			for(int i=0;i<ProcList.Count;i++){
				ProcListOld.Add(ProcList[i].Copy());
			}
			ModifyForOrionMode();
			textProcDate.Text=GroupCur.ProcDate.ToShortDateString();
			textDateEntry.Text=GroupCur.DateEntryC.ToShortDateString();
			textUser.Text=Userods.GetName(GroupCur.UserNum);//might be blank. Will change automatically if user changes note or alters sig.
			textNotes.Text=GroupCur.Note;
			if(GroupCur.ProcStatus==ProcStat.EC && PrefC.GetBool(PrefName.ProcLockingIsAllowed) && !GroupCur.IsLocked) {
				butLock.Visible=true;
			}
			else {
				butLock.Visible=false;
			}
			if(GroupCur.IsLocked) {//Whether locking is currently allowed, this proc group may have been locked previously.
				butOK.Enabled=false;
				butDelete.Enabled=false;
				labelLocked.Visible=true;
				butAppend.Visible=true;
				textNotes.ReadOnly=true;//just for visual cue.  No way to save changes, anyway.
				textNotes.BackColor=SystemColors.Control;
				butInvalidate.Visible=true;
				butInvalidate.Location=butLock.Location;
			}
			else {
				butInvalidate.Visible=false;
				//because islocked overrides security:
				if(!Security.IsAuthorized(Permissions.ProcComplEdit,GroupCur.DateEntryC)) {
					butOK.Enabled=false;
					butDelete.Enabled=false;
				}
			}
			if(GroupCur.ProcStatus==ProcStat.D) {//an invalidated proc
				labelInvalid.Visible=true;
				butInvalidate.Visible=false;
				labelLocked.Visible=false;
				butAppend.Visible=false;
				butOK.Enabled=false;
				butDelete.Enabled=false;
			}
			FillProcedures();
			textNotes.Select();
			string keyData=GetSignatureKey();
			signatureBoxWrapper.FillSignature(GroupCur.SigIsTopaz,keyData,GroupCur.Signature);
			signatureBoxWrapper.BringToFront();
			FillPatientData();
			FillPlanned();
			textNotes.Select(textNotes.Text.Length,0);
			IsStartingUp=false;
			//string retVal=GroupCur.Note+GroupCur.UserNum.ToString();
			//MsgBoxCopyPaste msgb=new MsgBoxCopyPaste(retVal);
			//msgb.ShowDialog();
		}
		///<summary>Inserts are not done within this dialog, but must be done ahead of time from outside.  You must specify a procedure to edit, and only the changes that are made in this dialog get saved.  Only used when double click in Account, Chart, TP, and in ContrChart.AddProcedure().  The procedure may be deleted if new, and user hits Cancel.</summary>
		public FormProcEdit(Procedure proc,Patient patCur,Family famCur){
			ProcCur=proc;
			ProcOld=proc.Copy();
			PatCur=patCur;
			FamCur=famCur;
			SubList=InsSubs.RefreshForFam(FamCur);
			PlanList=InsPlans.RefreshForSubList(SubList);
			//HistList=null;
			//LoopList=null;
			InitializeComponent();
			Lan.F(this);
			//allowTopaz=(Environment.OSVersion.Platform!=PlatformID.Unix && !CodeBase.ODEnvironment.Is64BitOperatingSystem());
			sigBox.SetTabletState(1);
			//if(!allowTopaz) {
			//	butTopazSign.Visible=false;
			//	sigBox.Visible=true;
			//}
			//else{
				//Add signature box for Topaz signatures.
				sigBoxTopaz=CodeBase.TopazWrapper.GetTopaz();
				sigBoxTopaz.Location=sigBox.Location;//this puts both boxes in the same spot.
				sigBoxTopaz.Name="sigBoxTopaz";
				sigBoxTopaz.Size=new System.Drawing.Size(362,79);
				sigBoxTopaz.TabIndex=92;
				sigBoxTopaz.Text="sigPlusNET1";
				sigBoxTopaz.Visible=false;
				Controls.Add(sigBoxTopaz);
				//It starts out accepting input. It will be set to 0 if a sig is already present.  It will be set back to 1 if note changes or if user clicks Clear.
				CodeBase.TopazWrapper.SetTopazState(sigBoxTopaz,1);
			//}
			if(!PrefC.GetBool(PrefName.ShowFeatureMedicalInsurance)) {
				tabControl.TabPages.Remove(tabPageMedical);
				//groupMedical.Visible=false;
			}
		}
Exemple #24
0
 ///<summary></summary>
 public static void ChangeGuarantorToCur(Family Fam,Patient Pat)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         Meth.GetVoid(MethodBase.GetCurrentMethod(),Fam,Pat);
         return;
     }
     //Move famfinurgnote to current patient:
     string command= "UPDATE patient SET "
         +"FamFinUrgNote = '"+POut.String(Fam.ListPats[0].FamFinUrgNote)+"' "
         +"WHERE PatNum = "+POut.Long(Pat.PatNum);
      			Db.NonQ(command);
     command= "UPDATE patient SET FamFinUrgNote = '' "
         +"WHERE PatNum = '"+Pat.Guarantor.ToString()+"'";
     Db.NonQ(command);
     //Move family financial note to current patient:
     command="SELECT FamFinancial FROM patientnote "
         +"WHERE PatNum = "+POut.Long(Pat.Guarantor);
     DataTable table=Db.GetTable(command);
     if(table.Rows.Count==1){
         command= "UPDATE patientnote SET "
             +"FamFinancial = '"+POut.String(table.Rows[0][0].ToString())+"' "
             +"WHERE PatNum = "+POut.Long(Pat.PatNum);
         Db.NonQ(command);
     }
     command= "UPDATE patientnote SET FamFinancial = '' "
         +"WHERE PatNum = "+POut.Long(Pat.Guarantor);
     Db.NonQ(command);
     //change guarantor of all family members:
     command= "UPDATE patient SET "
         +"Guarantor = "+POut.Long(Pat.PatNum)
         +" WHERE Guarantor = "+POut.Long(Pat.Guarantor);
     Db.NonQ(command);
 }
Exemple #25
0
 ///<summary></summary>
 public static void CombineGuarantors(Family Fam,Patient Pat)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
         Meth.GetVoid(MethodBase.GetCurrentMethod(),Fam,Pat);
         return;
     }
     //concat cur notes with guarantor notes
     string command=
         "UPDATE patient SET "
         //+"addrnote = '"+POut.PString(FamilyList[GuarIndex].FamAddrNote)
         //									+POut.PString(cur.FamAddrNote)+"', "
         +"famfinurgnote = '"+POut.String(Fam.ListPats[0].FamFinUrgNote)
         +POut.String(Pat.FamFinUrgNote)+"' "
         +"WHERE patnum = '"+Pat.Guarantor.ToString()+"'";
      			Db.NonQ(command);
     //delete cur notes
     command=
         "UPDATE patient SET "
         //+"famaddrnote = '', "
         +"famfinurgnote = '' "
         +"WHERE patnum = '"+Pat.PatNum+"'";
     Db.NonQ(command);
     //concat family financial notes
     PatientNote PatientNoteCur=PatientNotes.Refresh(Pat.PatNum,Pat.Guarantor);
     //patientnote table must have been refreshed for this to work.
     //Makes sure there are entries for patient and for guarantor.
     //Also, PatientNotes.cur.FamFinancial will now have the guar info in it.
     string strGuar=PatientNoteCur.FamFinancial;
     command=
         "SELECT famfinancial "
         +"FROM patientnote WHERE patnum ='"+POut.Long(Pat.PatNum)+"'";
     //MessageBox.Show(string command);
     DataTable table=Db.GetTable(command);
     string strCur=PIn.String(table.Rows[0][0].ToString());
     command=
         "UPDATE patientnote SET "
         +"famfinancial = '"+POut.String(strGuar+strCur)+"' "
         +"WHERE patnum = '"+Pat.Guarantor.ToString()+"'";
     Db.NonQ(command);
     //delete cur financial notes
     command=
         "UPDATE patientnote SET "
         +"famfinancial = ''"
         +"WHERE patnum = '"+Pat.PatNum.ToString()+"'";
     Db.NonQ(command);
 }
Exemple #26
0
 ///<summary></summary>
 public FormPatientEdit(Patient patCur,Family famCur)
 {
     InitializeComponent();// Required for Windows Form Designer support
     PatCur=patCur;
     FamCur=famCur;
     PatOld=patCur.Copy();
     listEmps=new ListBox();
     listEmps.Location=new Point(textEmployer.Left,textEmployer.Bottom);
     listEmps.Size=new Size(textEmployer.Width,100);
     listEmps.Visible=false;
     listEmps.Click += new System.EventHandler(listEmps_Click);
     listEmps.DoubleClick += new System.EventHandler(listEmps_DoubleClick);
     listEmps.MouseEnter += new System.EventHandler(listEmps_MouseEnter);
     listEmps.MouseLeave += new System.EventHandler(listEmps_MouseLeave);
     Controls.Add(listEmps);
     listEmps.BringToFront();
     listCounties=new ListBox();
     listCounties.Location=new Point(groupPH.Left+textCounty.Left
         ,groupPH.Top+textCounty.Bottom);
     listCounties.Size=new Size(textCounty.Width,100);
     listCounties.Visible=false;
     listCounties.Click += new System.EventHandler(listCounties_Click);
     //listCounties.DoubleClick += new System.EventHandler(listCars_DoubleClick);
     listCounties.MouseEnter += new System.EventHandler(listCounties_MouseEnter);
     listCounties.MouseLeave += new System.EventHandler(listCounties_MouseLeave);
     Controls.Add(listCounties);
     listCounties.BringToFront();
     listSites=new ListBox();
     listSites.Location=new Point(groupPH.Left+textSite.Left,groupPH.Top+textSite.Bottom);
     listSites.Size=new Size(textSite.Width,100);
     listSites.Visible=false;
     listSites.Click += new System.EventHandler(listSites_Click);
     listSites.MouseEnter += new System.EventHandler(listSites_MouseEnter);
     listSites.MouseLeave += new System.EventHandler(listSites_MouseLeave);
     Controls.Add(listSites);
     listSites.BringToFront();
     Lan.F(this);
     if(CultureInfo.CurrentCulture.Name.EndsWith("CA")) {//Canadian. en-CA or fr-CA
         labelSSN.Text="SIN";
         labelZip.Text="Postal Code";
         labelST.Text="Province";
         butEditZip.Text="Edit Postal Code";
         labelCanadianEligibilityCode.Visible=true;
         comboCanadianEligibilityCode.Visible=true;
         radioStudentN.Visible=false;
         radioStudentP.Visible=false;
         radioStudentF.Visible=false;
     }
     if(CultureInfo.CurrentCulture.Name.EndsWith("GB")){//en-GB
         //labelSSN.Text="?";
         labelZip.Text="Postcode";
         labelST.Text="";//no such thing as state in GB
         butEditZip.Text="Edit Postcode";
     }
 }
Exemple #27
0
		///<summary>Adds the xml for one statement. Validation is performed here. Throws an exception if there is a validation failure.</summary>
		public static void GenerateOneStatement(XmlWriter writer,Statement stmt,Patient pat,Family fam,DataSet dataSet){
			Patient guar=fam.ListPats[0];
			if(!Regex.IsMatch(guar.State,"^[A-Z]{2}$")) {
				throw new ApplicationException(Lan.g("EHG_Statements","Guarantor state must be two uppercase characters.")+" "+guar.FName+" "+guar.LName+" #"+guar.PatNum);
			}
			writer.WriteStartElement("EisStatement");
			writer.WriteAttributeString("OutputFormat","StmOut_Blue6Col");
			writer.WriteAttributeString("CreditCardChoice",PrefC.GetString(PrefName.BillingElectCreditCardChoices));
			writer.WriteStartElement("Patient");
			writer.WriteElementString("Name",guar.GetNameFLFormal());
			writer.WriteElementString("Account",guar.PatNum.ToString());
			writer.WriteElementString("Address1",guar.Address);
			writer.WriteElementString("Address2",guar.Address2);
			writer.WriteElementString("City",guar.City);
			writer.WriteElementString("State",guar.State);
			writer.WriteElementString("Zip",guar.Zip);
			string email="";
			Def billingDef=DefC.GetDef(DefCat.BillingTypes,guar.BillingType);
			if(billingDef.ItemValue=="E") {
				email=guar.Email;
			}
			writer.WriteElementString("EMail",email);
			//Account summary-----------------------------------------------------------------------
			writer.WriteStartElement("AccountSummary");
			if(stmt.DateRangeFrom.Year<1880) {//make up a statement date.
				writer.WriteElementString("PriorStatementDate",DateTime.Today.AddMonths(-1).ToString("MM/dd/yyyy"));
			}
			else {
				writer.WriteElementString("PriorStatementDate",stmt.DateRangeFrom.AddDays(-1).ToString("MM/dd/yyyy"));
			}
			DateTime dueDate;
			if(PrefC.GetLong(PrefName.StatementsCalcDueDate)==-1){
				dueDate=DateTime.Today.AddDays(10);
			}
			else{
				dueDate=DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
			}
			writer.WriteElementString("DueDate",dueDate.ToString("MM/dd/yyyy"));
			writer.WriteElementString("StatementDate",stmt.DateSent.ToString("MM/dd/yyyy"));
			double balanceForward=0;
			for(int r=0;r<dataSet.Tables["misc"].Rows.Count;r++){
				if(dataSet.Tables["misc"].Rows[r]["descript"].ToString()=="balanceForward"){
					balanceForward=PIn.Double(dataSet.Tables["misc"].Rows[r]["value"].ToString());
				}
			}
			writer.WriteElementString("PriorBalance",balanceForward.ToString("F2"));
			writer.WriteElementString("RunningBalance","");//for future use
			writer.WriteElementString("PerPayAdj","");//optional
			writer.WriteElementString("InsPayAdj","");//optional
			writer.WriteElementString("Adjustments","");//for future use
			writer.WriteElementString("NewCharges","");//optional
			writer.WriteElementString("FinanceCharges","");//for future use
			DataTable tableAccount=null;
			for(int i=0;i<dataSet.Tables.Count;i++) {
				if(dataSet.Tables[i].TableName.StartsWith("account")) {
					tableAccount=dataSet.Tables[i];
				}
			}
			double credits=0;
			for(int i=0;i<tableAccount.Rows.Count;i++) {
				credits+=PIn.Double(tableAccount.Rows[i]["creditsDouble"].ToString());
			}
			writer.WriteElementString("Credits",credits.ToString("F2"));
			//on a regular printed statement, the amount due at the top might be different from the balance at the middle right.
			//This is because of payment plan balances.
			//But in e-bills, there is only one amount due.
			//Insurance estimate is already subtracted, and payment plan balance is already added.
			double amountDue=guar.BalTotal;
			//add payplan due amt:
			for(int m=0;m<dataSet.Tables["misc"].Rows.Count;m++) {
				if(dataSet.Tables["misc"].Rows[m]["descript"].ToString()=="payPlanDue") {
					amountDue+=PIn.Double(dataSet.Tables["misc"].Rows[m]["value"].ToString());
				}
			}
			if(PrefC.GetBool(PrefName.BalancesDontSubtractIns)) {
				writer.WriteElementString("EstInsPayments","");//optional.
			}
			else {//this is typical
				writer.WriteElementString("EstInsPayments",guar.InsEst.ToString("F2"));//optional.
				amountDue-=guar.InsEst;
			}
			InstallmentPlan installPlan=InstallmentPlans.GetOneForFam(guar.PatNum);
			if(installPlan!=null){
				//show lesser of normal total balance or the monthly payment amount.
				if(installPlan.MonthlyPayment < amountDue) {
					amountDue=installPlan.MonthlyPayment;
				}
			}
			writer.WriteElementString("PatientShare",amountDue.ToString("F2"));
			writer.WriteElementString("CurrentBalance",amountDue.ToString("F2"));//this is ambiguous.  It seems to be AmountDue, but it could possibly be 0-30 days aging
			writer.WriteElementString("PastDue30",guar.Bal_31_60.ToString("F2"));//optional
			writer.WriteElementString("PastDue60",guar.Bal_61_90.ToString("F2"));//optional
			writer.WriteElementString("PastDue90",guar.BalOver90.ToString("F2"));//optional
			writer.WriteElementString("PastDue120","");//optional
			writer.WriteEndElement();//AccountSummary
			//Notes-----------------------------------------------------------------------------------
			writer.WriteStartElement("Notes");
			if(stmt.NoteBold!="") {
				writer.WriteStartElement("Note");
				writer.WriteAttributeString("FgColor","Red");//ColorToHexString(Color.DarkRed));
				//writer.WriteAttributeString("BgColor",ColorToHexString(Color.White));
				writer.WriteString(Tidy(stmt.NoteBold,500));//Limit of 500 char on notes.
				writer.WriteEndElement();//Note
			}
			if(stmt.Note!="") {
				writer.WriteStartElement("Note");
				//writer.WriteAttributeString("FgColor",ColorToHexString(Color.Black));
				//writer.WriteAttributeString("BgColor",ColorToHexString(Color.White));
				writer.WriteString(Tidy(stmt.Note,500));//Limit of 500 char on notes.
				writer.WriteEndElement();//Note
			}
			writer.WriteEndElement();//Notes
			//Detail items------------------------------------------------------------------------------
			writer.WriteStartElement("DetailItems");
			//string note;
			string descript;
			string fulldesc;
			string procCode;
			string tth;
			//string linedesc;
			string[] lineArray;
			List<string> lines;
			DateTime date;
			int seq=0;
			for(int i=0;i<tableAccount.Rows.Count;i++) {
				procCode=tableAccount.Rows[i]["ProcCode"].ToString();
				tth=tableAccount.Rows[i]["tth"].ToString();
				descript=tableAccount.Rows[i]["description"].ToString();
				fulldesc=procCode+" "+tth+" "+descript;//There are frequently CRs within a procedure description for things like ins est.
				lineArray=fulldesc.Split(new string[] { "\r\n" },StringSplitOptions.RemoveEmptyEntries);
				lines=new List<string>(lineArray);
				//The specs say that the line limit is 30 char.  But in testing, it will take 50 char.
				//We will use 40 char to be safe.
				if(lines[0].Length>40) {
					string newline=lines[0].Substring(40);
					lines[0]=lines[0].Substring(0,40);//first half
					lines.Insert(1,newline);//second half
				}
				for(int li=0;li<lines.Count;li++) {
					writer.WriteStartElement("DetailItem");//has a child item. We won't add optional child note
					writer.WriteAttributeString("sequence",seq.ToString());
					writer.WriteStartElement("Item");
					if(li==0) {
						date=(DateTime)tableAccount.Rows[i]["DateTime"];
						writer.WriteElementString("Date",date.ToString("MM/dd/yyyy"));
						writer.WriteElementString("PatientName",tableAccount.Rows[i]["patient"].ToString());
					}
					else {
						writer.WriteElementString("Date","");
						writer.WriteElementString("PatientName","");
					}
					writer.WriteStartElement("Description");
					writer.WriteCData(Tidy(lines[li],40));//Jessica at DentalXchange says limit is 120.  Docs say limit is 30. CData to allow any string.
					writer.WriteEndElement();//Description
					if(li==0) {
						writer.WriteElementString("Charges",tableAccount.Rows[i]["charges"].ToString());
						writer.WriteElementString("Credits",tableAccount.Rows[i]["credits"].ToString());
						writer.WriteElementString("Balance",tableAccount.Rows[i]["balance"].ToString());
					}
					else {
						writer.WriteElementString("Charges","");
						writer.WriteElementString("Credits","");
						writer.WriteElementString("Balance","");
					}
					writer.WriteEndElement();//Item
					writer.WriteEndElement();//DetailItem
					seq++;
				}
				/*The code below just didn't work because notes don't get displayed on the statement.
				linedesc=lines[0];
				note="";
				if(linedesc.Length>30) {
					note=linedesc.Substring(30);
					linedesc=linedesc.Substring(0,30);
				}
				for(int l=1;l<lines.Length;l++) {
					if(note!="") {
						note+="\r\n";
					}
					note+=lines[l];
				}
				
				if(note!="") {
					writer.WriteStartElement("Note");
					//we're not going to specify colors here since they're optional
					writer.WriteCData(note);
					writer.WriteEndElement();//Note
				}*/
			}
			writer.WriteEndElement();//DetailItems
			writer.WriteEndElement();//Patient
			writer.WriteEndElement();//EisStatement
		}
		///<summary></summary>
		private void RefreshModuleData(long patNum) {
			SelectTreeNode(null);//Clear selection and image and reset visibilities.
			if(patNum==0) {
				FamCur=null;
				return;
			}
			FamCur=Patients.GetFamily(patNum);
			PatCur=FamCur.GetPatient(patNum);
			PatFolder=ImageStore.GetPatientFolder(PatCur,ImageStore.GetPreferredAtoZpath());//This is where the pat folder gets created if it does not yet exist.
			ImageStore.AddMissingFilesToDatabase(PatCur);
		}
        ///<summary>Runs the required queries to populate the necessary StaticTextData fields corresponding to staticTextDependencies.</summary>
        private void LoadData(StaticTextFieldDependency staticTextDependencies, Patient pat, Family fam, List <long> listProcCodeNums)
        {
            bool isMiddleTier = (RemotingClient.RemotingRole == RemotingRole.ServerWeb);

            System.Diagnostics.Stopwatch timer = null;
            if (ODBuild.IsDebug())
            {
                timer = new System.Diagnostics.Stopwatch();
                timer.Start();
            }
            if (staticTextDependencies.HasFlag(StaticTextFieldDependency.Pat))
            {
                //patient should already be loaded.
            }
            if (fam == null && staticTextDependencies.HasFlag(StaticTextFieldDependency.Fam))
            {
                fam = Patients.GetFamily(pat.PatNum);
            }
            if (PatNote == null)
            {
                if (staticTextDependencies.HasFlag(StaticTextFieldDependency.PatNote))
                {
                    PatNote = PatientNotes.Refresh(pat.PatNum, pat.Guarantor);
                }
                else
                {
                    PatNote = new PatientNote();
                }
            }
            bool IsQueryNeeded <T>(ref List <T> list, StaticTextFieldDependency dependency)
            {
                if (list == null || (isMiddleTier && list.Count == 0))             //Middle Tier deserializes null lists to empty lists.
                {
                    if (staticTextDependencies.HasFlag(dependency))
                    {
                        return(true);
                    }
                    else
                    {
                        list = new List <T>();
                    }
                }
                return(false);
            }

            if (IsQueryNeeded(ref ListRefAttaches, StaticTextFieldDependency.ListRefAttaches))
            {
                ListRefAttaches = RefAttaches.Refresh(pat.PatNum);
            }
            if (IsQueryNeeded(ref ListInsSubs, StaticTextFieldDependency.ListInsSubs))
            {
                ListInsSubs = InsSubs.RefreshForFam(fam);
            }
            if (IsQueryNeeded(ref ListInsPlans, StaticTextFieldDependency.ListInsPlans))
            {
                ListInsPlans = InsPlans.RefreshForSubList(ListInsSubs);
            }
            if (IsQueryNeeded(ref ListPatPlans, StaticTextFieldDependency.ListPatPlans))
            {
                ListPatPlans = PatPlans.Refresh(pat.PatNum);
            }
            if (IsQueryNeeded(ref ListBenefits, StaticTextFieldDependency.ListBenefits))
            {
                ListBenefits = Benefits.Refresh(ListPatPlans, ListInsSubs);
            }
            if (IsQueryNeeded(ref HistList, StaticTextFieldDependency.HistList))
            {
                HistList = ClaimProcs.GetHistList(pat.PatNum, ListBenefits, ListPatPlans, ListInsPlans, DateTime.Today, ListInsSubs);
            }
            if (IsQueryNeeded(ref ListTreatPlans, StaticTextFieldDependency.ListTreatPlans))
            {
                ListTreatPlans = TreatPlans.Refresh(pat.PatNum);
            }
            if (IsQueryNeeded(ref ListRecallsForFam, StaticTextFieldDependency.ListRecallsForFam))
            {
                ListRecallsForFam = Recalls.GetList(fam.ListPats.Select(x => x.PatNum).ToList());
            }
            if (IsQueryNeeded(ref ListAppts, StaticTextFieldDependency.ListAppts))
            {
                ListAppts = Appointments.GetListForPat(pat.PatNum);
            }
            if (IsQueryNeeded(ref ListFutureApptsForFam, StaticTextFieldDependency.ListFutureApptsForFam))
            {
                ListFutureApptsForFam = Appointments.GetFutureSchedApts(fam.ListPats.Select(x => x.PatNum).ToList());
            }
            if (IsQueryNeeded(ref ListDiseases, StaticTextFieldDependency.ListDiseases))
            {
                ListDiseases = Diseases.Refresh(pat.PatNum, true);
            }
            if (IsQueryNeeded(ref ListAllergies, StaticTextFieldDependency.ListAllergies))
            {
                ListAllergies = Allergies.GetAll(pat.PatNum, false);
            }
            if (IsQueryNeeded(ref ListMedicationPats, StaticTextFieldDependency.ListMedicationPats))
            {
                ListMedicationPats = MedicationPats.Refresh(pat.PatNum, false);
            }
            if (IsQueryNeeded(ref ListFamPopups, StaticTextFieldDependency.ListFamPopups))
            {
                ListFamPopups = Popups.GetForFamily(pat);
            }
            if (IsQueryNeeded(ref ListProceduresSome, StaticTextFieldDependency.ListProceduresSome))
            {
                ListProceduresSome = Procedures.RefreshForProcCodeNums(pat.PatNum, listProcCodeNums);
            }
            if (IsQueryNeeded(ref ListProceduresPat, StaticTextFieldDependency.ListProceduresPat))
            {
                ListProceduresPat = Procedures.Refresh(pat.PatNum);
            }
            if (IsQueryNeeded(ref ListPlannedAppts, StaticTextFieldDependency.ListPlannedAppts))
            {
                ListPlannedAppts = new List <PlannedAppt>();
                PlannedAppt plannedAppt = PlannedAppts.GetOneOrderedByItemOrder(pat.PatNum);
                if (plannedAppt != null)
                {
                    ListPlannedAppts.Add(plannedAppt);
                }
            }
            if (ODBuild.IsDebug())
            {
                timer.Stop();
                Console.WriteLine("Static text field query time (ms): " + timer.ElapsedMilliseconds);
            }
        }
Exemple #30
0
		///<summary>Occurs every 4 seconds. Checks database for status changes.</summary>
		private void timer1_Tick(object sender,EventArgs e) {
			TerminalActive terminal;
			try{
				terminal=TerminalActives.GetTerminal(Environment.MachineName);
				labelConnection.Visible=false;
			}
			catch{//SocketException if db connection gets lost.
				labelConnection.Visible=true;
				return;
			}
			if(terminal==null){
				return;
			}
			if(terminal.TerminalStatus==TerminalStatus
				&& PatCur!=null
				&& terminal.PatNum==PatCur.PatNum)
			{
				return;
			}
			//someone changed the status or patient from the terminal manager.
			TerminalStatus=terminal.TerminalStatus;
			//set tab visibility
			tabMain.TabPages.Clear();
			if(TerminalStatus==TerminalStatusEnum.UpdateOnly){
				tabMain.TabPages.Add(this.tabPage1);
			}
			else if(TerminalStatus==TerminalStatusEnum.Standby) {
				//
			}
			else if(TerminalStatus==TerminalStatusEnum.PatientInfo) {
				tabMain.TabPages.Add(this.tabPage1);
			}
			else if(TerminalStatus==TerminalStatusEnum.Medical) {
				tabMain.TabPages.Add(this.tabPage2);
			}
			if(TerminalStatus==TerminalStatusEnum.Standby){//force move to standby (rare)
				textWelcome.Visible=true;
				tabMain.Visible=false;
				butClose.Visible=true;
				butSubmit.Visible=false;
				return;
			}
			//all the other three types show the tabMain
			textWelcome.Visible=false;
			tabMain.Visible=true;
			butClose.Visible=false;
			butSubmit.Visible=true;
			FamCur=Patients.GetFamily(terminal.PatNum);
			PatCur=FamCur.GetPatient(terminal.PatNum);
			FillForm();
			/*IsChangingTab=true;
			//this is very common.  This is the typical signal to load up a patient.
			if(TerminalStatus==TerminalStatusEnum.PatientInfo){
				tabMain.SelectedIndex=0;
			}
			//This is the typical signal to load up a patient who needs to change their existing info.
			else if(TerminalStatus==TerminalStatusEnum.UpdateOnly) {
				tabMain.SelectedIndex=0;
			}
			//receptionist forces move to medical tab. Rare.
			else if(TerminalStatus==TerminalStatusEnum.Medical) {
				tabMain.SelectedIndex=1;
			}
			//receptionist forces move to questions tab. Rare.
			//else if(TerminalStatus==TerminalStatusEnum.Questions) {
			//	tabMain.SelectedIndex=2;
			//}
			IsChangingTab=false;*/
		}
		///<summary></summary>
		public FormClaimEdit(Claim claimCur, Patient patCur,Family famCur){
			PatCur=patCur;
			FamCur=famCur;
			ClaimCur=claimCur;
			InitializeComponent();// Required for Windows Form Designer support
			//tbPay.CellDoubleClicked += new OpenDental.ContrTable.CellEventHandler(tbPay_CellDoubleClicked);
			//tbProc.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbProc_CellClicked);
			//tbPay.CellClicked += new OpenDental.ContrTable.CellEventHandler(tbPay_CellClicked);
			Lan.F(this);
			listAttachments.ContextMenu=contextMenuAttachments;
    }
 ///<summary>Gets the data necessary for Static Text Field string replacements.  Returns a StaticTextData object so that
 ///references are preserved across Middle Tier.</summary>
 public static StaticTextData GetStaticTextData(StaticTextFieldDependency staticTextDependencies, Patient pat, Family fam
                                                , List <long> listProcCodeNums, StaticTextData data = null)
 {
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         return(Meth.GetObject <StaticTextData>(MethodBase.GetCurrentMethod(), staticTextDependencies, pat, fam, listProcCodeNums, data));
     }
     data = data ?? new StaticTextData();
     data.LoadData(staticTextDependencies, pat, fam, listProcCodeNums);
     return(data);
 }
Exemple #33
0
        ///<summary>Returns the number of subscribers moved.</summary>
        public static long MoveSubscribers(long insPlanNumFrom, long insPlanNumTo)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), insPlanNumFrom, insPlanNumTo));
            }
            List <InsSub> listInsSubsFrom    = GetListForPlanNum(insPlanNumFrom);
            List <long>   listBlockedPatNums = new List <long>();

            //Perform the same validation as when the user manually drops insplans from FormInsPlan using the Drop button.
            for (int i = 0; i < listInsSubsFrom.Count; i++)
            {
                InsSub         insSubFrom      = listInsSubsFrom[i];
                List <PatPlan> listPatPlanFrom = PatPlans.Refresh(insSubFrom.Subscriber);
                for (int j = 0; j < listPatPlanFrom.Count; j++)
                {
                    PatPlan patPlanFrom = listPatPlanFrom[j];
                    //The following comments and logic are copied from the FormInsPlan Drop button...
                    //If they have a claim for this ins with today's date, don't let them drop.
                    //We already have code in place to delete claimprocs when we drop ins, but the claimprocs attached to claims are protected.
                    //The claim clearly needs to be deleted if they are dropping.  We need the user to delete the claim before they drop the plan.
                    //We also have code in place to add new claimprocs when they add the correct insurance.
                    List <Claim> listClaims = Claims.Refresh(patPlanFrom.PatNum);                 //Get all claims for patient.
                    for (int k = 0; k < listClaims.Count; k++)
                    {
                        if (listClaims[k].PlanNum != insPlanNumFrom)                       //Make sure the claim is for the insurance plan we are about to change, not any other plans the patient might have.
                        {
                            continue;
                        }
                        if (listClaims[k].DateService != DateTime.Today)                       //not today
                        {
                            continue;
                        }
                        //Patient currently has a claim for the insplan they are trying to drop.
                        if (!listBlockedPatNums.Contains(patPlanFrom.PatNum))
                        {
                            listBlockedPatNums.Add(patPlanFrom.PatNum);
                        }
                    }
                }
            }
            if (listBlockedPatNums.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < listBlockedPatNums.Count; i++)
                {
                    sb.Append("\r\n");
                    Patient pat = Patients.GetPat(listBlockedPatNums[i]);
                    sb.Append("#" + listBlockedPatNums[i] + " " + pat.GetNameFLFormal());
                }
                throw new ApplicationException(Lans.g("InsSubs", "Before changing the subscribers on the insurance plan being moved from, please delete all of today's claims related to the insurance plan being moved from for the following patients") + ":" + sb.ToString());
            }
            //This loop mimics some of the logic in PatPlans.Delete().
            int insSubMovedCount = 0;

            for (int i = 0; i < listInsSubsFrom.Count; i++)
            {
                InsSub inssub       = listInsSubsFrom[i];
                long   oldInsSubNum = inssub.InsSubNum;
                inssub.InsSubNum     = 0;          //This will allow us to insert a new record.
                inssub.PlanNum       = insPlanNumTo;
                inssub.DateEffective = DateTime.MinValue;
                inssub.BenefitNotes  = "";
                inssub.SubscNote     = "";
                //Security.CurUser.UserNum gets set on MT by the DtoProcessor so it matches the user from the client WS.
                inssub.SecUserNumEntry = Security.CurUser.UserNum;
                long      insSubNumNew       = InsSubs.Insert(inssub);
                string    command            = "SELECT PatNum FROM patplan WHERE InsSubNum=" + POut.Long(oldInsSubNum);
                DataTable tablePatsForInsSub = Db.GetTable(command);
                if (tablePatsForInsSub.Rows.Count == 0)
                {
                    continue;
                }
                insSubMovedCount++;
                for (int j = 0; j < tablePatsForInsSub.Rows.Count; j++)
                {
                    long           patNum       = PIn.Long(tablePatsForInsSub.Rows[j]["PatNum"].ToString());
                    List <PatPlan> listPatPlans = PatPlans.Refresh(patNum);
                    for (int k = 0; k < listPatPlans.Count; k++)
                    {
                        PatPlan patPlan = listPatPlans[k];
                        if (patPlan.InsSubNum == oldInsSubNum)
                        {
                            command = "DELETE FROM benefit WHERE PatPlanNum=" + POut.Long(patPlan.PatPlanNum);                         //Delete patient specific benefits (rare).
                            Db.NonQ(command);
                            patPlan.InsSubNum = insSubNumNew;
                            PatPlans.Update(patPlan);
                        }
                    }
                    //Now that the plan has changed for the current subscriber, recalculate estimates.
                    bool prefChanged = false;
                    //Forcefully set pref false to prevent creating new estimates for all procs (including completed, sent procs)
                    if (Prefs.UpdateBool(PrefName.ClaimProcsAllowedToBackdate, false))
                    {
                        prefChanged = true;                      //We will turn the preference back on for the user after we finish our computations.
                    }
                    Family           fam            = Patients.GetFamily(patNum);
                    Patient          pat            = fam.GetPatient(patNum);
                    List <ClaimProc> listClaimProcs = ClaimProcs.Refresh(patNum);
                    List <Procedure> listProcs      = Procedures.GetProcsByStatusForPat(patNum, ProcStat.TP, ProcStat.TPi);
                    listPatPlans = PatPlans.Refresh(patNum);
                    List <InsSub>  listInsSubs  = InsSubs.RefreshForFam(fam);
                    List <InsPlan> listInsPlans = InsPlans.RefreshForSubList(listInsSubs);
                    List <Benefit> listBenefits = Benefits.Refresh(listPatPlans, listInsSubs);
                    Procedures.ComputeEstimatesForAll(patNum, listClaimProcs, listProcs, listInsPlans, listPatPlans, listBenefits, pat.Age, listInsSubs);
                    if (prefChanged)
                    {
                        Prefs.UpdateBool(PrefName.ClaimProcsAllowedToBackdate, true);                       //set back to original value if changed.
                    }
                }
            }
            InsPlan insPlanFrom = InsPlans.RefreshOne(insPlanNumFrom);
            InsPlan planOld     = insPlanFrom.Copy();

            insPlanFrom.IsHidden = true;
            InsPlans.Update(insPlanFrom, planOld);
            return(insSubMovedCount);
        }