Example #1
0
 private void FormProcCodeNew_Load(object sender, EventArgs e)
 {
     ProcedureCodes.RefreshCache();
     listType.Items.Add(Lan.g(this, "none"));
     listType.Items.Add(Lan.g(this, "Exam"));
     listType.Items.Add(Lan.g(this, "Xray"));
     listType.Items.Add(Lan.g(this, "Prophy"));
     listType.Items.Add(Lan.g(this, "Fluoride"));
     listType.Items.Add(Lan.g(this, "Sealant"));
     listType.Items.Add(Lan.g(this, "Amalgam"));
     listType.Items.Add(Lan.g(this, "Composite, Anterior"));
     listType.Items.Add(Lan.g(this, "Composite, Posterior"));
     listType.Items.Add(Lan.g(this, "Buildup/Post"));
     listType.Items.Add(Lan.g(this, "Pulpotomy"));
     listType.Items.Add(Lan.g(this, "RCT"));
     listType.Items.Add(Lan.g(this, "SRP"));
     listType.Items.Add(Lan.g(this, "Denture"));
     listType.Items.Add(Lan.g(this, "RPD"));
     listType.Items.Add(Lan.g(this, "Denture Repair"));
     listType.Items.Add(Lan.g(this, "Reline"));
     listType.Items.Add(Lan.g(this, "Ceramic Inlay"));
     listType.Items.Add(Lan.g(this, "Metallic Inlay"));
     listType.Items.Add(Lan.g(this, "Whitening"));
     listType.Items.Add(Lan.g(this, "All-Ceramic Crown"));
     listType.Items.Add(Lan.g(this, "PFM Crown"));
     listType.Items.Add(Lan.g(this, "Full Gold Crown"));
     listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - Ceramic"));
     listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - PFM"));
     listType.Items.Add(Lan.g(this, "Bridge Pontic or Retainer - Metal"));
     listType.Items.Add(Lan.g(this, "Extraction"));
     listType.Items.Add(Lan.g(this, "Ortho"));
     listType.Items.Add(Lan.g(this, "Nitrous"));
     if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum))
     {
         labelListType.Visible  = false;
         listType.Visible       = false;
         labelTreatArea.Visible = false;
         comboTreatArea.Visible = false;
     }
     listType.SelectedIndex = 0;
     for (int i = 0; i < Enum.GetNames(typeof(ToothPaintingType)).Length; i++)
     {
         comboPaintType.Items.Add(Enum.GetNames(typeof(ToothPaintingType))[i]);
     }
     comboPaintType.SelectedIndex = (int)ToothPaintingType.None;
     for (int i = 1; i < Enum.GetNames(typeof(TreatmentArea)).Length; i++)
     {
         comboTreatArea.Items.Add(Lan.g(this, Enum.GetNames(typeof(TreatmentArea))[i]));
     }
     comboTreatArea.SelectedIndex = (int)TreatmentArea.Mouth - 1;
     _listProcCodeCatDefs         = Defs.GetDefsForCategory(DefCat.ProcCodeCats, true);
     for (int i = 0; i < _listProcCodeCatDefs.Count; i++)
     {
         comboCategory.Items.Add(_listProcCodeCatDefs[i].ItemName);
     }
     comboCategory.SelectedIndex = 0;
     textNewCode.Focus();
     textNewCode.Select(textNewCode.Text.Length, 1);
 }
Example #2
0
        ///<summary>Returns a code in format Z###, depending on which codes are already in use for the current patnum.
        ///The returned code is guaranteed to exist in the database, because codes are created if they do not exist.</summary>
        private string GetProcCodeForNewCharge(long patNumForRegKey)
        {
            //Locate a proc code for eRx which is not already in use.
            string procCode = "Z000";
            int    attempts = 0;
            bool   procCodeInUse;

            do
            {
                procCodeInUse = false;
                foreach (RepeatCharge repeatCharge in _listErxRepeatCharges)
                {
                    if (repeatCharge.PatNum != patNumForRegKey)
                    {
                        continue;
                    }
                    if (repeatCharge.ProcCode != procCode)
                    {
                        continue;
                    }
                    procCodeInUse = true;
                    break;
                }
                if (procCodeInUse)
                {
                    attempts++;                    //Should start at 2. The Codes will be "Z001", "Z002", "Z003", etc...
                    if (attempts > 999)
                    {
                        throw new Exception("Cannot add more than 999 Z-codes yet.  Ask programmer to increase.");
                    }
                    procCode = "Z" + (attempts.ToString().PadLeft(3, '0'));
                }
            } while(procCodeInUse);
            //If the selected code is not in the database already, then add it automatically.
            long codeNum = ProcedureCodes.GetCodeNum(procCode);

            if (codeNum == 0)           //The selected code does not exist, so we must add it.
            {
                ProcedureCode code = new ProcedureCode();
                code.ProcCode  = procCode;
                code.Descript  = "Electronic Rx";
                code.AbbrDesc  = "eRx";
                code.ProcTime  = "/X/";
                code.ProcCat   = 162;            //Software
                code.TreatArea = TreatmentArea.Mouth;
                ProcedureCodes.Insert(code);
                ProcedureCodes.RefreshCache();
            }
            return(procCode);
        }
Example #3
0
        ///<summary>Returns the code NewCrop or a code like NewCrop##, depending on which codes are already in use for the current patnum.
        ///The returned code is guaranteed to exist in the database, because codes are created if they do not exist.</summary>
        private string GetProcCodeForNewCharge(List <RepeatCharge> repeatChargesCur)
        {
            //Locate a proc code for NewCrop which is not already in use.
            string procCode = "NewCrop";
            int    attempts = 1;
            bool   procCodeInUse;

            do
            {
                procCodeInUse = false;
                for (int i = 0; i < repeatChargesCur.Count; i++)
                {
                    if (repeatChargesCur[i].ProcCode == procCode)
                    {
                        procCodeInUse = true;
                        break;
                    }
                }
                if (procCodeInUse)
                {
                    attempts++;                    //Should start at 2. The Codes will be "NewCrop", "NewCrop02", "NewCrop03", etc...
                    if (attempts > 99)
                    {
                        throw new Exception("Cannot add more than 99 NewCrop repeating charges yet. Ask programmer to increase.");
                    }
                    procCode = "NewCrop" + (attempts.ToString().PadLeft(2, '0'));
                }
            } while(procCodeInUse);
            //If the selected code is not in the database already, then add it automatically.
            long codeNum = ProcedureCodes.GetCodeNum(procCode);

            if (codeNum == 0)           //The selected code does not exist, so we must add it.
            {
                ProcedureCode code = new ProcedureCode();
                code.ProcCode  = procCode;
                code.Descript  = "NewCrop Rx";
                code.AbbrDesc  = "NewCrop";
                code.ProcTime  = "/X/";
                code.ProcCat   = 162;            //Software
                code.TreatArea = TreatmentArea.Mouth;
                ProcedureCodes.Insert(code);
                ProcedureCodes.RefreshCache();
            }
            return(procCode);
        }
Example #4
0
        private void butAnother_Click(object sender, EventArgs e)
        {
            string previous = textNewCode.Text;

            if (AddProc())
            {
                ProcedureCodes.RefreshCache();
                if (CultureInfo.CurrentCulture.Name == "en-US" && listType.SelectedIndex != 0)
                {
                    textNewCode.Text = "D";
                }
                else
                {
                    textNewCode.Text = "";
                }
                textCodePrevious.Text = previous;
            }
            textNewCode.Focus();
            textNewCode.Select(textNewCode.Text.Length, 1);
        }