Пример #1
0
 private void FillHeader()
 {
     Text = "Procedure Paid - Patient: " + _proc.ClaimPaid.PatientName;
     textProcAdjudicated.Text = _proc.ProcCodeAdjudicated;
     if (ProcedureCodes.IsValidCode(_proc.ProcCodeAdjudicated))
     {
         textProcAdjudicated.Text = _proc.ProcCodeAdjudicated + " - " + ProcedureCodes.GetProcCode(_proc.ProcCodeAdjudicated).AbbrDesc;
     }
     textProcSubmitted.Text = _proc.ProcCodeBilled;
     if (ProcedureCodes.IsValidCode(_proc.ProcCodeBilled))
     {
         textProcSubmitted.Text = _proc.ProcCodeBilled + " - " + ProcedureCodes.GetProcCode(_proc.ProcCodeBilled).AbbrDesc;
     }
     textDateService.Text = _proc.DateServiceStart.ToShortDateString();
     if (_proc.DateServiceEnd > _proc.DateServiceStart)
     {
         textDateService.Text += " to " + _proc.DateServiceEnd.ToShortDateString();
         textDateService.Width = 160;              //Increase width to accout for extra text.
     }
     textInsPaid.Text = _proc.InsPaid.ToString("f2");
     if (_proc.ProcNum == 0)
     {
         textProcNum.Text = "";
     }
     else
     {
         textProcNum.Text = _proc.ProcNum.ToString();
     }
     textProcFee.Text     = _proc.ProcFee.ToString("f2");
     textInsPaidCalc.Text = (_proc.ProcFee - _patRespSum - _contractualObligationSum - _payorInitiatedReductionSum - _otherAdjustmentSum).ToString("f2");
 }
Пример #2
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textRuleDesc.Text == "")
     {
         MsgBox.Show(this, "Description not allowed to be blank.");
         return;
     }
     if (!ProcedureCodes.IsValidCode(textCodeStart.Text) ||
         !ProcedureCodes.IsValidCode(textCodeEnd.Text))
     {
         MsgBox.Show(this, "Start and end codes must be valid procedure codes.");
         return;
     }
     ApptRuleCur.RuleDesc  = textRuleDesc.Text;
     ApptRuleCur.CodeStart = textCodeStart.Text;
     ApptRuleCur.CodeEnd   = textCodeEnd.Text;
     ApptRuleCur.IsEnabled = checkIsEnabled.Checked;
     if (IsNew)
     {
         AppointmentRules.Insert(ApptRuleCur);
     }
     else
     {
         AppointmentRules.Update(ApptRuleCur);
     }
     DialogResult = DialogResult.OK;
 }
Пример #3
0
        public static void ResetApptProcsQuickAdd()
        {
            string command = "DELETE FROM definition WHERE Category=3";

            General.NonQ(command);
            string[] array = new string[] {
                "CompEx-4BW-Pano-Pro-Flo", "D0150,D0274,D0330,D1110,D1204",
                "CompEx-2BW-Pano-ChPro-Flo", "D0150,D0272,D0330,D1120,D1203",
                "PerEx-4BW-Pro-Flo", "D0120,D0274,D1110,D1204",
                "LimEx-PA", "D0140,D0220",
                "PerEx-4BW-Pro-Flo", "D0120,D0274,D1110,D1204",
                "PerEx-2BW-ChildPro-Flo", "D0120,D0272,D1120,D1203",
                "Comp Exam", "D0150",
                "Per Exam", "D0120",
                "Lim Exam", "D0140",
                "1 PA", "D0220",
                "2BW", "D0272",
                "4BW", "D0274",
                "Pano", "D0330",
                "Pro Adult", "D1110",
                "Fluor Adult", "D1204",
                "Pro Child", "D1120",
                "Fuor Child", "D1203",
                "PostOp", "N4101",
                "DentAdj", "N4102",
                "Consult", "D9310"
            };
            Def def;

            string[] codelist;
            bool     allvalid;
            int      itemorder = 0;

            for (int i = 0; i < array.Length; i += 2)
            {
                //first, test all procedures for valid
                codelist = array[i + 1].Split(',');
                allvalid = true;
                for (int c = 0; c < codelist.Length; c++)
                {
                    if (!ProcedureCodes.IsValidCode(codelist[c]))
                    {
                        allvalid = false;
                    }
                }
                if (!allvalid)
                {
                    continue;
                }
                def           = new Def();
                def.Category  = DefCat.ApptProcsQuickAdd;
                def.ItemOrder = itemorder;
                def.ItemName  = array[i];
                def.ItemValue = array[i + 1];
                Defs.Insert(def);
                itemorder++;
            }
        }
Пример #4
0
 private void FillProcedureBreakdown()
 {
     if (_claimPaid.ListProcs.Count == 0)
     {
         gridProcedureBreakdown.Title = "EOB Procedure Breakdown (None Reported)";
     }
     else
     {
         gridProcedureBreakdown.Title = "EOB Procedure Breakdown";
     }
     gridProcedureBreakdown.BeginUpdate();
     gridProcedureBreakdown.ListGridColumns.Clear();
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("ProcNum", 80, HorizontalAlignment.Left));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("ProcCode", 80, HorizontalAlignment.Center));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("ProcDescript", 0, HorizontalAlignment.Left));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("FeeBilled", 70, HorizontalAlignment.Right));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("InsPaid", 70, HorizontalAlignment.Right));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("PatPort", 70, HorizontalAlignment.Right));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("Deduct", 70, HorizontalAlignment.Right));
     gridProcedureBreakdown.ListGridColumns.Add(new GridColumn("Writeoff", 70, HorizontalAlignment.Right));
     gridProcedureBreakdown.ListGridRows.Clear();
     _procAdjAmtSum = 0;
     for (int i = 0; i < _claimPaid.ListProcs.Count; i++)
     {
         //Logic mimics SheetUtil.getTable_EraClaimsPaid(...)
         Hx835_Proc proc = _claimPaid.ListProcs[i];
         GridRow    row  = new GridRow();
         row.Tag = proc;
         if (proc.ProcNum == 0)
         {
             row.Cells.Add(new GridCell(""));                    //ProcNum
         }
         else
         {
             row.Cells.Add(new GridCell(proc.ProcNum.ToString()));             //ProcNum
         }
         row.Cells.Add(new GridCell(proc.ProcCodeAdjudicated));                //ProcCode
         string procDescript = "";
         if (ProcedureCodes.IsValidCode(proc.ProcCodeAdjudicated))
         {
             ProcedureCode procCode = ProcedureCodes.GetProcCode(proc.ProcCodeAdjudicated);
             procDescript = procCode.AbbrDesc;
         }
         row.Cells.Add(new GridCell(procDescript));                          //ProcDescript
         row.Cells.Add(new GridCell(proc.ProcFee.ToString("f2")));           //FeeBilled
         row.Cells.Add(new GridCell(proc.InsPaid.ToString("f2")));           //InsPaid
         row.Cells.Add(new GridCell(proc.PatientPortionAmt.ToString("f2"))); //PatPort
         row.Cells.Add(new GridCell(proc.DeductibleAmt.ToString("f2")));     //Deduct
         row.Cells.Add(new GridCell(proc.WriteoffAmt.ToString("f2")));       //Writeoff
         gridProcedureBreakdown.ListGridRows.Add(row);
     }
     gridProcedureBreakdown.EndUpdate();
     textProcAdjAmtSum.Text = _procAdjAmtSum.ToString("f2");
 }
Пример #5
0
        ///<summary>Resets the descriptions for all ADA codes to the official wording.  Required by the license.</summary>
        public static void ResetADAdescriptions(List <ProcedureCode> codeList)
        {
            ProcedureCode code;

            for (int i = 0; i < codeList.Count; i++)
            {
                if (!ProcedureCodes.IsValidCode(codeList[i].ProcCode))
                {
                    continue;
                }
                code          = ProcedureCodes.GetProcCode(codeList[i].ProcCode);
                code.Descript = codeList[i].Descript;
                ProcedureCodes.Update(code);
            }
            //don't forget to refresh procedurecodes.
        }
Пример #6
0
        ///<summary>schedI is the currently displayed index of the fee schedule to save to.  Empty fees never even make it this far and should be skipped earlier in the process.</summary>
        public static void Import(string codeText, double amt, int schedI)
        {
            if (!ProcedureCodes.IsValidCode(codeText))
            {
                return;                //skip for now. Possibly insert a code in a future version.
            }
            Fee fee = GetFeeByOrder(ProcedureCodes.GetCodeNum(codeText), schedI);

            if (fee != null)
            {
                Delete(fee);
            }
            fee          = new Fee();
            fee.Amount   = amt;
            fee.FeeSched = DefB.Short[(int)DefCat.FeeSchedNames][schedI].DefNum;
            fee.CodeNum  = ProcedureCodes.GetCodeNum(codeText);
            Insert(fee);
        }
Пример #7
0
        private bool AddProc()
        {
            if (textNewCode.Text == "")
            {
                MsgBox.Show(this, "Code not allowed to be blank.");
                return(false);
            }
            if (ProcedureCodes.IsValidCode(textNewCode.Text))
            {
                MsgBox.Show(this, "That code already exists.");
                return(false);
            }
            if (textDescription.Text == "")
            {
                MsgBox.Show(this, "Description not allowed to be blank.");
                return(false);
            }
            if (textAbbreviation.Text == "")
            {
                MsgBox.Show(this, "Abbreviation not allowed to be blank.");
                return(false);
            }
            //ok to add code-----------------------------------------------------------------------------------
            ProcedureCode code = new ProcedureCode();

            code.ProcCode = textNewCode.Text;
            //code.ProcTime="/X/";//moved to contructor.
            //code.GraphicColor=Color.FromArgb(0);//moved to contructor.
            code.Descript  = textDescription.Text;
            code.AbbrDesc  = textAbbreviation.Text;
            code.SetRecall = checkSetRecall.Checked;
            code.NoBillIns = checkNoBillIns.Checked;
            code.IsHygiene = checkIsHygiene.Checked;
            code.IsProsth  = checkIsProsth.Checked;
            code.PaintType = (ToothPaintingType)comboPaintType.SelectedIndex;
            code.TreatArea = (TreatmentArea)comboTreatArea.SelectedIndex + 1;
            //if(comboCategory.SelectedIndex!=-1)
            code.ProcCat = DefB.Short[(int)DefCat.ProcCodeCats][comboCategory.SelectedIndex].DefNum;
            ProcedureCodes.Insert(code);
            Changed = true;
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Added Procedure Code: " + code.ProcCode);
            return(true);
        }
Пример #8
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescription.Text == "")
            {
                MsgBox.Show(this, "Description not allowed to be blank.");
                return;
            }
            AutoCur.Description = textDescription.Text;
            AutoCur.Autotrigger = (AutomationTrigger)comboTrigger.SelectedIndex; //should never be <0
            #region ProcCodes
            AutoCur.ProcCodes = "";                                              //set to correct proc code string below if necessary
            if (new[] { AutomationTrigger.CompleteProcedure, AutomationTrigger.ScheduleProcedure }.Contains(AutoCur.Autotrigger))
            {
                if (textProcCodes.Text.Contains(" "))
                {
                    MsgBox.Show(this, "Procedure codes cannot contain any spaces.");
                    return;
                }
                if (textProcCodes.Text == "")
                {
                    MsgBox.Show(this, "Please enter valid procedure code(s) first.");
                    return;
                }
                string strInvalidCodes = string.Join(", ", textProcCodes.Text.Split(',').Where(x => !ProcedureCodes.IsValidCode(x)));
                if (!string.IsNullOrEmpty(strInvalidCodes))
                {
                    MessageBox.Show(Lan.g(this, "The following procedure code(s) are not valid") + ": " + strInvalidCodes);
                    return;
                }
                AutoCur.ProcCodes = textProcCodes.Text;
            }
            #endregion ProcCodes
            #region Automation Action
            //Dictionary linking actions to their associated sheet types and the string to add to the message box text.
            //Only valid for actions PrintPatientLetter, PrintReferralLetter, ShowExamSheet, and ShowConsentForm.
            Dictionary <AutomationAction, Tuple <SheetTypeEnum, string> > dictAutoActionSheetType = new Dictionary <AutomationAction, Tuple <SheetTypeEnum, string> >()
            {
                { AutomationAction.PrintPatientLetter, Tuple.Create(SheetTypeEnum.PatientLetter, "a patient letter") },
                { AutomationAction.PrintReferralLetter, Tuple.Create(SheetTypeEnum.ReferralLetter, "a referral letter") },
                { AutomationAction.ShowExamSheet, Tuple.Create(SheetTypeEnum.ExamSheet, "an exam sheet") },
                { AutomationAction.ShowConsentForm, Tuple.Create(SheetTypeEnum.Consent, "a consent form") }
            };
            AutoCur.AutoAction         = _listAutoActions[comboAction.SelectedIndex];
            AutoCur.SheetDefNum        = 0;
            AutoCur.CommType           = 0;
            AutoCur.MessageContent     = "";
            AutoCur.AptStatus          = ApptStatus.None;
            AutoCur.AppointmentTypeNum = 0;
            switch (AutoCur.AutoAction)
            {
            case AutomationAction.CreateCommlog:
                if (comboActionObject.SelectedIndex == -1)
                {
                    MsgBox.Show(this, "A commlog type must be selected.");
                    return;
                }
                AutoCur.CommType       = _listCommLogTypeDefs[comboActionObject.SelectedIndex].DefNum;
                AutoCur.MessageContent = textMessage.Text;
                break;

            case AutomationAction.PopUp:
            case AutomationAction.PopUpThenDisable10Min:
                if (string.IsNullOrEmpty(textMessage.Text.Trim()))
                {
                    MsgBox.Show(this, "The message cannot be blank.");
                    return;
                }
                AutoCur.MessageContent = textMessage.Text;
                break;

            case AutomationAction.PrintPatientLetter:
            case AutomationAction.PrintReferralLetter:
            case AutomationAction.ShowExamSheet:
            case AutomationAction.ShowConsentForm:
                if (comboActionObject.SelectedIndex == -1)
                {
                    MsgBox.Show(this, "A sheet definition must be selected.");
                    return;
                }
                if (SheetDefs.GetDeepCopy()[comboActionObject.SelectedIndex].SheetType != dictAutoActionSheetType[AutoCur.AutoAction].Item1)
                {
                    MessageBox.Show(this, Lan.g(this, "The selected sheet type must be") + " " + dictAutoActionSheetType[AutoCur.AutoAction].Item2 + ".");
                    return;
                }
                AutoCur.SheetDefNum = SheetDefs.GetDeepCopy()[comboActionObject.SelectedIndex].SheetDefNum;
                break;

            case AutomationAction.SetApptStatus:
                if (comboActionObject.SelectedIndex == -1)
                {
                    MsgBox.Show(this, "An appointment status must be selected.");
                    return;
                }
                AutoCur.AptStatus = _listApptStatuses[comboActionObject.SelectedIndex];
                break;

            case AutomationAction.SetApptType:
                if (comboActionObject.SelectedIndex == -1)
                {
                    MsgBox.Show(this, "An appointment type must be selected.");
                    return;
                }
                AutoCur.AppointmentTypeNum = _listAptTypes[comboActionObject.SelectedIndex].AppointmentTypeNum;
                break;
            }
            #endregion Automation Action
            Automations.Update(AutoCur);            //Because always inserted before opening this form.
            DialogResult = DialogResult.OK;
        }
Пример #9
0
        ///<summary>Deletes all current autocodes and then adds the default autocodes.  Procedure codes must have already been entered or they cannot be added as an autocode.</summary>
        public static void SetToDefault()
        {
            string command = @"
				DELETE FROM autocode;
				DELETE FROM autocodecond;
				DELETE FROM autocodeitem"                ;

            General.NonQ(command);
            int autoCodeNum;
            int autoCodeItemNum;

            //Amalgam-------------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('Amalgam',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //1Surf
            if (ProcedureCodes.IsValidCode("D2140"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2140") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.One_Surf) + ")";
                General.NonQ(command);
            }
            //2Surf
            if (ProcedureCodes.IsValidCode("D2150"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2150") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Two_Surf) + ")";
                General.NonQ(command);
            }
            //3Surf
            if (ProcedureCodes.IsValidCode("D2160"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2160") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Three_Surf) + ")";
                General.NonQ(command);
            }
            //4Surf
            if (ProcedureCodes.IsValidCode("D2161"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2161") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Four_Surf) + ")";
                General.NonQ(command);
            }
            //5Surf
            if (ProcedureCodes.IsValidCode("D2161"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2161") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Five_Surf) + ")";
                General.NonQ(command);
            }
            //Composite-------------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('Composite',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //1SurfAnt
            if (ProcedureCodes.IsValidCode("D2330"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2330") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.One_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //2SurfAnt
            if (ProcedureCodes.IsValidCode("D2331"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2331") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Two_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //3SurfAnt
            if (ProcedureCodes.IsValidCode("D2332"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2332") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Three_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //4SurfAnt
            if (ProcedureCodes.IsValidCode("D2335"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2335") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Four_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //5SurfAnt
            if (ProcedureCodes.IsValidCode("D2335"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2335") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Five_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //Posterior Composite----------------------------------------------------------------------------------------------
            //1SurfPost
            if (ProcedureCodes.IsValidCode("D2391"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2391") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.One_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Posterior) + ")";
                General.NonQ(command);
            }
            //2SurfPost
            if (ProcedureCodes.IsValidCode("D2392"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2392") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Two_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Posterior) + ")";
                General.NonQ(command);
            }
            //3SurfPost
            if (ProcedureCodes.IsValidCode("D2393"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2393") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Three_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Posterior) + ")";
                General.NonQ(command);
            }
            //4SurfPost
            if (ProcedureCodes.IsValidCode("D2394"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2394") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Four_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Posterior) + ")";
                General.NonQ(command);
            }
            //5SurfPost
            if (ProcedureCodes.IsValidCode("D2394"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2394") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Five_Surf) + ")";
                General.NonQ(command);
                command = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                          + POut.PInt((int)AutoCondition.Posterior) + ")";
                General.NonQ(command);
            }
            //Root Canal-------------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('Root Canal',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //Ant
            if (ProcedureCodes.IsValidCode("D3310"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D3310") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //Premolar
            if (ProcedureCodes.IsValidCode("D3320"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D3320") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Premolar) + ")";
                General.NonQ(command);
            }
            //Molar
            if (ProcedureCodes.IsValidCode("D3330"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D3330") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Molar) + ")";
                General.NonQ(command);
            }
            //Bridge-------------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('Bridge',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //Pontic
            if (ProcedureCodes.IsValidCode("D6242"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D6242") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Pontic) + ")";
                General.NonQ(command);
            }
            //Retainer
            if (ProcedureCodes.IsValidCode("D6752"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D6752") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Retainer) + ")";
                General.NonQ(command);
            }
            //Denture-------------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('Denture',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //Max
            if (ProcedureCodes.IsValidCode("D5110"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D5110") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Maxillary) + ")";
                General.NonQ(command);
            }
            //Mand
            if (ProcedureCodes.IsValidCode("D5120"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D5120") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Mandibular) + ")";
                General.NonQ(command);
            }
            //BU/P&C-------------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('BU/P&C',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //BU
            if (ProcedureCodes.IsValidCode("D2950"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2950") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Posterior) + ")";
                General.NonQ(command);
            }
            //P&C
            if (ProcedureCodes.IsValidCode("D2954"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D2954") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //Root Canal Retreat--------------------------------------------------------------------------------------------------
            command     = "INSERT INTO autocode (Description,IsHidden,LessIntrusive) VALUES ('RCT Retreat',0,0)";
            autoCodeNum = General.NonQ(command, true);
            //Ant
            if (ProcedureCodes.IsValidCode("D3346"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D3346") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Anterior) + ")";
                General.NonQ(command);
            }
            //Premolar
            if (ProcedureCodes.IsValidCode("D3347"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D3347") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Premolar) + ")";
                General.NonQ(command);
            }
            //Molar
            if (ProcedureCodes.IsValidCode("D3348"))
            {
                command = "INSERT INTO autocodeitem (AutoCodeNum,CodeNum) VALUES (" + POut.PInt(autoCodeNum) + ","
                          + ProcedureCodes.GetCodeNum("D3348") + ")";
                autoCodeItemNum = General.NonQ(command, true);
                command         = "INSERT INTO autocodecond (AutoCodeItemNum,Cond) VALUES (" + POut.PInt(autoCodeItemNum) + ","
                                  + POut.PInt((int)AutoCondition.Molar) + ")";
                General.NonQ(command);
            }
        }
Пример #10
0
        private void butImportCanada_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, true, "If you want a clean slate, the current fee schedule should be cleared first.  When imported, any fees that are found in the text file will overwrite values of the current fee schedule showing in the main window.  Are you sure you want to continue?"))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            FormFeeSchedPickRemote formPick = new FormFeeSchedPickRemote();

            formPick.Url = @"http://www.opendental.com/feescanada/";          //points to index.php file
            if (formPick.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            Cursor = Cursors.WaitCursor;          //original wait cursor seems to go away for some reason.
            Application.DoEvents();
            string feeData = "";

            if (formPick.IsFileChosenProtected)
            {
                string memberNumberODA   = "";
                string memberPasswordODA = "";
                if (formPick.FileChosenName.StartsWith("ON_"))                 //Any and all Ontario fee schedules
                {
                    FormFeeSchedPickAuthOntario formAuth = new FormFeeSchedPickAuthOntario();
                    if (formAuth.ShowDialog() != DialogResult.OK)
                    {
                        Cursor = Cursors.Default;
                        return;
                    }
                    memberNumberODA   = formAuth.ODAMemberNumber;
                    memberPasswordODA = formAuth.ODAMemberPassword;
                }
                //prepare the xml document to send--------------------------------------------------------------------------------------
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent      = true;
                settings.IndentChars = ("    ");
                StringBuilder strbuild = new StringBuilder();
                using (XmlWriter writer = XmlWriter.Create(strbuild, settings)) {
                    writer.WriteStartElement("RequestFeeSched");
                    writer.WriteStartElement("RegistrationKey");
                    writer.WriteString(PrefC.GetString(PrefName.RegistrationKey));
                    writer.WriteEndElement();                    //RegistrationKey
                    writer.WriteStartElement("FeeSchedFileName");
                    writer.WriteString(formPick.FileChosenName);
                    writer.WriteEndElement();                    //FeeSchedFileName
                    if (memberNumberODA != "")
                    {
                        writer.WriteStartElement("ODAMemberNumber");
                        writer.WriteString(memberNumberODA);
                        writer.WriteEndElement();                        //ODAMemberNumber
                        writer.WriteStartElement("ODAMemberPassword");
                        writer.WriteString(memberPasswordODA);
                        writer.WriteEndElement();                //ODAMemberPassword
                    }
                    writer.WriteEndElement();                    //RequestFeeSched
                }
#if DEBUG
                OpenDental.localhost.Service1 updateService = new OpenDental.localhost.Service1();
#else
                OpenDental.customerUpdates.Service1 updateService = new OpenDental.customerUpdates.Service1();
                updateService.Url = PrefC.GetString(PrefName.UpdateServerAddress);
#endif
                //Send the message and get the result-------------------------------------------------------------------------------------
                string result = "";
                try {
                    result = updateService.RequestFeeSched(strbuild.ToString());
                }
                catch (Exception ex) {
                    Cursor = Cursors.Default;
                    MessageBox.Show("Error: " + ex.Message);
                    return;
                }
                Cursor = Cursors.Default;
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(result);
                //Process errors------------------------------------------------------------------------------------------------------------
                XmlNode node = doc.SelectSingleNode("//Error");
                if (node != null)
                {
                    MessageBox.Show(node.InnerText, "Error");
                    return;
                }
                node = doc.SelectSingleNode("//KeyDisabled");
                if (node == null)
                {
                    //no error, and no disabled message
                    if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, false))                    //this is one of three places in the program where this happens.
                    {
                        DataValid.SetInvalid(InvalidType.Prefs);
                    }
                }
                else
                {
                    MessageBox.Show(node.InnerText);
                    if (Prefs.UpdateBool(PrefName.RegistrationKeyIsDisabled, true))                    //this is one of three places in the program where this happens.
                    {
                        DataValid.SetInvalid(InvalidType.Prefs);
                    }
                    return;
                }
                //Process a valid return value------------------------------------------------------------------------------------------------
                node = doc.SelectSingleNode("//ResultCSV64");
                string feeData64    = node.InnerXml;
                byte[] feeDataBytes = Convert.FromBase64String(feeData64);
                feeData = Encoding.UTF8.GetString(feeDataBytes);
            }
            else
            {
                string    tempFile    = Path.GetTempFileName();
                WebClient myWebClient = new WebClient();
                try {
                    myWebClient.DownloadFile(formPick.FileChosenUrl, tempFile);
                }
                catch (Exception ex) {
                    MessageBox.Show(Lan.g(this, "Failed to download fee schedule file") + ": " + ex.Message);
                    Cursor = Cursors.Default;
                    return;
                }
                feeData = File.ReadAllText(tempFile);
                File.Delete(tempFile);
            }
            string[] feeLines = feeData.Split('\n');
            double   feeAmt;
            long     numImported = 0;
            long     numSkipped  = 0;
            for (int i = 0; i < feeLines.Length; i++)
            {
                string[] fields = feeLines[i].Split('\t');
                if (fields.Length > 1)               // && fields[1]!=""){//we no longer skip blank fees
                {
                    string procCode = fields[0];
                    if (ProcedureCodes.IsValidCode(procCode))                      //The Fees.Import() function will not import fees for codes that do not exist.
                    {
                        if (fields[1] == "")
                        {
                            feeAmt = -1;                          //triggers deletion of existing fee, but no insert.
                        }
                        else
                        {
                            feeAmt = PIn.Double(fields[1]);
                        }
                        Fees.Import(procCode, feeAmt, SchedNum);
                        numImported++;
                    }
                    else
                    {
                        numSkipped++;
                    }
                }
            }
            DataValid.SetInvalid(InvalidType.Fees);
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
            string outputMessage = Lan.g(this, "Done. Number imported") + ": " + numImported;
            if (numSkipped > 0)
            {
                outputMessage += " " + Lan.g(this, "Number skipped") + ": " + numSkipped;
            }
            MessageBox.Show(outputMessage);
        }
Пример #11
0
        private void butImportEcw_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            OpenFileDialog Dlg = new OpenFileDialog();

                        #if DEBUG
            Dlg.InitialDirectory = @"E:\My Documents\Bridge Info\eClinicalWorks\FeeSchedules";
                        #endif
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            if (!File.Exists(Dlg.FileName))
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "File not found");
                return;
            }
            string extension = Path.GetExtension(Dlg.FileName);
            if (extension != ".csv")
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Only .csv files may be imported.");
                return;
            }
            string[] lines = File.ReadAllLines(Dlg.FileName);
            if (lines.Length == 0 || (lines[0] != "Code,Description,Unit Fee,Allowed Fee,POS,TOS,Modifier,RequiresCliaID,GlobalBillingDays,ChargeCode" &&
                                      lines[0] != "\"Code\",\"Description\",\"UnitFee\",\"AllowedFee\",\"POS\",\"TOS\",\"Modifier\",\"RequiresCliaID\",\"GlobalBillingDays\",\"ChargeCode\""))
            {
                Cursor = Cursors.Default;
                MessageBox.Show("Unexpected file format. First line in file should be:\r\nCode,Description,Unit Fee,Allowed Fee,POS,TOS,Modifier,RequiresCliaID,GlobalBillingDays,ChargeCode\r\nor\r\n\"Code\",\"Description\",\"UnitFee\",\"AllowedFee\",\"POS\",\"TOS\",\"Modifier\",\"RequiresCliaID\",\"GlobalBillingDays\",\"ChargeCode\"");
                return;
            }
            string   feeSchedName = Path.GetFileNameWithoutExtension(Dlg.FileName);
            FeeSched feesched     = FeeScheds.GetByExactName(feeSchedName, FeeScheduleType.Normal);
            if (feesched == null)
            {
                feesched              = new FeeSched();
                feesched.Description  = feeSchedName;
                feesched.FeeSchedType = FeeScheduleType.Normal;
                feesched.ItemOrder    = FeeSchedC.ListLong[FeeSchedC.ListLong.Count - 1].ItemOrder + 1;
                feesched.IsHidden     = false;
                //feesched.IsNew=true;
                FeeScheds.Insert(feesched);
                DataValid.SetInvalid(InvalidType.FeeScheds);
            }
            else
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Fee schedule already exists and all the fees will be overwritten.  Continue?"))
                {
                    Cursor = Cursors.Default;
                    return;
                }
                Fees.ClearFeeSched(feesched.FeeSchedNum);
            }
            bool importAllowed = false;
            if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Import Allowed Fee column instead of Unit Fee column?"))
            {
                importAllowed = true;
            }
            int           imported         = 0;
            int           skippedCode      = 0;
            int           skippedMalformed = 0;
            string[]      fieldArray;
            List <string> fields;
            double        feeAmt       = 0;
            string        codeText     = "";
            bool          formatQuotes = false;
            if (lines.Length > 1)
            {
                if (lines[1].Substring(0, 1) == "\"")
                {
                    formatQuotes = true;
                }
            }
            if (formatQuotes)             //Original format - fields are surrounded by quotes (except first row, above)
            {
                for (int i = 1; i < lines.Length; i++)
                {
                    //fieldArray=lines[i].Split(new string[1] { "\"" },StringSplitOptions.RemoveEmptyEntries);//Removing emtpy entries will misalign the columns
                    fieldArray = lines[i].Split(new string[1] {
                        "\""
                    }, StringSplitOptions.None);                                //half the 'fields' will be commas.
                    fields = new List <string>();
                    for (int f = 1; f < fieldArray.Length - 1; f++)             //this loop skips the first and last elements because they are artifacts of the string splitting.
                    {
                        if (fieldArray[f] == ",")
                        {
                            continue;
                        }
                        fields.Add(fieldArray[f]);
                    }
                    if (fields.Count < 4)
                    {
                        skippedMalformed++;
                        continue;
                    }
                    if (importAllowed)
                    {
                        feeAmt = PIn.Double(fields[3]);
                    }
                    else
                    {
                        feeAmt = PIn.Double(fields[2]);
                    }
                    codeText = fields[0];
                    if (!ProcedureCodes.IsValidCode(codeText))
                    {
                        skippedCode++;
                        continue;
                    }
                    Fees.Import(fields[0], feeAmt, feesched.FeeSchedNum);
                    imported++;
                }
            }
            else              //New format - fields are delimited by commas only (no quotes)
            {
                for (int i = 1; i < lines.Length; i++)
                {
                    fieldArray = lines[i].Split(new string[1] {
                        ","
                    }, StringSplitOptions.None);
                    fields = new List <string>();
                    for (int f = 0; f < fieldArray.Length; f++)
                    {
                        fields.Add(fieldArray[f]);
                    }
                    if (fields.Count < 4)
                    {
                        skippedMalformed++;
                        continue;
                    }
                    if (fields.Count > 10)
                    {
                        MsgBox.Show(this, "Import aborted. Commas are not allowed in text fields. Check your descriptions for commas and try again.");
                        Cursor = Cursors.Default;
                        return;
                    }
                    if (importAllowed)
                    {
                        feeAmt = PIn.Double(fields[3]);
                    }
                    else
                    {
                        feeAmt = PIn.Double(fields[2]);
                    }
                    codeText = fields[0];
                    if (!ProcedureCodes.IsValidCode(codeText))
                    {
                        skippedCode++;
                        continue;
                    }
                    Fees.Import(fields[0], feeAmt, feesched.FeeSchedNum);
                    imported++;
                }
            }
            DataValid.SetInvalid(InvalidType.Fees);
            Cursor = Cursors.Default;
            string displayMsg = "Import complete.\r\nCodes imported: " + imported.ToString();
            if (skippedCode > 0)
            {
                displayMsg += "\r\nCodes skipped because not valid codes in Open Dental: " + skippedCode.ToString();
            }
            if (skippedMalformed > 0)
            {
                displayMsg += "\r\nCodes skipped because malformed line in text file: " + skippedMalformed.ToString();
            }
            MessageBox.Show(displayMsg);
            DialogResult = DialogResult.OK;
        }
Пример #12
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Description not allowed to be blank.");
         return;
     }
     if (comboTrigger.SelectedIndex == (int)AutomationTrigger.CompleteProcedure)
     {
         if (textProcCodes.Text.Contains(" "))
         {
             MsgBox.Show(this, "Procedure codes cannot contain any spaces.");
             return;
         }
         if (textProcCodes.Text == "")
         {
             MsgBox.Show(this, "Please enter valid procedure code(s) first.");
             return;
         }
         string[] arrayCodes = textProcCodes.Text.Split(',');
         for (int i = 0; i < arrayCodes.Length; i++)
         {
             if (!ProcedureCodes.IsValidCode(arrayCodes[i]))
             {
                 MessageBox.Show(arrayCodes[i] + Lan.g(this, " is not a valid procedure code."));
                 return;
             }
         }
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.CreateCommlog)
     {
         if (comboCommType.SelectedIndex == -1)
         {
             MsgBox.Show(this, "A CommType must be selected.");
             return;
         }
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.PopUp)
     {
         if (textMessage.Text.Trim() == string.Empty)
         {
             MsgBox.Show(this, "Message cannot be blank.");
             return;
         }
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.PrintPatientLetter)
     {
         if (comboSheetDef.SelectedIndex == -1)
         {
             MsgBox.Show(this, "A SheetDef must be selected.");
             return;
         }
         if (SheetDefC.Listt[comboSheetDef.SelectedIndex].SheetType != SheetTypeEnum.PatientLetter)
         {
             MsgBox.Show(this, "The selected sheet type must be a patient letter.");
             return;
         }
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.PrintReferralLetter)
     {
         if (comboSheetDef.SelectedIndex == -1)
         {
             MsgBox.Show(this, "A SheetDef must be selected.");
             return;
         }
         if (SheetDefC.Listt[comboSheetDef.SelectedIndex].SheetType != SheetTypeEnum.ReferralLetter)
         {
             MsgBox.Show(this, "The selected sheet type must be a referral letter.");
             return;
         }
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.ShowExamSheet)
     {
         if (comboSheetDef.SelectedIndex == -1)
         {
             MsgBox.Show(this, "A SheetDef must be selected.");
             return;
         }
         if (SheetDefC.Listt[comboSheetDef.SelectedIndex].SheetType != SheetTypeEnum.ExamSheet)
         {
             MsgBox.Show(this, "The selected sheet type must be an exam sheet.");
             return;
         }
     }
     AutoCur.Description = textDescription.Text;
     AutoCur.Autotrigger = (AutomationTrigger)comboTrigger.SelectedIndex;
     if (comboTrigger.SelectedIndex == (int)AutomationTrigger.CompleteProcedure)
     {
         AutoCur.ProcCodes = textProcCodes.Text;
     }
     else
     {
         AutoCur.ProcCodes = "";
     }
     AutoCur.AutoAction = (AutomationAction)comboAction.SelectedIndex;
     if (comboAction.SelectedIndex == (int)AutomationAction.PrintPatientLetter ||
         comboAction.SelectedIndex == (int)AutomationAction.PrintReferralLetter ||
         comboAction.SelectedIndex == (int)AutomationAction.ShowExamSheet)
     {
         AutoCur.SheetDefNum = SheetDefC.Listt[comboSheetDef.SelectedIndex].SheetDefNum;
     }
     else
     {
         AutoCur.SheetDefNum = 0;
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.CreateCommlog)
     {
         AutoCur.CommType       = DefC.Short[(int)DefCat.CommLogTypes][comboCommType.SelectedIndex].DefNum;
         AutoCur.MessageContent = textMessage.Text;
     }
     else
     {
         AutoCur.CommType       = 0;
         AutoCur.MessageContent = "";
     }
     if (comboAction.SelectedIndex == (int)AutomationAction.PopUp)
     {
         AutoCur.MessageContent = textMessage.Text;
     }                            //MessageContent was already set blank if not PopUp or Commlog above.
     Automations.Update(AutoCur); //Because always inserted before opening this form.
     DialogResult = DialogResult.OK;
 }
Пример #13
0
        /*//<summary>Used when a button is moved out of a category.  This leaves a 'hole' in the order, so we need to clean up the orders.  Remember to run Refresh before this.</summary>
         * public static void ResetOrder(int cat){
         *
         * }*/

        ///<summary>Deletes all current ProcButtons from the Chart module, and then adds the default ProcButtons.  Procedure codes must have already been entered or they cannot be added as a ProcButton.</summary>
        public static void SetToDefault()
        {
            string command = @"
				DELETE FROM procbutton;
				DELETE FROM procbuttonitem;
				DELETE FROM definition WHERE Category=26"                ;

            General.NonQ(command);
            int category;            //defNum
            int procButtonNum;
            int autoCodeNum;
            int autoCodeNum2;

            //General---------------------------------------------------------------------------------------------------------
            command = "INSERT INTO definition (Category,ItemOrder,ItemName,ItemValue,ItemColor,IsHidden) "
                      + "VALUES (26,0,'General','',0,0)";
            category = General.NonQ(command, true);
            //Amalgam
            autoCodeNum = AutoCodes.GetNumFromDescript("Amalgam");
            if (autoCodeNum != 0)
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('Amalgam',0,"
                          + POut.PInt(category) + @",'Qk12BgAAAAAAADYAAAAoAAAAFAAAABQAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA/////////////////////9bW1v+ctbX/vebv/8XW1v+tvbX/hKWt/36crf9+nKX/nLW1/97v7//m9/f/pdbe/5y9vf/3////////////////////////////////////ztbO/5y1rf+cxcX/hKWt/5S1vf+cvcX/nMXO/5S9zv+Mrb3/jK2t/629vf+cxc7/nL29//f///////////////////////////////////+9zs7/fpSM/5S1vf+cxc7/tdbe/87m5v/O5u//1u/v/8Xe5v+lxdb/jK21/4Slrf+cvbX/9////////////////////////////////////7XW1v+ErbX/rc7W/8Xm5v/F3ub/3u/v/9739//W7+//zubv/87m7/+11t7/jK21/5y9vf/////////////////////////////////39/f/nLW9/5zFzv/O5ub/3vf3/8Xe5v/m////7////+/////O5u//zu/v/9739/+11tb/lLW1/+/39////////////////////////////9bW5v9NXb3/VWbv/8XW9//v////vdbm/+b3///v////9////73e3v+UtbX/5vf3/7XF9/9ufr3/zt7m////////////////////////////xcXv/xws3v8THO//bn73/87e5v+MrbX/xd7m/+/////v////rc7W/4ylpf/e7///PU33/xwk5v+1ve////////////////////////////+1ve//HCze/xwk7/80Pe//doy9/5y9vf/O5ub/9/////f///+1ztb/nLW1/4yc9/8cJOb/EyTv/4SU7////////////////////////////5yl7/8kLOb/HCzv/xwk7/80Rc7/foze/5Sl7/+crff/nK33/36U5v9dbsX/PUXv/xwk5v8cJOb/XW7m///////////////////////m9/f/foTv/yQs5v8cLO//HCzm/xws7/8kLOb/JCzm/yQs5v8kLOb/JCzm/xws5v8cJOb/HCzm/xwk7/9FVdb/9////////////////////+/39/9dbt7/HCTm/xws5v8cLOb/HCzm/xws5v8cLOb/HCzm/xws5v8cLOb/HCzm/xws5v8cLOb/HCTv/0VVzv/3/////////////////////////1Vm1v8cJO//HCzm/xws5v8cJOb/HCTv/xwk5v8cJOb/HCTm/xwk5v8cJO//HCTm/xws5v8cJO//RVXO//f39//////////////////3////RVXO/xwk7/8cLOb/HCTm/yw05v8sNOb/ND3v/zQ97/80Pe//ND3v/yw05v8kLO//HCTm/xwk7/9FVc7/9/f3//////////////////f///9FVc7/HCTv/xwk5v8sNOb/jJzm/3aErf+1xff/xdb3/8XW//+ElL3/nLXe/4yc9/8kLOb/HCTv/0VVzv/39/f/////////////////9////0VVzv8THO//ND3v/7XF9//O5ub/lK2l/87e1v/3////9////5y1rf/W7+//9////4yU9/8cJO//RVXW//f/////////////////////////boTF/1Vm7//Fzv//9////97v9/+1ztb/xdbW//f////m9/f/rcXO/+b39//3////7////5Sl7/9NXbX/9/f3//////////////////////+91tb/nL3F//f////v////5vf3/87m5v/e7/f/7////+b39//W7+//7////+/////v////tc7O/629vf////////////////////////////////+lxcX/pcXF/+/////3////1u/v/9739//3////3u/3/97v9//3////7////7XO1v+lvcX/9/////////////////////////////////////f39/+lvcX/nL3F/+b39//3////7////+/////m////7////97v7/+txcX/pb3F//f39/////////////////////////////////////////////f39/+txcX/lLW1/629vf/O3t7/3vf3/8Xe3v+lxcX/jKWc/7XFxf/39/f//////////////////////w==')";
                procButtonNum = General.NonQ(command, true);
                command       = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                                + POut.PInt(autoCodeNum) + ")";
                General.NonQ(command);
            }
            //Composite
            autoCodeNum = AutoCodes.GetNumFromDescript("Composite");
            if (autoCodeNum != 0)
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('Composite',1,"
                          + POut.PInt(category) + @",'Qk12BgAAAAAAADYAAAAoAAAAFAAAABQAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA///////////e5v//RU3m/yQ05v8kNOb/JDTm/xwk7/8cJO//JCzm/36UnP9+lJT/fpSc/3aUlP9+lIz/xc7O/////////////////////////////////3Z+9/8kLOb/Znbv/3aE7/+ElO//fpTv/zQ97/8kLOb/rcXm/73e3v+11t7/tdbe/5zFzv+EpaX/1t7e////////////////////////////LDTv/11u5v/e7/f/5vf//+/////3////pbX//yQs7//e7///7////+b39//e7/f/zubv/5S1vf+tvbX///////////////////////////80Pff/XW7m/+b////3////7/////f///+1xf//JCzv/+b3///3////7////+b39//W7+//nL3F/629vf///////////////////////////z1F9/9dbu//7/f//+/////v////9////4yc//89Rff/5vf//+/////v////7////9bv7/+cvcX/rb29////////////////////////////ND3v/3aE7//3////7////+/////v////XWb3/36M9//3////7////+/////v////1u/3/5S1vf+9zs7///////////////////////////8sNO//doTv//f////v////7////+////80Pe//pbX///f////v////7////+/////e7/f/jK2t/9be3v///////////////////////////yw07/9ufu//7////+/////v////3u///zQ97/+9zv//9////+/////v////7////87m7/9+lIz/3u/v////////////////////////////JCzv/2Z27//m////7/////f///+MlP//VWb3//f////v////7////+/////v////zubm/36UlP/m7+////////////////////////////89Rff/VWbm/97v9//3////7////11m9/9mbvf/9////+/////v////7////+////+91t7/lK2t//f3/////////////////////////////5yl//80Rd7/zubv//f////O3v//LDTv/7XF///3////7////+/////v////5vf//6W9xf+ctbX/////////////////////////////////1t7//yQ05v+MnO///////4yU//89Rff/5vf//+/////v////7////+/////m9///nL3F/7XFzv/////////////////////////////////39///Zm73/0VV5v+9zvf/LDTv/5yl///3////7////+/////v////7////+b39/+UrbX/1t7e//////////////////////////////////////+UnPf/JCzm/yw07/9dbvf/5vf//+/////v////7////+/////v////1ubv/4ylpf/m7+///////////////////////////////////////97m//8sNO//XW7v/97v///3////7////+/////v////7////+/////F3t7/nK2t/////////////////////////////////////////////////25+vf+Mpc7/7////+/////v////7////+/////v////7////6W9vf/Fzs7/////////////////////////////////////////////////pb21/5Strf/O5ub/7////+/////v////7/////f////e7+//jK2t/+bv7//////////////////////////////////////////////////O5ub/fpyc/7XOzv/e9/f/9////+/////v////9////7XOzv+EpaX/5vf3/////////////////////////////////////////////////+bv7/+MvcX/lK2t/5y1tf/O5ub/5vf3/+bv7/+9zs7/lL29/4ytrf/3////////////////////////////////////////////////////3ubm/5TFxf+95u//rb29/4ylnP+cra3/lK2t/6W9vf+t1t7/nLW1/////////////////////////////////w==')";
                procButtonNum = General.NonQ(command, true);
                command       = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                                + POut.PInt(autoCodeNum) + ")";
                General.NonQ(command);
            }
            //Crown
            if (ProcedureCodes.IsValidCode("D2750") || ProcedureCodes.IsValidCode("N4118"))
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('Crown',2,"
                          + POut.PInt(category) + @",'Qk12BgAAAAAAADYAAAAoAAAAFAAAABQAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+1ve//PVXW/1Vu7/9mdu//Znbv/2Z27/9mdu//XW7v/2Z27/9mbu//Zm7v/2Zu7/9dbu//XW7v/01m7/9FXeb/pa33/////////////////11m7/89Re//XWbv/11m7/9dZu//XWbv/11m7/9dZu//XWbv/11m7/9dZu//XWbv/11m7/9dZu//XWbv/z1F7/9NVe/////////////e3v//LDTv/6Wt9//39///9/f///f3///39///9/f///f3///39///9/f///f3///39///9/f///f3///39///vb3//zQ97//W1v///////5Sc9/80Re//5ub////////////////////////////////////////////////////////////////////////W1v//PUXv/73F9//39///XWbv/2Zu7////////////////////////////////////////////////////////////////////////////9bW//89Re//vcX3/87O//8sNO//tb3/////////////////////////////////////////////////////////////////////////////3t7//zRF7/+cpff/hIz3/z1F7//v7///////////////////////////////////////////////////////////////////////////////////XWbv/2529/9udvf/VV3v//f3//////////////////////////////////////////////////////////////////////////////////+MlPf/TVXv/2529/9VXe//9/f/////////////////////////////7+///6Wl9/+1vf///////////////////////////////////////6Wl9/80Re//bnb3/1Vd7//39//////////////////////////////W1v//RU3v/6Wl9///////////////////////////////////////3t7//yw07/9mdu//XWbv//f3/////////////////////////////87W//9FTe//zs7////////////////////////////////////////39///VV3v/3Z+9/9NVe//9/f/////////////////////////////1tb//1Vd7//Ozv////////////////////////////////////////f3//9VXe//vb3//yQs7//Ozv////////////////////////////+9xff/ND3v/4yU9//v7///////////////////////////////////tb3//yw07//v7///VV3v/z1F7/+cnPf/5ub///f3///m5v//jJT3/zQ97/89Re//LDTv/0VN7/+MlPf/pa33/87O///v9///5ub//5Sc9/8sNO//foT3///////e5v//foT3/z1N7/8sNO//VV3v/zQ97/9FTe//lJz3/+/v///e5v//foT3/01V7/9FTe//LDTv/0VN7/8sNO//ND3v/4yU9////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////w==')";
                procButtonNum = General.NonQ(command, true);
                if (ProcedureCodes.IsValidCode("D2750"))
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum)
                              + "," + ProcedureCodes.GetCodeNum("D2750") + ",0)";
                    General.NonQ(command);
                }
                if (ProcedureCodes.IsValidCode("N4118"))
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum)
                              + "," + ProcedureCodes.GetCodeNum("N4118") + ",0)";
                    General.NonQ(command);
                }
            }
            //RCT
            autoCodeNum = AutoCodes.GetNumFromDescript("Root Canal");
            if (autoCodeNum != 0)
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('RCT',3,"
                          + POut.PInt(category) + @",'Qk12BgAAAAAAADYAAAAoAAAAFAAAABQAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA///////////////////////////////////////////F1tb/boyt/xwkpf/m5ub//////////////////////////////////////////////////////////////////////////////////////36MjP9VbpT/EySc/7XFxf//////////////////////////////////////////////////////////////////////////////////////XWZm/36lzv8kNMX/ZnZu//////////////////////////////////////////////////////////////////////////////////f39/9NXV3/fpz//wMD//9ddm7/zs7O////////////////////////////////////////////////////////////////////////////3t7e/2Z+dv9mfv//AwP//2aEfv+lpaX////////////////////////////////////////////////////////////////////////////FxcX/XXZ2/26E//8DA///jK2t/5ycnP///////////////////////////////////////////////////////////////////////////8XFxf9mfnb/fpT//wMD//+Era3/lJSU//f39///////////////////////////////////////////////////////////////////////nKWl/2aMjP9uhP//AwP//4y1tf+UnJz/9/f3//////////////////////////////////////////////////////////////////////9mbm7/ZoSE/2Z+//8DA///nMXF/4SMjP/39/f//////////////////////////////////////////////////////////////////////2Zubv9ujIT/Znb//wMD//+lzs7/foyM//f39///////////////////////////////////////////////////////////////////////PUVF/36lpf9ufv//AwP//63W1v9ufn7/9/f3/////////////////////////////////////////////////////////////////+/v7/9VVVX/jLW1/2Z2//8DA///td7m/2Z2dv/v7+//////////////////////////////////////////////////////////////////3t7e/1VVVf+Uxb3/bn7//wMD//+13ub/ZnZ2/+bm5v/////////////////////////////////////////////////////////////////e3t7/XWZu/5TFvf9mdv//AwP//7Xe5v9mdnb/3t7e/////////////////////////////////////////////////////////////////8XFxf9mbm7/nMXF/11m//8DA///zu/3/1VmXf/e3t7/////////////////////////////////////////////////////////////////zs7O/11mZv+cxcX/XW7//wMD///O7/f/VWZm/87Ozv/////////////////////////////////////////////////////////////////FxcX/ZnZ2/6XOzv9dbv//AwP//9bv9/9Vbm7/pa2t/////////////////////////////////////////////////////////////////62trf9VZmb/rdbW/01d//8DA///1u/3/01mZv+UlJT/////////////////////////////////////////////////////////////////nJyc/0VNTf+t3tb/XW7//wMD//+Urf//RV1d/4yUlP////////////////////////////////////////////////////////////////+1tbX/RV1d/7Xe3v9dZv//AwP//4yl//89VVX/foSE/////////////////////////////////w==')";
                procButtonNum = General.NonQ(command, true);
                command       = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                                + POut.PInt(autoCodeNum) + ")";
                General.NonQ(command);
            }
            //RCT BU PFM
            autoCodeNum  = AutoCodes.GetNumFromDescript("Root Canal");
            autoCodeNum2 = AutoCodes.GetNumFromDescript("BU/P&C");
            if (autoCodeNum != 0 || ProcedureCodes.IsValidCode("D2750"))           //we add this button if either RCT or crown is available.
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('RCT BU PFM',4,"
                          + POut.PInt(category) + @",'Qk12BgAAAAAAADYAAAAoAAAAFAAAABQAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA////////////////pcXF/63W7/89Te//Exzv/01V7/+95u//tebm/7Xm5v9+lO//HCTv/xwk7/9Vbu//pdbe/73m5v////////////////////////////////+cvb3/rdbv/z1N7/8cJO//PUXv/63W7/+15ub/tebm/11u7/8cJO//HCTv/01d7/+cztb/td7e////////////////////////////9/f//5y9tf+t1u//PU3v/xwk7/8kLO//pb33/73m5v/W7/f/PU3v/xwk7/8cJO//PU3v/4zF3v+13t7/////////////////////////////////lL21/6XW7/89Te//HCTv/xwk7/+ElPf/zvfv/5yt9/8kLO//HCTv/xwk7/89Te//lMXe/73e3v////////////////////////////////+UvbX/vd73/0VN7/8cJO//HCzv/yw97/9mbu//LDTv/xwk7/8cLO//HCTv/0VN7/+Uvc7/rc7O/////////////////////////////////6XO1v+13u//RU3v/xwk7/8cLO//HCTv/xwk7/8cJO//HCzv/xws7/8cJO//RU3v/4S13v+lztb////////////////////////////m5v//PU3v/zRF5v8kLO//EyTv/xwk7/8cJO//HCTv/xwk7/8cJO//HCTv/xMk7/8cJO//JCzv/zRF5v/W1v///////////////////////5yl9/8sNO//fn73/4SM9/+EjPf/hIz3/4SM9/+EjPf/hIz3/4SM9/+EjPf/hIz3/4SM9/+EhPf/ND3v/4yU9//////////////////39///TVXv/36E9/////////////////////////////////////////////////////////////////9mbvf/VV3v//f3/////////////8XF//8cLO//zs7//////////////////////////////////////////////////////////////////4SM9/8sPe//7+//////////////hIz3/0VN7//39///////////////////////////////////////////////////////////////////paX3/yQs7//m5v///////+bm//9FTe//hIT3///////////////////////////////////////////////////////////////////////Fxf//JCzv/7299///////xcX//yw07/+9vff//////////////////////////////////////////////////////////////////////+/v//89Re//VV3v///////Ozv//ND3v/7299////////////////////////////+/v///e3v//9/f/////////////////////////////9/f//1Vd7/9FTe///////8XO//80Pe//vb33////////////////////////////ra33/11m7//e3v//////////////////////////////////dn73/yQs7///////xcX//yw07//Fxf////////////////////////////+UlPf/Zm7v//////////////////////////////////////+1tf//JCzv///////W1v//NEXv/7299////////////////////////////5yl9/92fvf//////////////////////////////////////7299/8kLO////////f3//9dZu//fn73////////////////////////////foT3/z1F7//Ozv//////////////////////////////////dn73/zQ97////////////5yl9/8kLO//jJT3/+bm///39///5u///4SM9/8sNO//LDTv/yQs7/9+hPf/vb33/97e///39///5u///3Z+9/8kLO//vb33////////////9/f//5Sc9/9NVe//ND3v/z1F7/80Pe//TVXv/62t9//v7///nKX3/0VN7/8sNO//LDTv/01V7/80Pe//PUXv/7299////////////w==')";
                procButtonNum = General.NonQ(command, true);
                if (ProcedureCodes.IsValidCode("D2750"))
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum)
                              + "," + ProcedureCodes.GetCodeNum("D2750") + ",0)";
                    General.NonQ(command);
                }
                if (ProcedureCodes.IsValidCode("N4118"))
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum)
                              + "," + ProcedureCodes.GetCodeNum("N4118") + ",0)";
                    General.NonQ(command);
                }
                if (autoCodeNum != 0)
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                              + POut.PInt(autoCodeNum) + ")";
                    General.NonQ(command);
                }
                if (autoCodeNum2 != 0)
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                              + POut.PInt(autoCodeNum2) + ")";
                    General.NonQ(command);
                }
            }
            //Bridge
            autoCodeNum = AutoCodes.GetNumFromDescript("Bridge");
            if (autoCodeNum != 0 || ProcedureCodes.IsValidCode("N4127"))
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('Bridge',5,"
                          + POut.PInt(category) + @",'')";
                procButtonNum = General.NonQ(command, true);
                if (ProcedureCodes.IsValidCode("N4127"))
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum)
                              + "," + ProcedureCodes.GetCodeNum("N4127") + ",0)";
                    General.NonQ(command);
                }
                if (autoCodeNum != 0)
                {
                    command = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                              + POut.PInt(autoCodeNum) + ")";
                    General.NonQ(command);
                }
            }
            //Build Up
            autoCodeNum = AutoCodes.GetNumFromDescript("BU/P&C");
            if (autoCodeNum != 0)
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('BU/P&C',6,"
                          + POut.PInt(category) + @",'')";
                procButtonNum = General.NonQ(command, true);
                command       = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum) + ",'',"
                                + POut.PInt(autoCodeNum) + ")";
                General.NonQ(command);
            }
            //Exams/Cleanings Category--------------------------------------------------------------------------------------------
            command = "INSERT INTO definition (Category,ItemOrder,ItemName,ItemValue,ItemColor,IsHidden) "
                      + "VALUES (26,1,'Exams/Cleanings','',0,0)";
            category = General.NonQ(command, true);
            //PA
            if (ProcedureCodes.IsValidCode("D0220"))
            {
                command = "INSERT INTO procbutton (Description,ItemOrder,Category,ButtonImage) VALUES('PA',0,"
                          + POut.PInt(category) + @",'Qk12BgAAAAAAADYAAAAoAAAAFAAAABQAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9/f3/0VFRf8DAwP/AwMD/wMDA/9dXV3/jIyM/yQkJP8DAwP/AwMD/4SEhP8LCwv/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/RUVF/97e3v+MjIz/AwMD/wMDA/8DAwP/AwMD/35+fv/FxcX/JCQk/wMDA/8DAwP/5ubm/5SUlP8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/VVVV/wMDA/8DAwP/AwMD/wMDA/8LCwv/nJyc/+bm5v9dXV3/AwMD/wsLC/+MjIz/ZmZm/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wsLC/+lpaX/xcXF/zQ0NP8DAwP/NDQ0/62trf9dXV3/JCQk/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/TU1N/2ZmZv/Ozs7/dnZ2/wMDA/9dXV3/xcXF/+bm5v80NDT/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/9FRUX/lJSU/8XFxf+tra3/hISE/7W1tf/FxcX/tbW1/2ZmZv8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/01NTf/Ozs7/1tbW/+bm5v/Ozs7/7+/v/+bm5v/v7+//jIyM/yQkJP8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/ZmZm/+bm5v//////5ubm/+/v7//v7+//5ubm//f39//W1tb/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/9mZmb////////////39/f/5ubm//f39///////9/f3/+bm5v80NDT/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/1VVVf/39/f//////+/v7//m5ub/////////////////7+/v/yQkJP8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/3t7e/+/v7//39/f/9/f3/9bW1v/m5ub////////////v7+//AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/+EhIT/paWl/8XFxf//////3t7e/97e3v/v7+//5ubm/5ycnP8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/TU1N/wsLC/8DAwP/AwMD/wMDA/89PT3/1tbW/87Ozv/FxcX/lJSU/35+fv+MjIz/dnZ2/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/2ZmZv//////XV1d/wMDA/8DAwP/AwMD/wMDA/8LCwv/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/8DAwP/AwMD/wMDA/9mZmb//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////w==')";
                procButtonNum = General.NonQ(command, true);
                command       = "INSERT INTO procbuttonitem (ProcButtonNum,CodeNum,AutoCodeNum) VALUES (" + POut.PInt(procButtonNum)
                                + "," + ProcedureCodes.GetCodeNum("D0220") + ",0)";
                General.NonQ(command);
            }
            //NewChildExam
        }