Exemplo n.º 1
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDescript.Text.Trim() == "")
     {
         MsgBox.Show(this, "Please enter a description.");
         return;
     }
     if (_feeSchedCur == null)
     {
         MsgBox.Show(this, "Please select a fee schedule.");
         return;
     }
     if (comboBoxAdjType.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please select an adjustment type.\r\nYou may need to create discount plan adjustment types within definition setup.");
         return;
     }
     DiscountPlanCur.Description = textDescript.Text;
     DiscountPlanCur.FeeSchedNum = _feeSchedCur.FeeSchedNum;
     DiscountPlanCur.DefNum      = _listAdjTypeDefs[comboBoxAdjType.SelectedIndex].DefNum;
     DiscountPlanCur.IsHidden    = checkHidden.Checked;
     if (DiscountPlanCur.IsNew)
     {
         DiscountPlans.Insert(DiscountPlanCur);
     }
     else
     {
         DiscountPlans.Update(DiscountPlanCur);
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 2
0
        private void butDrop_Click(object sender, EventArgs e)
        {
            DiscountPlans.DropForPatient(FormOpenDental.CurPatNum);
            string logText = "The discount plan " + DiscountPlanCur.Description + " was dropped.";

            SecurityLogs.MakeLogEntry(Permissions.DiscountPlanAddDrop, FormOpenDental.CurPatNum, logText);
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 3
0
        private void FormDiscountPlanEdit_Load(object sender, EventArgs e)
        {
            textDescript.Text = DiscountPlanCur.Description;
            _listPatNames     = DiscountPlans.GetPatsForPlan(DiscountPlanCur.DiscountPlanNum)
                                .Select(x => x.LName + ", " + x.FName)
                                .Distinct()
                                .OrderBy(x => x)
                                .ToList();
            _feeSchedCur      = FeeScheds.GetFirstOrDefault(x => x.FeeSchedNum == DiscountPlanCur.FeeSchedNum, true);
            textFeeSched.Text = _feeSchedCur != null ? _feeSchedCur.Description : "";
            _listAdjTypeDefs  = Defs.GetDiscountPlanAdjTypes().ToList();
            for (int i = 0; i < _listAdjTypeDefs.Count; i++)
            {
                comboBoxAdjType.Items.Add(_listAdjTypeDefs[i].ItemName);
                if (_listAdjTypeDefs[i].DefNum == DiscountPlanCur.DefNum)
                {
                    comboBoxAdjType.SelectedIndex = i;
                }
            }
            //populate patient information
            int countPats = _listPatNames.Count;

            textNumPatients.Text = countPats.ToString();
            if (countPats > 10000)           //10,000 per Nathan. copied from FormInsPlan.cs
            {
                comboPatient.Visible     = false;
                butListPatients.Visible  = true;
                butListPatients.Location = comboPatient.Location;
            }
            else
            {
                comboPatient.Visible    = true;
                butListPatients.Visible = false;
                comboPatient.Items.Clear();
                comboPatient.Items.AddRange(_listPatNames.ToArray());
                if (_listPatNames.Count > 0)
                {
                    comboPatient.SelectedIndex = 0;
                }
            }
            checkHidden.Checked = DiscountPlanCur.IsHidden;
            if (!Security.IsAuthorized(Permissions.InsPlanEdit, true))            //User may be able to get here if FormDiscountPlans is not in selection mode.
            {
                textDescript.ReadOnly   = true;
                comboBoxAdjType.Enabled = false;
                butFeeSched.Enabled     = false;
                butOK.Enabled           = false;
                checkHidden.Enabled     = false;
            }
            if (IsSelectionMode)
            {
                butDrop.Visible = true;
            }
        }
Exemplo n.º 4
0
		private void checkHidden_Click(object sender,EventArgs e) {
			if(checkHidden.Checked) {
				List<Patient> listPatsForPlan=DiscountPlans.GetPatsForPlan(DiscountPlanCur.DiscountPlanNum);
				if(listPatsForPlan.Count!=0) {
					string msgText=Lan.g(this,"Specified Discount Plan will be hidden.  "+
						"It will no longer be available for assigning, but existing patients on plan will remain");
					if(MessageBox.Show(this,msgText,"",MessageBoxButtons.OKCancel)==DialogResult.Cancel) {
						checkHidden.Checked=false;
					}
				}
			}
		}
Exemplo n.º 5
0
        ///<summary></summary>
        public static DiscountPlan CreateDiscountPlan(string description, long defNum = 0, long feeSchedNum = 0, bool isHidden = false)
        {
            DiscountPlan discountPlan = new DiscountPlan()
            {
                Description = description,
                DefNum      = defNum,
                FeeSchedNum = feeSchedNum,
                IsHidden    = isHidden,
            };

            DiscountPlans.Insert(discountPlan);
            return(discountPlan);
        }
Exemplo n.º 6
0
 private void butMerge_Click(object sender, EventArgs e)
 {
     if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Merge the Discount Plan at the bottom into the Discount Plan shown at the top?"))
     {
         return;                //The user chose not to merge.
     }
     Cursor = Cursors.WaitCursor;
     DiscountPlans.MergeTwoPlans(_planInto, _planFrom);
     Cursor = Cursors.Default;
     MsgBox.Show(this, "Plans merged successfully.");
     _planFrom = null;
     textDescriptionFrom.Text = "";
     textFeeSchedFrom.Text    = "";
     textAdjTypeFrom.Text     = "";
     CheckUIState();
 }
Exemplo n.º 7
0
        private void FillGrid()
        {
            List <DiscountPlan>    listDiscountPlans  = DiscountPlans.GetAll(checkShowHidden.Checked);
            Dictionary <long, int> dictPatientsOnPlan = DiscountPlans.GetPatCountsForPlans(listDiscountPlans.Select(x => x.DiscountPlanNum).ToList());

            listDiscountPlans.Sort(DiscountPlanComparer);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Description"), 200));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Fee Schedule"), 170));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Adjustment Type"), checkShowHidden.Checked ? 150 : 170));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Pats"), 40));
            if (checkShowHidden.Checked)
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableDiscountPlans", "Hidden"), 20, HorizontalAlignment.Center));
            }
            gridMain.ListGridRows.Clear();
            GridRow row;
            int     selectedIdx = -1;

            for (int i = 0; i < listDiscountPlans.Count; i++)
            {
                Def adjType = Defs.GetDef(DefCat.AdjTypes, listDiscountPlans[i].DefNum);
                row = new GridRow();
                row.Cells.Add(listDiscountPlans[i].Description);
                row.Cells.Add(FeeScheds.GetDescription(listDiscountPlans[i].FeeSchedNum));
                row.Cells.Add((adjType == null) ? "" : adjType.ItemName);
                row.Cells.Add(dictPatientsOnPlan.ContainsKey(listDiscountPlans[i].DiscountPlanNum)
                                        ? dictPatientsOnPlan[listDiscountPlans[i].DiscountPlanNum].ToString() : "0");
                if (checkShowHidden.Checked)
                {
                    row.Cells.Add(listDiscountPlans[i].IsHidden ? "X" : "");
                }
                row.Tag = listDiscountPlans[i];
                gridMain.ListGridRows.Add(row);
                if (SelectedPlan != null && listDiscountPlans[i].DiscountPlanNum == SelectedPlan.DiscountPlanNum)
                {
                    selectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            gridMain.SetSelected(selectedIdx, true);
        }
Exemplo n.º 8
0
        private void butListPatients_Click(object sender, EventArgs e)
        {
            if (_listPatNames == null)
            {
                _listPatNames = DiscountPlans.GetPatNamesForPlan(DiscountPlanCur.DiscountPlanNum)
                                .Distinct()
                                .OrderBy(x => x)
                                .ToList();
            }
            ODForm form = new ODForm()
            {
                Size            = new Size(500, 400),
                Text            = "Other Patients List",
                FormBorderStyle = FormBorderStyle.FixedSingle
            };
            ODGrid grid = new ODGrid()
            {
                Size            = new Size(475, 300),
                Location        = new Point(5, 5),
                Title           = "Patients",
                TranslationName = ""
            };

            UI.Button butClose = new UI.Button()
            {
                Size     = new Size(75, 23),
                Text     = "Close",
                Location = new Point(form.ClientSize.Width - 80, form.ClientSize.Height - 28), //Subtract the button's size plus 5 pixel buffer.
            };
            butClose.Click += (s, ex) => form.Close();                                         //When butClose is pressed, simply close the form.  If more functionality is needed, make a method below.
            form.Controls.Add(grid);
            form.Controls.Add(butClose);
            grid.BeginUpdate();
            grid.ListGridColumns.Clear();
            grid.ListGridColumns.Add(new GridColumn(Lan.g(this, "Name"), 0));
            grid.ListGridRows.Clear();
            foreach (string patName in _listPatNames)
            {
                grid.ListGridRows.Add(new GridRow(patName));
            }
            grid.EndUpdate();
            form.ShowDialog();
        }