Пример #1
0
        private void UpdateActiveReferrals()
        {
            DateTime date = DateTime.Now.Date;

            ActiveCount             = Referrals.Where(x => x.Value.Active == true).ToList().Count;
            CurrentMonthActiveCount = Referrals.Where(x => x.Value.Active == true && x.Value.Date.Month == date.Month && x.Value.Date.Year == date.Year).ToList().Count;
            LastMonthActiveCount    = Referrals.Where(x => x.Value.Active == true && x.Value.Date.Month == date.AddMonths(-1).Month&& x.Value.Date.Year == date.AddMonths(-1).Year).ToList().Count;
        }
        public override global::System.Data.DataSet Clone()
        {
            Referrals cln = ((Referrals)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Пример #3
0
 public int AddReferrals(Referrals REFS)
 {
     using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext()))
     {
         unitOfWork.AdherenceReferralsRepository.Add(REFS);
         unitOfWork.Complete();
         unitOfWork.Dispose();
         return(REFS.Id);
     }
 }
Пример #4
0
 public int updateReferrals(Referrals PC)
 {
     using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext()))
     {
         unitOfWork.AdherenceReferralsRepository.Update(PC);
         result = unitOfWork.Complete();
         unitOfWork.Dispose();
         return(result);
     }
 }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            Referrals ds = new Referrals();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Пример #6
0
        public void UpdateReferral(ulong referralId, bool state)
        {
            if (!Referrals.ContainsKey(referralId))
            {
                return;
            }

            Referrals[referralId].Active = state;

            InviterList.Inviters[InviterId] = this;

            UpdateActiveReferrals();
        }
Пример #7
0
        public void RemoveReferral(ulong referralId)
        {
            if (!Referrals.ContainsKey(referralId))
            {
                return;
            }

            Referrals.Remove(referralId);

            InviterList.Inviters[InviterId] = this;

            UpdateActiveReferrals();
        }
Пример #8
0
        public void AddReferral(ulong referralId, bool state = true, DateTime?date = null)
        {
            if (Referrals.ContainsKey(referralId))
            {
                return;
            }

            Referrals.Add(referralId, new Referral(referralId, state: state, date: date));

            InviterList.Inviters[InviterId] = this;

            UpdateActiveReferrals();
        }
Пример #9
0
        public int updateReferrals(int patientId, int patientMasterVisitId, int createdBy, int patientReferred, int appointmentsAttended, string experience, int RefId)
        {
            Referrals refs = new Referrals()
            {
                PatientId            = patientId,
                PatientMasterVisitId = patientMasterVisitId,
                PatientReferred      = patientReferred,
                AppointmentsAttended = appointmentsAttended,
                Id = RefId
            };

            Result = _adherence.updateReferrals(refs);
            return(Result);
        }
Пример #10
0
        public int addReferrals(int patientId, int patientMasterVisitId, int createdBy, int patientReferred, int appointmentsAttended, string experience)
        {
            Referrals REFS = new Referrals()
            {
                PatientId            = patientId,
                PatientMasterVisitId = patientMasterVisitId,
                CreatedBy            = createdBy,
                PatientReferred      = patientReferred,
                AppointmentsAttended = appointmentsAttended,
                Experience           = experience
            };

            Result = _adherence.AddReferrals(REFS);
            return(Result);
        }
 public IActionResult SaveReferralData([FromBody] Referrals ReferralDetails)
 {
     try
     {
         if (objshareApplication.SaveReferralData(ReferralDetails, Con))
         {
             return(Ok(true));
         }
         else
         {
             return(StatusCode(StatusCodes.Status304NotModified));
         }
     }
     catch (Exception)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
Пример #12
0
        ///<summary></summary>
        public static Referral CreateReferral(long patNum, bool isDoctor = true)
        {
            Referral refNew = new Referral()
            {
                IsDoctor = isDoctor
            };

            Referrals.Insert(refNew);
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum        = refNew.ReferralNum;
            refattach.PatNum             = patNum;
            refattach.RefType            = ReferralType.RefFrom;
            refattach.RefDate            = DateTime.Today;
            refattach.IsTransitionOfCare = refNew.IsDoctor;
            refattach.ItemOrder          = 0;
            RefAttaches.Insert(refattach);
            return(refNew);
        }
        public Referrals getReferralDetails(string ConnectionString, string accountno, string Accounttype)
        {
            Referrals _Referraldata = new Referrals();

            try
            {
                using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, "SELECT referraldetailsid, accounttype, accountid, accountno, referralid,referralcode, contactid, referralname, employeeid, salespersonname,commsssionvalue, commsssiontype FROM tbltransreferraldetails where accountno ='" + accountno + "' and statusid =" + Convert.ToInt32(Status.Active) + " and accounttype='" + Accounttype + "';"))

                {
                    if (dr.Read())
                    {
                        _Referraldata = new Referrals()
                        {
                            preferaldetailsid = Convert.ToInt64(dr["referraldetailsid"]),
                            pAccountId        = Convert.ToInt64(dr["accountid"]),
                            paccounttype      = Convert.ToString(dr["accounttype"]),
                            paccountNo        = Convert.ToString(dr["accountno"]),
                            pReferralId       = Convert.ToInt64(dr["referralid"]),
                            pReferralCode     = Convert.ToString(dr["referralcode"]),
                            pContactId        = Convert.ToInt64(dr["contactid"]),
                            pReferralname     = Convert.ToString(dr["referralname"]),
                            pEmployeeidId     = Convert.ToInt64(dr["employeeid"]),
                            pSalesPersonName  = Convert.ToString(dr["salespersonname"]),
                            pCommisionValue   = Convert.ToDecimal(dr["commsssionvalue"]),
                            pCommissionType   = Convert.ToString(dr["commsssiontype"]),
                            pTypeofOperation  = Convert.ToString("UPDATE")
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(_Referraldata);
        }
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                Referrals ds = new Referrals();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "ReferralsDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Пример #15
0
        ///<summary></summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)
            {
                try {
                    ODFileUtils.ProcessStart(path);
                }
                catch {
                    MessageBox.Show(path + " is not available.");
                }
            }
            else
            {
                string cmdline = "OD14";
                if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
                {
                    cmdline += " " + pat.PatNum.ToString();
                }
                else
                {
                    cmdline += " " + Tidy(pat.ChartNumber);
                }

                if (pat.FName != "")
                {
                    cmdline += " " + Tidy(pat.FName);
                }
                else
                {
                    cmdline += " NA";
                }
                cmdline += " " + Tidy(pat.LName);
                if (pat.Birthdate.Year > 1880)
                {
                    cmdline += " " + pat.Birthdate.ToString("MM-dd-yyyy");
                }
                else
                {
                    cmdline += " NA";
                }
                //SSNs which are all zeros will be treated as blank.  Needed for eCW, since eCW sets SSN to 000-00-0000 if the patient does not have an SSN.
                if (pat.SSN.Replace("0", "").Trim() != "")
                {
                    //Otherwise, output raw SSN:
                    cmdline += " " + pat.SSN;
                }
                else
                {
                    cmdline += " NA";
                }
                if (pat.HmPhone != "")
                {
                    cmdline += " " + Tidy(pat.HmPhone);
                }
                else
                {
                    cmdline += " NA";
                }
                if (pat.WkPhone != "")
                {
                    cmdline += " " + Tidy(pat.WkPhone);
                }
                else
                {
                    cmdline += " NA";
                }
                Referral referral = Referrals.GetReferralForPat(pat.PatNum);
                if (referral != null && referral.IsDoctor)
                {
                    cmdline += " " + referral.ReferralNum.ToString();
                    if (referral.FName != "")
                    {
                        cmdline += " " + Tidy(referral.FName);
                    }
                    else
                    {
                        cmdline += " NA";
                    }
                    if (referral.LName != "")
                    {
                        cmdline += " " + Tidy(referral.LName);
                    }
                    else
                    {
                        cmdline += " NA";
                    }
                    if (referral.Address != "")
                    {
                        cmdline += " " + Tidy(referral.Address);
                    }
                    else
                    {
                        cmdline += " NA";
                    }
                    if (referral.City != "")
                    {
                        cmdline += " " + Tidy(referral.City);
                    }
                    else
                    {
                        cmdline += " NA";
                    }
                    if (referral.ST != "")
                    {
                        cmdline += " " + Tidy(referral.ST);
                    }
                    else
                    {
                        cmdline += " NA";
                    }
                    if (referral.Zip != "")
                    {
                        cmdline += " " + Tidy(referral.Zip);
                    }
                    else
                    {
                        cmdline += " NA";
                    }
                }
                else
                {
                    cmdline += " NA NA NA NA NA NA NA";
                }

                try {
                    ODFileUtils.ProcessStart(path, cmdline);
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Пример #16
0
        ///<summary>Contructs the ini file string.</summary>
        private static string GetIniString(Patient pat, Program programCur)
        {
            const string nl        = "\r\n";
            string       iniString = "[PATIENT]" + nl;

            if (ProgramProperties.GetPropVal(programCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                iniString += "PatID=" + pat.PatNum.ToString() + nl;
            }
            else
            {
                iniString += "PatID=" + pat.ChartNumber + nl;
            }
            iniString += "Title=" + pat.Title + nl;
            iniString += "FirstName=" + pat.FName + nl;
            iniString += "LastName=" + pat.LName + nl;
            iniString += "MiddleInitial=" + pat.MiddleI + nl;
            iniString += "NickName=" + pat.Preferred + nl;
            iniString += "Sex=" + Patients.ReplacePatient("[PatientGenderMF]", pat) + nl;
            iniString += "BirthDate=" + pat.Birthdate.ToShortDateString() + nl;
            iniString += "HomePhone=" + pat.HmPhone + nl;
            iniString += "WorkPhone=" + pat.WkPhone + nl;
            iniString += "WorkPhoneExt=" + nl;
            string ssn = "";

            //SSNs which are all zeros will be treated as blank.  Needed for eCW, since eCW sets SSN to 000-00-0000 if the patient does not have an SSN.
            if (pat.SSN.Replace("0", "").Trim() != "")
            {
                //Otherwise, output raw SSN:
                ssn = pat.SSN;
            }
            iniString += "SSN=" + ssn + nl;
            iniString += "ProviderName=" + Providers.GetFormalName(pat.PriProv) + nl;
            //The patient's guarantor
            Patient guar = Patients.GetPat(pat.Guarantor);

            iniString += "[ACCOUNT]" + nl;
            iniString += "AccountNO=" + (guar != null ? guar.PatNum.ToString() : "") + nl;
            iniString += "Title=" + (guar != null ? guar.Title : "") + nl;
            iniString += "FirstName=" + (guar != null ? guar.FName : "") + nl;
            iniString += "LastName=" + (guar != null ? guar.LName : "") + nl;
            iniString += "MiddleInitial=" + (guar != null ? guar.MiddleI : "") + nl;
            iniString += "Suffix=" + nl;
            iniString += "HomePhone=" + (guar != null ? guar.HmPhone : "") + nl;
            iniString += "WorkPhone=" + (guar != null ? guar.WkPhone : "") + nl;
            iniString += "WorkPhoneExt=" + nl;
            iniString += "Street=" + (guar != null ? guar.Address : "") + (guar != null && guar.Address2 != "" ? " " + guar.Address2 : "") + nl;
            iniString += "City=" + (guar != null ? guar.City : "") + nl;
            iniString += "State=" + (guar != null ? guar.State : "") + nl;
            iniString += "Zip=" + (guar != null ? guar.Zip : "") + nl;
            //The patient's most recent referral that is marked as 'IsDoctor'
            Referral patRefMostRecent = Referrals.GetIsDoctorReferralsForPat(pat.PatNum).LastOrDefault();

            iniString += "[REFERDR]" + nl;
            iniString += "RefdrID=" + (patRefMostRecent != null ? patRefMostRecent.ReferralNum.ToString() : "") + nl;
            iniString += "RefdrLastName=" + (patRefMostRecent != null ? patRefMostRecent.LName : "") + nl;
            iniString += "RefdrFirstName=" + (patRefMostRecent != null ? patRefMostRecent.FName : "") + nl;
            iniString += "RefdrMiddleInitial=" + (patRefMostRecent != null ? patRefMostRecent.MName : "") + nl;
            iniString += "RefdrNickName=" + nl;
            iniString += "RefdrStreet=" + (patRefMostRecent != null ? patRefMostRecent.Address : "") + nl;
            iniString += "RefdrStreet2=" + (patRefMostRecent != null ? patRefMostRecent.Address2 : "") + nl;
            iniString += "RefdrCity=" + (patRefMostRecent != null ? patRefMostRecent.City : "") + nl;
            iniString += "RefdrState=" + (patRefMostRecent != null ? patRefMostRecent.ST : "") + nl;
            iniString += "RefdrZip=" + (patRefMostRecent != null ? patRefMostRecent.Zip : "") + nl;
            iniString += "RefdrWorkPhone=" + (patRefMostRecent != null ? patRefMostRecent.Telephone : "") + nl;
            iniString += "RefdrFax=" + nl;
            return(iniString);
        }
Пример #17
0
        public static void FillPtInfo(OpenDental.ContrChart sender, Patient PatCur)
        {
            //first, get all the objects we need. Because they are by ref, the original gets altered.
            ODGrid     gridPtInfo         = (ODGrid)sender.Controls.Find("gridPtInfo", true)[0];
            TabControl tabControlImages   = (TabControl)sender.Controls.Find("tabControlImages", true)[0];
            TextBox    textTreatmentNotes = (TextBox)sender.Controls.Find("textTreatmentNotes", true)[0];
            //bool TreatmentNoteChanged=sender.TreatmentNoteChanged;//might have to do a by ref here?
            //Then get some data that we need
            Family         fam            = null;
            PatientNote    PatientNoteCur = null;
            List <PatPlan> PatPlanList    = null;
            List <InsSub>  SubList        = null;
            List <InsPlan> PlanList       = null;

            if (PatCur != null)
            {
                fam            = Patients.GetFamily(PatCur.PatNum);
                PatientNoteCur = PatientNotes.Refresh(PatCur.PatNum, PatCur.Guarantor);
                PatPlanList    = PatPlans.Refresh(PatCur.PatNum);
                SubList        = InsSubs.RefreshForFam(fam);
                PlanList       = InsPlans.RefreshForSubList(SubList);
            }
            //Then, continue with the slightly altered original method.
            gridPtInfo.Height       = tabControlImages.Top - gridPtInfo.Top;
            textTreatmentNotes.Text = "";
            if (PatCur != null)
            {
                textTreatmentNotes.Text    = PatientNoteCur.Treatment;
                textTreatmentNotes.Enabled = true;
                textTreatmentNotes.Select(textTreatmentNotes.Text.Length + 2, 1);
                textTreatmentNotes.ScrollToCaret();
                sender.TreatmentNoteChanged = false;
            }
            gridPtInfo.BeginUpdate();
            gridPtInfo.Columns.Clear();
            ODGridColumn col = new ODGridColumn("", 100);         //Lan.g("TableChartPtInfo",""),);

            gridPtInfo.Columns.Add(col);
            col = new ODGridColumn("", 300);
            gridPtInfo.Columns.Add(col);
            gridPtInfo.Rows.Clear();
            if (PatCur == null)
            {
                gridPtInfo.EndUpdate();
                return;
            }
            ODGridRow row;

            //Age
            row = new ODGridRow();
            row.Cells.Add("Age");
            row.Cells.Add(PatientLogic.DateToAgeString(PatCur.Birthdate));
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Credit type
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "ABC0"));
            row.Cells.Add(PatCur.CreditType);
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Billing type
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Billing Type"));
            row.Cells.Add(DefC.GetName(DefCat.BillingTypes, PatCur.BillingType));
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Referrals
            RefAttach[] RefAttachList = RefAttaches.Refresh(PatCur.PatNum);
            for (int i = 0; i < RefAttachList.Length; i++)
            {
                row            = new ODGridRow();
                row.ColorBackG = Color.Aquamarine;
                if (RefAttachList[i].IsFrom)
                {
                    row.Cells.Add("Referred From");
                }
                else
                {
                    row.Cells.Add("Referred To");
                }
                row.Cells.Add(Referrals.GetNameLF(RefAttachList[i].ReferralNum));
                row.Tag = null;
                gridPtInfo.Rows.Add(row);
            }
            //Date First Visit
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Date First Visit"));
            if (PatCur.DateFirstVisit.Year < 1880)
            {
                row.Cells.Add("??");
            }
            else if (PatCur.DateFirstVisit == DateTime.Today)
            {
                row.Cells.Add(Lan.g("TableChartPtInfo", "NEW PAT"));
            }
            else
            {
                row.Cells.Add(PatCur.DateFirstVisit.ToShortDateString());
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Prov - Pri & Sec
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Prov. (Pri, Sec)"));
            if (PatCur.SecProv != 0)
            {
                row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + Providers.GetAbbr(PatCur.SecProv));
            }
            else
            {
                row.Cells.Add(Providers.GetAbbr(PatCur.PriProv) + ", " + "None");
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //PriIns
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Pri Ins"));
            string name;

            if (PatPlanList.Count > 0)
            {
                name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 1), PlanList);
                if (PatPlanList[0].IsPending)
                {
                    name += Lan.g("TableChartPtInfo", " (pending)");
                }
                row.Cells.Add(name);
            }
            else
            {
                row.Cells.Add("");
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //SecIns
            row = new ODGridRow();
            row.Cells.Add(Lan.g("TableChartPtInfo", "Sec Ins"));
            if (PatPlanList.Count > 1)
            {
                name = InsPlans.GetCarrierName(PatPlans.GetPlanNum(PatPlanList, 2), PlanList);
                if (PatPlanList[1].IsPending)
                {
                    name += Lan.g("TableChartPtInfo", " (pending)");
                }
                row.Cells.Add(name);
            }
            else
            {
                row.Cells.Add("");
            }
            row.Tag = null;
            gridPtInfo.Rows.Add(row);
            //Registration keys-------------------------------------------------------------------------------------------
            if (PrefC.GetBool(PrefName.DistributorKey))
            {
                RegistrationKey[] keys = RegistrationKeys.GetForPatient(PatCur.PatNum);
                for (int i = 0; i < keys.Length; i++)
                {
                    row = new ODGridRow();
                    row.Cells.Add(Lan.g("TableChartPtInfo", "Registration Key"));
                    string str = keys[i].RegKey.Substring(0, 4) + "-" + keys[i].RegKey.Substring(4, 4) + "-" +
                                 keys[i].RegKey.Substring(8, 4) + "-" + keys[i].RegKey.Substring(12, 4);
                    if (keys[i].IsForeign)
                    {
                        str += "\r\nForeign";
                    }
                    else
                    {
                        str += "\r\nUSA";
                    }
                    str += "\r\nStarted: " + keys[i].DateStarted.ToShortDateString();
                    if (keys[i].DateDisabled.Year > 1880)
                    {
                        str += "\r\nDisabled: " + keys[i].DateDisabled.ToShortDateString();
                    }
                    if (keys[i].DateEnded.Year > 1880)
                    {
                        str += "\r\nEnded: " + keys[i].DateEnded.ToShortDateString();
                    }
                    if (keys[i].Note != "")
                    {
                        str += keys[i].Note;
                    }
                    row.Cells.Add(str);
                    row.Tag = keys[i].Copy();
                    gridPtInfo.Rows.Add(row);
                }
            }
            ODGridCell cell;
            //medical fields-----------------------------------------------------------------
            bool showMed = true;

            if (Programs.IsEnabled(ProgramName.eClinicalWorks) && ProgramProperties.GetPropVal(ProgramName.eClinicalWorks, "IsStandalone") == "0")
            {
                showMed = false;
            }
            if (showMed)
            {
                //premed flag.
                if (PatCur.Premed)
                {
                    row = new ODGridRow();
                    row.Cells.Add("");
                    cell           = new ODGridCell();
                    cell.Text      = Lan.g("TableChartPtInfo", "Premedicate");
                    cell.ColorText = Color.Red;
                    cell.Bold      = YN.Yes;
                    row.Cells.Add(cell);
                    row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
                //diseases
                Disease[] DiseaseList = Diseases.Refresh(PatCur.PatNum);
                row       = new ODGridRow();
                cell      = new ODGridCell(Lan.g("TableChartPtInfo", "Diseases"));
                cell.Bold = YN.Yes;
                row.Cells.Add(cell);
                if (DiseaseList.Length > 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Lan.g("TableChartPtInfo", "none"));
                }
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                for (int i = 0; i < DiseaseList.Length; i++)
                {
                    row            = new ODGridRow();
                    cell           = new ODGridCell(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum));
                    cell.ColorText = Color.Red;
                    cell.Bold      = YN.Yes;
                    row.Cells.Add(cell);
                    row.Cells.Add(DiseaseList[i].PatNote);
                    row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
                //MedUrgNote
                row = new ODGridRow();
                row.Cells.Add(Lan.g("TableChartPtInfo", "Med Urgent"));
                cell           = new ODGridCell();
                cell.Text      = PatCur.MedUrgNote;
                cell.ColorText = Color.Red;
                cell.Bold      = YN.Yes;
                row.Cells.Add(cell);
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //Medical
                row = new ODGridRow();
                row.Cells.Add(Lan.g("TableChartPtInfo", "Medical Summary"));
                row.Cells.Add(PatientNoteCur.Medical);
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //Service
                row = new ODGridRow();
                row.Cells.Add(Lan.g("TableChartPtInfo", "Service Notes"));
                row.Cells.Add(PatientNoteCur.Service);
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                //medications
                Medications.Refresh();
                MedicationPats.Refresh(PatCur.PatNum);
                row       = new ODGridRow();
                cell      = new ODGridCell(Lan.g("TableChartPtInfo", "Medications"));
                cell.Bold = YN.Yes;
                row.Cells.Add(cell);
                if (MedicationPats.List.Length > 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(Lan.g("TableChartPtInfo", "none"));
                }
                row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                row.Tag        = "med";
                gridPtInfo.Rows.Add(row);
                string     text;
                Medication med;
                for (int i = 0; i < MedicationPats.List.Length; i++)
                {
                    row  = new ODGridRow();
                    med  = Medications.GetMedication(MedicationPats.List[i].MedicationNum);
                    text = med.MedName;
                    if (med.MedicationNum != med.GenericNum)
                    {
                        text += "(" + Medications.GetMedication(med.GenericNum).MedName + ")";
                    }
                    row.Cells.Add(text);
                    text = MedicationPats.List[i].PatNote
                           + "(" + Medications.GetGeneric(MedicationPats.List[i].MedicationNum).Notes + ")";
                    row.Cells.Add(text);
                    row.ColorBackG = DefC.Long[(int)DefCat.MiscColors][3].ItemColor;
                    row.Tag        = "med";
                    gridPtInfo.Rows.Add(row);
                }
            }            //if !eCW.enabled
            gridPtInfo.EndUpdate();
        }
Пример #18
0
        ///<summary>Sends data for Patient.Cur to an export file and then launches an exe to notify PT.  If patient exists, this simply opens the patient.  If patient does not exist, then this triggers creation of the patient in PT Dental.  If isUpdate is true, then the export file and exe will have different names. In PT, update is a separate programlink with a separate button.</summary>
        public static void SendData(Program ProgramCur, Patient pat, bool isUpdate)
        {
            //ArrayList ForProgram=ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            //ProgramProperty PPCur=ProgramProperties.GetCur(ForProgram, "InfoFile path");
            //string infoFile=PPCur.PropertyValue;
            if (!Directory.Exists(dir))
            {
                MessageBox.Show(dir + " does not exist.  PT Dental doesn't seem to be properly installed on this computer.");
                return;
            }
            if (pat == null)
            {
                MessageBox.Show("No patient is selected.");
                return;
            }
            if (!File.Exists(dir + "\\" + exportAddExe))
            {
                MessageBox.Show(dir + "\\" + exportAddExe + " does not exist.  PT Dental doesn't seem to be properly installed on this computer.");
                return;
            }
            if (!File.Exists(dir + "\\" + exportUpdateExe))
            {
                MessageBox.Show(dir + "\\" + exportUpdateExe + " does not exist.  PT Dental doesn't seem to be properly installed on this computer.");
                return;
            }
            string filename = dir + "\\" + exportAddCsv;

            if (isUpdate)
            {
                filename = dir + "\\" + exportUpdateCsv;
            }
            using (StreamWriter sw = new StreamWriter(filename, false)){               //overwrites if it already exists.
                sw.WriteLine("PAT_PK,PAT_LOGFK,PAT_LANFK,PAT_TITLE,PAT_FNAME,PAT_MI,PAT_LNAME,PAT_CALLED,PAT_ADDR1,PAT_ADDR2,PAT_CITY,PAT_ST,PAT_ZIP,PAT_HPHN,PAT_WPHN,PAT_EXT,PAT_FAX,PAT_PAGER,PAT_CELL,PAT_EMAIL,PAT_SEX,PAT_EDOCS,PAT_STATUS,PAT_TYPE,PAT_BIRTH,PAT_SSN,PAT_NOCALL,PAT_NOCORR,PAT_DISRES,PAT_LSTUPD,PAT_INSNM,PAT_INSGPL,PAT_INSAD1,PAT_INSAD2,PAT_INSCIT,PAT_INSST,PAT_INSZIP,PAT_INSPHN,PAT_INSEXT,PAT_INSCON,PAT_INSGNO,PAT_EMPNM,PAT_EMPAD1,PAT_EMPAD2,PAT_EMPCIT,PAT_EMPST,PAT_EMPZIP,PAT_EMPPHN,PAT_REFLNM,PAT_REFFNM,PAT_REFMI,PAT_REFPHN,PAT_REFEML,PAT_REFSPE,PAT_NOTES,PAT_FPSCAN,PAT_PREMED,PAT_MEDS,PAT_FTSTUD,PAT_PTSTUD,PAT_COLLEG,PAT_CHRTNO,PAT_OTHID,PAT_RESPRT,PAT_POLHLD,PAT_CUSCD,PAT_PMPID");
                sw.Write(",");                                                         //PAT_PK  Primary key. Long alphanumeric. We do not use.
                sw.Write(",");                                                         //PAT_LOGFK Internal PT logical, it can be ignored.
                sw.Write(",");                                                         //PAT_LANFK Internal PT logical, it can be ignored.
                sw.Write(",");                                                         //PAT_TITLE We do not have this field yet
                sw.Write(Tidy(pat.FName) + ",");                                       //PAT_FNAME
                sw.Write(Tidy(pat.MiddleI) + ",");                                     //PAT_MI
                sw.Write(Tidy(pat.LName) + ",");                                       //PAT_LNAME
                sw.Write(Tidy(pat.Preferred) + ",");                                   //PAT_CALLED Nickname
                sw.Write(Tidy(pat.Address) + ",");                                     //PAT_ADDR1
                sw.Write(Tidy(pat.Address2) + ",");                                    //PAT_ADDR2
                sw.Write(Tidy(pat.City) + ",");                                        //PAT_CITY
                sw.Write(Tidy(pat.State) + ",");                                       //PAT_ST
                sw.Write(Tidy(pat.Zip) + ",");                                         //PAT_ZIP
                sw.Write(TelephoneNumbers.FormatNumbersOnly(pat.HmPhone) + ",");       //PAT_HPHN No punct
                sw.Write(TelephoneNumbers.FormatNumbersOnly(pat.WkPhone) + ",");       //PAT_WPHN
                sw.Write(",");                                                         //PAT_EXT
                sw.Write(",");                                                         //PAT_FAX
                sw.Write(",");                                                         //PAT_PAGER
                sw.Write(TelephoneNumbers.FormatNumbersOnly(pat.WirelessPhone) + ","); //PAT_CELL
                sw.Write(Tidy(pat.Email) + ",");                                       //PAT_EMAIL
                if (pat.Gender == PatientGender.Female)
                {
                    sw.Write("Female");
                }
                else if (pat.Gender == PatientGender.Male)
                {
                    sw.Write("Male");
                }
                sw.Write(",");                            //PAT_SEX might be blank if unknown
                sw.Write(",");                            //PAT_EDOCS Internal PT logical, it can be ignored.
                sw.Write(pat.PatStatus.ToString() + ","); //PAT_STATUS Any text allowed
                sw.Write(pat.Position.ToString() + ",");  //PAT_TYPE Any text allowed
                if (pat.Birthdate.Year > 1880)
                {
                    sw.Write(pat.Birthdate.ToString("MM/dd/yyyy"));                    //PAT_BIRTH MM/dd/yyyy
                }
                sw.Write(",");
                sw.Write(Tidy(pat.SSN) + ",");              //PAT_SSN No punct
                if (pat.PreferContactMethod == ContactMethod.DoNotCall ||
                    pat.PreferConfirmMethod == ContactMethod.DoNotCall ||
                    pat.PreferRecallMethod == ContactMethod.DoNotCall)
                {
                    sw.Write("1");
                }
                sw.Write(",");                //PAT_NOCALL T if no call
                sw.Write(",");                //PAT_NOCORR No correspondence HIPAA
                sw.Write(",");                //PAT_DISRES Internal PT logical, it can be ignored.
                sw.Write(",");                //PAT_LSTUPD Internal PT logical, it can be ignored.
                List <PatPlan> patPlanList = PatPlans.Refresh(pat.PatNum);
                Family         fam         = Patients.GetFamily(pat.PatNum);
                List <InsSub>  subList     = InsSubs.RefreshForFam(fam);
                List <InsPlan> planList    = InsPlans.RefreshForSubList(subList);
                PatPlan        patplan     = null;
                InsSub         sub         = null;
                InsPlan        plan        = null;
                Carrier        carrier     = null;
                Employer       emp         = null;
                if (patPlanList.Count > 0)
                {
                    patplan = patPlanList[0];
                    sub     = InsSubs.GetSub(patplan.InsSubNum, subList);
                    plan    = InsPlans.GetPlan(sub.PlanNum, planList);
                    carrier = Carriers.GetCarrier(plan.CarrierNum);
                    if (plan.EmployerNum != 0)
                    {
                        emp = Employers.GetEmployer(plan.EmployerNum);
                    }
                }
                if (plan == null)
                {
                    sw.Write(",");                    //PAT_INSNM
                    sw.Write(",");                    //PAT_INSGPL Ins group plan name
                    sw.Write(",");                    //PAT_INSAD1
                    sw.Write(",");                    //PAT_INSAD2
                    sw.Write(",");                    //PAT_INSCIT
                    sw.Write(",");                    //PAT_INSST
                    sw.Write(",");                    //PAT_INSZIP
                    sw.Write(",");                    //PAT_INSPHN
                }
                else
                {
                    sw.Write(Tidy(carrier.CarrierName) + ",");                         //PAT_INSNM
                    sw.Write(Tidy(plan.GroupName) + ",");                              //PAT_INSGPL Ins group plan name
                    sw.Write(Tidy(carrier.Address) + ",");                             //PAT_INSAD1
                    sw.Write(Tidy(carrier.Address2) + ",");                            //PAT_INSAD2
                    sw.Write(Tidy(carrier.City) + ",");                                //PAT_INSCIT
                    sw.Write(Tidy(carrier.State) + ",");                               //PAT_INSST
                    sw.Write(Tidy(carrier.Zip) + ",");                                 //PAT_INSZIP
                    sw.Write(TelephoneNumbers.FormatNumbersOnly(carrier.Phone) + ","); //PAT_INSPHN
                }
                sw.Write(",");                                                         //PAT_INSEXT
                sw.Write(",");                                                         //PAT_INSCON Ins contact person
                if (plan == null)
                {
                    sw.Write(",");
                }
                else
                {
                    sw.Write(Tidy(plan.GroupNum) + ",");                  //PAT_INSGNO Ins group number
                }
                if (emp == null)
                {
                    sw.Write(",");                    //PAT_EMPNM
                }
                else
                {
                    sw.Write(Tidy(emp.EmpName) + ","); //PAT_EMPNM
                }
                sw.Write(",");                         //PAT_EMPAD1
                sw.Write(",");                         //PAT_EMPAD2
                sw.Write(",");                         //PAT_EMPCIT
                sw.Write(",");                         //PAT_EMPST
                sw.Write(",");                         //PAT_EMPZIP
                sw.Write(",");                         //PAT_EMPPHN

                /*we don't support employer info yet.
                 * sw.Write(Tidy(emp.Address)+",");//PAT_EMPAD1
                 * sw.Write(Tidy(emp.Address2)+",");//PAT_EMPAD2
                 * sw.Write(Tidy(emp.City)+",");//PAT_EMPCIT
                 * sw.Write(Tidy(emp.State)+",");//PAT_EMPST
                 * sw.Write(Tidy(emp.State)+",");//PAT_EMPZIP
                 * sw.Write(TelephoneNumbers.FormatNumbersOnly(emp.Phone)+",");//PAT_EMPPHN*/
                Referral referral = Referrals.GetReferralForPat(pat.PatNum);              //could be null
                if (referral == null)
                {
                    sw.Write(",");                    //PAT_REFLNM
                    sw.Write(",");                    //PAT_REFFNM
                    sw.Write(",");                    //PAT_REFMI
                    sw.Write(",");                    //PAT_REFPHN
                    sw.Write(",");                    //PAT_REFEML Referral source email
                    sw.Write(",");                    //PAT_REFSPE Referral specialty. Customizable, so any allowed
                }
                else
                {
                    sw.Write(Tidy(referral.LName) + ",");                //PAT_REFLNM
                    sw.Write(Tidy(referral.FName) + ",");                //PAT_REFFNM
                    sw.Write(Tidy(referral.MName) + ",");                //PAT_REFMI
                    sw.Write(referral.Telephone + ",");                  //PAT_REFPHN
                    sw.Write(Tidy(referral.EMail) + ",");                //PAT_REFEML Referral source email
                    if (referral.PatNum == 0 && !referral.NotPerson)     //not a patient, and is a person
                    {
                        sw.Write(Defs.GetName(DefCat.ProviderSpecialties, referral.Specialty));
                    }
                    sw.Write(",");            //PAT_REFSPE Referral specialty. Customizable, so any allowed
                }
                sw.Write(",");                //PAT_NOTES No limits.  We won't use this right now for exports.
                //sw.Write(",");//PAT_NOTE1-PAT_NOTE10 skipped
                sw.Write(",");                //PAT_FPSCAN Internal PT logical, it can be ignored.
                if (pat.Premed)
                {
                    sw.Write("1");
                }
                else
                {
                    sw.Write("0");
                }
                sw.Write(",");                        //PAT_PREMED F or T
                sw.Write(Tidy(pat.MedUrgNote) + ","); //PAT_MEDS The meds that they must premedicate with.
                if (pat.StudentStatus == "F")         //fulltime
                {
                    sw.Write("1");
                }
                else
                {
                    sw.Write("0");
                }
                sw.Write(",");                //PAT_FTSTUD T/F
                if (pat.StudentStatus == "P") //parttime
                {
                    sw.Write("1");
                }
                else
                {
                    sw.Write("0");
                }
                sw.Write(",");                         //PAT_PTSTUD
                sw.Write(Tidy(pat.SchoolName) + ",");  //PAT_COLLEG Name of college
                sw.Write(Tidy(pat.ChartNumber) + ","); //PAT_CHRTNO
                sw.Write(pat.PatNum.ToString() + ","); //PAT_OTHID The primary key in Open Dental ************IMPORTANT***************
                if (pat.PatNum == pat.Guarantor)
                {
                    sw.Write("1");
                }
                else
                {
                    sw.Write("0");
                }
                sw.Write(",");                                    //PAT_RESPRT Responsible party checkbox T/F
                if (plan != null && pat.PatNum == sub.Subscriber) //if current patient is the subscriber on their primary plan
                {
                    sw.Write("1");
                }
                else
                {
                    sw.Write("0");
                }
                sw.Write(",");               //PAT_POLHLD Policy holder checkbox T/F
                sw.Write(",");               //PAT_CUSCD Web sync folder, used internally this can be ignored.
                sw.Write("");                //PAT_PMPID Practice Management Program ID. Can be ignored
                sw.WriteLine();
            }
            try{
                if (isUpdate)
                {
                    ODFileUtils.ProcessStart(dir + "\\" + exportUpdateExe);                //already validated to exist
                }
                else
                {
                    ODFileUtils.ProcessStart(dir + "\\" + exportAddExe);                //already validated to exist
                }
                //MessageBox.Show("done");
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
        public bool SaveReferralData(Referrals ReferralDetails, string ConnectionString)
        {
            bool IsSaved = false;

            try
            {
                con = new NpgsqlConnection(ConnectionString);
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                trans = con.BeginTransaction();
                StringBuilder SbsaveReferences = new StringBuilder();


                if (ReferralDetails.paccounttype == "share")
                {
                    SbsaveReferences.AppendLine("update Share_Account_creation set isreferralapplicable='" + ReferralDetails.pIsReferralsapplicable + "' where share_Account_number='" + ReferralDetails.paccountNo + "';");
                }
                else if (ReferralDetails.paccounttype == "RD Transaction")
                {
                    SbsaveReferences.AppendLine("update tbltransrdcreation set isreferralapplicable='" + ReferralDetails.pIsReferralsapplicable + "' where rdaccountid=" + ReferralDetails.pAccountId + " and rdaccountno='" + ReferralDetails.paccountNo + "';");
                }
                else if (ReferralDetails.paccounttype == "FD Transaction")
                {
                    SbsaveReferences.AppendLine("update tbltransfdcreation set isreferralapplicable='" + ReferralDetails.pIsReferralsapplicable + "' where fdaccountid=" + ReferralDetails.pAccountId + " and fdaccountno='" + ReferralDetails.paccountNo + "';");
                }
                else if (ReferralDetails.paccounttype == "Savings Transaction")
                {
                    SbsaveReferences.AppendLine("update tbltranssavingaccountcreation set isreferralapplicable='" + ReferralDetails.pIsReferralsapplicable + "' where savingaccountid=" + ReferralDetails.pAccountId + " and savingaccountno='" + ReferralDetails.paccountNo + "';");
                }

                if (ReferralDetails.pIsReferralsapplicable)
                {
                    if (Convert.ToString(ReferralDetails.pTypeofOperation) == "CREATE")
                    {
                        SbsaveReferences.AppendLine("INSERT INTO tbltransreferraldetails(accounttype,accountid, accountno, referralid, referralcode,contactid,referralname,employeeid,salespersonname, commsssionvalue, commsssiontype,statusid, createdby, createddate) VALUES (  '" + ReferralDetails.paccounttype + "'," + ReferralDetails.pAccountId + ", '" + ReferralDetails.paccountNo + "', '" + ReferralDetails.pReferralId + "','" + ReferralDetails.pReferralCode + "'," + ReferralDetails.pContactId + ", '" + ReferralDetails.pReferralname + "', '" + ReferralDetails.pEmployeeidId + "', '" + ReferralDetails.pSalesPersonName + "'," + ReferralDetails.pCommisionValue + ",'" + ReferralDetails.pCommissionType + "', " + Convert.ToInt32(Status.Active) + "," + ReferralDetails.pCreatedby + ", current_timestamp);");
                    }
                    else if (Convert.ToString(ReferralDetails.pTypeofOperation) == "UPDATE")
                    {
                        SbsaveReferences.AppendLine("Update tbltransreferraldetails set referralid='" + ReferralDetails.pReferralId + "',referralcode='" + ReferralDetails.pReferralCode + "',contactid=" + ReferralDetails.pContactId + ",referralname='" + ReferralDetails.pReferralname + "',employeeid='" + ReferralDetails.pEmployeeidId + "',salespersonname='" + ReferralDetails.pSalesPersonName + "',commsssionvalue=" + ReferralDetails.pCommisionValue + ",modifiedby=" + ReferralDetails.pCreatedby + ",modifieddate=current_timestamp where accountid=" + ReferralDetails.pAccountId + " and accountno='" + ReferralDetails.paccountNo + "';");
                    }
                }
                if (!string.IsNullOrEmpty(SbsaveReferences.ToString()))
                {
                    NPGSqlHelper.ExecuteNonQuery(trans, CommandType.Text, SbsaveReferences.ToString());
                    trans.Commit();
                    IsSaved = true;
                }
            }
            catch (Exception)
            {
                trans.Rollback();
                throw;
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Dispose();
                    con.Close();
                    con.ClearPool();
                    trans.Dispose();
                }
            }
            return(IsSaved);
        }