コード例 #1
0
ファイル: MiddleTierTests.cs プロジェクト: kjb7749/testImport
        public void MiddleTier_GetProcCodeWithDirtyProperty()
        {
            Def d;

            if (Defs.GetDefsForCategory(DefCat.ProcCodeCats, true).Count == 0)
            {
                d = new Def()
                {
                    Category = DefCat.ProcCodeCats, ItemName = WebServiceTests.DirtyString
                };
                d.DefNum = Defs.Insert(d);
            }
            else
            {
                d          = Defs.GetFirstForCategory(DefCat.ProcCodeCats, true);
                d.ItemName = WebServiceTests.DirtyString;
                Defs.Update(d);
            }
            Defs.RefreshCache();
            d = Defs.GetDef(DefCat.ProcCodeCats, d.DefNum);
            ProcedureCode pc = new ProcedureCode {
                IsNew = true, ProcCat = d.DefNum
            };
            ProcedureCode pc2 = new ProcedureCode {
                IsNew = true
            };
            List <ProcedureCode> listPcs   = new List <ProcedureCode>();
            List <string>        strErrors = new List <string>();

            try {
                listPcs = WebServiceTests.GetProcCodeWithDirtyProperty(pc, pc2);
            }
            catch (Exception ex) {
                strErrors.Add("Cannot serialize a property with a getter that does not retrieve the same value the setter is manipulating.");
                strErrors.Add(ex.Message);
                strErrors.Add(ex.StackTrace);
            }
            if (listPcs.Count > 0 && (listPcs[0].IsNew || listPcs[1].IsNew))
            {
                strErrors.Add(string.Format("One or more of the returned ProcedureCode objects IsNew flag should be {0} but returned {1}.", "false", "true"));
            }
            if (listPcs.Count > 0 && (listPcs[0].ProcCat != d.DefNum || listPcs[1].ProcCat != d.DefNum))
            {
                strErrors.Add("One or more of the ProcedureCode objects returned did not have the correct ProcCat.");
            }
            if (listPcs.Count > 0 && (listPcs[0].ProcCatDescript != d.ItemName || listPcs[1].ProcCatDescript != d.ItemName))
            {
                strErrors.Add("One or more of the ProcedureCode objects returned did not have the correct dirty string.");
            }
            Assert.IsTrue(strErrors.Count == 0);
        }
コード例 #2
0
        public void ProcedureCodes_GetProcCodesByTreatmentArea_HiddenCategories()
        {
            string suffix = MethodBase.GetCurrentMethod().Name;
            List <ProcedureCode> listMouthProcCodesOld = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth, TreatmentArea.None);
            Def defCat = Defs.GetDef(DefCat.ProcCodeCats, listMouthProcCodesOld.FirstOrDefault(x => x.ProcCat > 0 &&
                                                                                               !Defs.GetHidden(DefCat.ProcCodeCats, x.ProcCat)).ProcCat);

            defCat.IsHidden = true;
            Defs.Update(defCat);
            Defs.RefreshCache();
            //ProcedureCodes.RefreshCache();
            List <ProcedureCode> listMouthProcCodesNew = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth, TreatmentArea.None);

            defCat.IsHidden = false;
            Defs.Update(defCat);
            Defs.RefreshCache();
            Assert.AreNotEqual(listMouthProcCodesOld.Count, listMouthProcCodesNew.Count);
        }
コード例 #3
0
        ///<summary>Saves the image to A to Z in a new document if the program property to save images is set. Returns null if images are not set to be
        ///saved or if the image already exists.</summary>
        public static Document SaveApteryxImageToDoc(ApteryxImage img, Bitmap saveImage, Patient patCur)
        {
            if (ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.XVWeb), ProgramProps.SaveImages).Trim().ToLower() != "yes" ||
                Documents.DocExternalExists(img.Id.ToString(), ExternalSourceType.XVWeb))                   //if they want to save and it doesn't already exist in DB
            {
                return(null);
            }
            //store the image in the database
            string   imageCat = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.XVWeb), ProgramProps.ImageCategory);
            Document doc      = ImageStore.Import(saveImage, (Defs.GetDef(DefCat.ImageCats, PIn.Long(imageCat)).DefNum), ImageType.Photo, patCur);

            doc.ToothNumbers   = img.FormattedTeeth;
            doc.DateCreated    = img.AcquisitionDate;
            doc.Description    = doc.ToothNumbers;
            doc.ExternalGUID   = img.Id.ToString();
            doc.ExternalSource = ExternalSourceType.XVWeb;
            Documents.Update(doc);
            return(doc);
        }
コード例 #4
0
        private static void InstanceBridgeExport()
        {
            string dir     = Path.GetDirectoryName(_path);
            string extract = CodeBase.ODFileUtils.CombinePaths(dir, "extract.xml");

            CheckCreatedFile(extract);
            double linesProcessedCount = 0;
            string licenseKey          = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.DemandForce), "Enter your DemandForce license key (required)");
            string versionCur          = new Version(Application.ProductVersion).ToString();
            string extractDateTime     = DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffK");
            Dictionary <long, DateTime>            dateLastVisit  = Appointments.GetDateLastVisit();
            Dictionary <long, List <Appointment> > allPatApts     = Appointments.GetAptsForPats(DateTime.Now.ToUniversalTime(), DateTime.Now.AddDays(210).ToUniversalTime()); //appointments from todays date forward 210 days
            Dictionary <long, List <long> >        allAptProcNums = Appointments.GetCodeNumsAllApts();

            long[]             arrayPatNums = Patients.GetAllPatNums(false);
            Patient            patient;
            Appointment        apt;
            List <Appointment> listApts;
            List <long>        listProcNums;
            double             totalLines = CalculateTotalLinesOfCode(arrayPatNums, allAptProcNums, allPatApts);

            while (!_formProg.IsHandleCreated)
            {
            }                                                //Wait for the form to show the first time, or else the Invoke calls will cause an exception.
            _formProg.Invoke(new PassProgressDelegate(PassPercentProgressToDialog), new object[] { linesProcessedCount,
                                                                                                   Lan.g(_formProg, "Executing the bridge to DemandForce"),
                                                                                                   100.0, "" });
            Thread.Sleep(1000);            //Wait 1 second so the user can see the progress bar popup.
            try {
                StringBuilder     strb     = new StringBuilder();
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Encoding           = Encoding.UTF8;
                settings.Indent             = true;
                settings.IndentChars        = "   ";
                settings.NewLineChars       = "\r\n";
                settings.OmitXmlDeclaration = true;
                XmlWriter writer = XmlWriter.Create(strb, settings);
                writer.WriteRaw("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
                writer.WriteStartElement("DemandForce");
                writer.WriteAttributeString("licenseKey", licenseKey);
                writer.WriteAttributeString("scope", "full");
                writer.WriteStartElement("Business");
                writer.WriteStartElement("Extract");
                writer.WriteAttributeString("extractDateTime", extractDateTime);
                writer.WriteAttributeString("managementSystemName", "Open Dental");
                writer.WriteAttributeString("managementSystemVersion", versionCur);
                writer.WriteEndElement();                //Extract
                for (int i = 0; i < arrayPatNums.Length; i++)
                {
                    patient = Patients.GetPat(arrayPatNums[i]);
                    writer.WriteStartElement("Customer");
                    writer.WriteAttributeString("id", patient.PatNum.ToString());
                    if (patient.ChartNumber != "")
                    {
                        writer.WriteAttributeString("chartId", patient.ChartNumber);
                    }
                    if (dateLastVisit.ContainsKey(patient.PatNum))                     //Need input. Will it ever be null? Or will it check empty string?
                    {
                        writer.WriteAttributeString("lastVisit", dateLastVisit[patient.PatNum].ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffK"));
                    }
                    else
                    {
                        writer.WriteAttributeString("lastVisit", PIn.DateT("0001-01-01 00:00:00").ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffK"));
                    }
                    writer.WriteStartElement("Demographics");
                    if (patient.FName != "")
                    {
                        writer.WriteAttributeString("firstName", patient.FName);
                    }
                    else
                    {
                        writer.WriteAttributeString("firstName", "X");                       //need input on what to do with patients who don't have a FName.
                    }
                    writer.WriteAttributeString("lastName", patient.LName);
                    if (patient.Gender.ToString() == "Female")
                    {
                        writer.WriteAttributeString("gender", "Female");
                    }
                    else
                    {
                        writer.WriteAttributeString("gender", "Male");
                    }
                    if (patient.Birthdate.Year > 1880)
                    {
                        writer.WriteAttributeString("birthday", patient.Birthdate.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffK"));
                    }
                    if (patient.Address != "")
                    {
                        writer.WriteAttributeString("address1", patient.Address);
                    }
                    if (patient.City != "")
                    {
                        writer.WriteAttributeString("city", patient.City);
                    }
                    if (patient.State != "")
                    {
                        writer.WriteAttributeString("State", patient.State);
                    }
                    if (patient.Zip != "")
                    {
                        writer.WriteAttributeString("Zip", patient.Zip);
                    }
                    if (patient.Email != "")
                    {
                        writer.WriteAttributeString("Email", patient.Email);
                    }
                    writer.WriteEndElement();                    //Demographics
                    if (allPatApts.ContainsKey(patient.PatNum))
                    {
                        listApts = allPatApts[patient.PatNum];
                        for (int j = 0; j < listApts.Count; j++)
                        {
                            apt = listApts[j];
                            writer.WriteStartElement("Appointment");
                            writer.WriteAttributeString("id", apt.AptNum.ToString());
                            if (apt.AptStatus.ToString() == "Complete")
                            {
                                writer.WriteAttributeString("status", "1");
                            }
                            else
                            {
                                writer.WriteAttributeString("status", "3");
                            }
                            if (Defs.GetDef(DefCat.ApptConfirmed, apt.Confirmed).ItemName.ToLower() == "unconfirmed")
                            {
                                writer.WriteAttributeString("confirmed", "0");
                            }
                            else
                            {
                                writer.WriteAttributeString("confirmed", "1");
                            }
                            writer.WriteAttributeString("date", apt.AptDateTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffK"));
                            writer.WriteAttributeString("duration", (apt.Pattern.Length * 5).ToString());
                            if (allAptProcNums.ContainsKey(apt.AptNum))
                            {
                                listProcNums = allAptProcNums[apt.AptNum];
                                string codes = "";
                                for (int k = 0; k < listProcNums.Count; k++)
                                {
                                    codes += ProcedureCodes.GetStringProcCode(listProcNums[k]);
                                    if (k < listProcNums.Count - 1)
                                    {
                                        codes += ", ";
                                    }
                                    if (linesProcessedCount < totalLines)                                   //this avoids setting progress bar to max, which would close the dialog.
                                    {
                                        _formProg.Invoke(new PassProgressDelegate(PassPercentProgressToDialog), new object[] { (linesProcessedCount / totalLines * 100),
                                                                                                                               Lan.g(_formProg, "Creating export file: ?currentVal % of ?maxVal % completed"),
                                                                                                                               100.0, "" });
                                    }
                                    linesProcessedCount += 2;
                                }
                                if (codes != "")
                                {
                                    writer.WriteAttributeString("code", codes);
                                }
                            }
                            writer.WriteEndElement();                            //Appointment
                            if (linesProcessedCount < totalLines)                //this avoids setting progress bar to max, which would close the dialog.
                            {
                                _formProg.Invoke(new PassProgressDelegate(PassPercentProgressToDialog), new object[] { (linesProcessedCount / totalLines * 100),
                                                                                                                       Lan.g(_formProg, "Creating export file: ?currentVal % of ?maxVal % completed"),
                                                                                                                       100.0, "" });
                            }
                            linesProcessedCount += 12;
                        }
                    }
                    writer.WriteEndElement();                    //Customer
                    if (linesProcessedCount < totalLines)        //this avoids setting progress bar to max, which would close the dialog.
                    {
                        _formProg.Invoke(new PassProgressDelegate(PassPercentProgressToDialog), new object[] { (linesProcessedCount / totalLines * 100),
                                                                                                               Lan.g(_formProg, "Creating export file: ?currentVal % of ?maxVal % completed"),
                                                                                                               100.0, "" });
                    }
                    linesProcessedCount += 20;
                }
                writer.WriteEndElement();                //Business
                writer.WriteEndElement();                //DemandForce
                writer.Flush();
                writer.Close();
                ODFileUtils.WriteAllText(extract, strb.ToString());
            }
            catch {
                MessageBox.Show(Lan.g("DemandForce", "Export file creation failed") + ". " + Lan.g("DemandForce", "User may not have sufficient permissions") + ".");
            }
            if (linesProcessedCount >= totalLines)           //this avoids setting progress bar to max, which would close the dialog.
            {
                _formProg.DisplayText = "Creating export file: 100 % of 100 % completed";
            }
            Thread.Sleep(600);            //Wait a little bit so the user can see that it got to 100% complete.
            //force dialog to close even if no files copied or calculation was slightly off.
            _formProg.Invoke(new PassProgressDelegate(PassPercentProgressToDialog), new object[] { 0, "", 0, "" });
        }
コード例 #5
0
ファイル: POS_statements.cs プロジェクト: royedwards/DRDNet
        ///<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 = Defs.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("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();
                fulldesc  = procCode + " " + tth + " " + descript;
                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.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
        }