private void butAddProc_Click(object sender, EventArgs e)
        {
            List <GridColumn> listGridCols = new List <GridColumn>()
            {
                new GridColumn(Lan.g(this, "Code"), 70),
                new GridColumn(Lan.g(this, "Abbreviation"), 90, HorizontalAlignment.Center),
                new GridColumn(Lan.g(this, "Description"), 0, HorizontalAlignment.Right)
            };
            List <ProcedureCode> listMouthProcCodes = ProcedureCodes.GetProcCodesByTreatmentArea(false, TreatmentArea.Mouth, TreatmentArea.None)
                                                      .OrderBy(x => x.ProcCode).ToList();
            List <GridRow> listGridRows = new List <GridRow>();

            listMouthProcCodes.ForEach(x => {
                GridRow row = new GridRow(x.ProcCode, x.AbbrDesc, x.Descript);
                row.Tag     = x;
                listGridRows.Add(row);
            });
            FormGridSelection formGridSelect = new FormGridSelection(listGridCols, listGridRows, "Add Procedure", "Procedures");

            if (formGridSelect.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            foreach (object tag in formGridSelect.ListSelectedTags)
            {
                string fieldName = "Proc:" + ((ProcedureCode)tag).ProcCode;
                listBoxFields.Items.Add(new ODBoxItem <SheetFieldDef>(fieldName, SheetFieldDef.NewCheckBox(fieldName, 0, 0, 0, 0)));
                listBoxFields.SetSelected(listBoxFields.Items.Count - 1, true);
            }
        }
Esempio n. 2
0
        private void butPickFeeSched_Click(object sender, EventArgs e)
        {
            List <GridColumn> listColumnHeaders = new List <GridColumn>()
            {
                new GridColumn(Lan.g(this, "Description"), 250),
                new GridColumn(Lan.g(this, "Hidden"), 25)
            };
            List <GridRow> listRowValues = new List <GridRow>();

            _listFeeScheds.ForEach(x => {
                GridRow row = new GridRow(x.Description, x.IsHidden?"X":"");
                row.Tag     = x;
                listRowValues.Add(row);
            });
            string            formTitle = Lan.g(this, "Fee Schedule Picker");
            string            gridTitle = Lan.g(this, "Fee Schedules");
            FormGridSelection form      = new FormGridSelection(listColumnHeaders, listRowValues, formTitle, gridTitle);

            if (form.ShowDialog() == DialogResult.OK)
            {
                comboFeeSched.SelectedIndex = comboFeeSched.Items.IndexOf((comboFeeSched.Items.AsEnumerable <ODBoxItem <FeeSched> >().Where(x => x.Tag.FeeSchedNum == ((FeeSched)form.ListSelectedTags[0]).FeeSchedNum).First()));
            }
        }
Esempio n. 3
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!ValidateUserInput())
            {
                return;
            }
            FeeSched    feeSchedCur       = ((ODBoxItem <FeeSched>)comboFeeSched.SelectedItem).Tag;
            List <long> listClinicNumsNew = _listClinicsInGroup.Select(x => x.ClinicNum).ToList();

            //Initial fee sync for new groups or groups that were created without any clinics in the group, or if we just changed the Fee Schedule for the group.
            //If editing an existing fee schedule group that contains no clinic associations, treat it like a new group and set the initial fees.
            if (_feeSchedGroupCur.IsNew || _feeSchedGroupCur.ListClinicNumsAll.Count() < 1 || _feeSchedGroupCur.FeeSchedNum != feeSchedCur.FeeSchedNum)
            {
                if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Would you like to set the initial group fees to a specific clinic's fees?"
                                + "  Answering no will result in the default fees for the fee schedule being used."))
                {
                    List <GridColumn> listColumnHeaders = new List <GridColumn>()
                    {
                        new GridColumn(Lan.g(this, "Abbr"), 75),
                        new GridColumn(Lan.g(this, "Description"), 200)
                    };
                    List <GridRow> listRowValues = new List <GridRow>();
                    _listClinicsInGroup.ForEach(x => {
                        GridRow row = new GridRow(x.Abbr, x.Description);
                        row.Tag     = x;
                        listRowValues.Add(row);
                    });
                    string            formTitle = Lan.g(this, "Clinic Picker");
                    string            gridTitle = Lan.g(this, "Clinics");
                    FormGridSelection form      = new FormGridSelection(listColumnHeaders, listRowValues, formTitle, gridTitle);
                    if (form.ShowDialog() != DialogResult.OK)
                    {
                        MsgBox.Show(this, "A default clinic was not selected.");
                        return;
                    }
                    long clinicNumMaster = ((Clinic)form.ListSelectedTags[0]).ClinicNum;                  //DialogResult.OK means a selection was made.
                    //This list came from _listClinicsInGroup which was used to fill the grid picker that we get clinicNumMaster from.  We need to pop the master
                    //clinic off the list while copying fee schedules or else it will be deleted before copying.
                    //Give the user an out before potentially changing a lot of data in the db.
                    if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Fees are about to be updated.  Continue?"))
                    {
                        return;
                    }
                    ODProgress.ShowAction(() => {
                        listClinicNumsNew.Remove(clinicNumMaster);
                        FeeScheds.CopyFeeSchedule(feeSchedCur, clinicNumMaster, 0, feeSchedCur, listClinicNumsNew, 0);
                        listClinicNumsNew.Add(clinicNumMaster);
                    }, Lans.g(this, "Creating Group, Please Wait..."));
                }
                else                  //Default fees.
                                      //Give the user an out before potentially changing a lot of data in the db.
                {
                    if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Fees are about to be updated.  Continue?"))
                    {
                        return;
                    }
                    ODProgress.ShowAction(() => {
                        FeeScheds.CopyFeeSchedule(feeSchedCur, 0, 0, feeSchedCur, listClinicNumsNew, 0);
                    }, Lans.g(this, "Creating Group, Please Wait..."));
                }
            }
            //Existing group, change the fees for all the new clinics in the group. Use the first clinic in the old clinic list as we already did an empty check
            //and the fees should have already been synched previously.
            else
            {
                if (listClinicNumsNew.Except(_feeSchedGroupCur.ListClinicNumsAll).Count() != 0 || _feeSchedGroupCur.ListClinicNumsAll.Except(listClinicNumsNew).Count() != 0)
                {
                    //Give the user an out before potentially changing a lot of data in the db.
                    if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Clinics added to the group will have their fees updated to match the group.  Clinics removed from" +
                                     " the group will not have their fees changed.  Continue?"))
                    {
                        return;
                    }
                    //For an existing group we can not guarantee that the ClinicNum we are using to copy fee schedules with is actually still in the group. It is ok to
                    //use a ClinicNum that used to be in the group as the fees will still be in sync at this point.
                    //Only update the fees for clinics that were just added to the group, don't attempt to update fess already in the group.
                    List <long> listClinicNumsToSync = listClinicNumsNew.Where(x => !_feeSchedGroupCur.ListClinicNumsAll.Contains(x)).ToList();
                    if (listClinicNumsToSync.Count > 0)
                    {
                        FeeScheds.CopyFeeSchedule(feeSchedCur, _feeSchedGroupCur.ListClinicNumsAll.First(), 0, feeSchedCur, listClinicNumsToSync, 0);
                    }
                }
            }
            _feeSchedGroupCur.Description       = textDescription.Text;
            _feeSchedGroupCur.FeeSchedNum       = feeSchedCur.FeeSchedNum;
            _feeSchedGroupCur.ListClinicNumsAll = listClinicNumsNew;
            DialogResult = DialogResult.OK;
        }