private void gridFees_CellDoubleClick(object sender, OpenDental.UI.ODGridClickEventArgs e) { Fee FeeCur = Fees.GetFeeByOrder(ProcCode.ADACode, e.Row); //tbFees.SelectedRow=e.Row; //tbFees.ColorRow(e.Row,Color.LightGray); FormFeeEdit FormFE = new FormFeeEdit(); if (FeeCur == null) { FeeCur = new Fee(); FeeCur.ADACode = ProcCode.ADACode; FeeCur.FeeSched = DefB.Short[(int)DefCat.FeeSchedNames][e.Row].DefNum; Fees.Insert(FeeCur); FormFE.IsNew = true; } FormFE.FeeCur = FeeCur; FormFE.ShowDialog(); if (FormFE.DialogResult == DialogResult.OK) { FeeChanged = true; } Fees.Refresh(); //tbFees.SelectedRow=-1; FillFees(); }
private void FillFees() { //This line will be added later for speed: //DataTable feeList=Fees.GetListForCode(ProcCode.ADACode); gridFees.BeginUpdate(); gridFees.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableProcFee", "Sched"), 120); gridFees.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcFee", "Amount"), 60, HorizontalAlignment.Right); gridFees.Columns.Add(col); gridFees.Rows.Clear(); ODGridRow row; Fee fee; for (int i = 0; i < DefB.Short[(int)DefCat.FeeSchedNames].Length; i++) { fee = Fees.GetFeeByOrder(ProcCode.ADACode, i); row = new ODGridRow(); row.Cells.Add(DefB.Short[(int)DefCat.FeeSchedNames][i].ItemName); if (fee == null) { row.Cells.Add(""); } else { row.Cells.Add(fee.Amount.ToString("n")); } gridFees.Rows.Add(row); } gridFees.EndUpdate(); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { if (IsSelectionMode) { SelectedADA = ProcTable.Rows[e.Row]["ADACode"].ToString(); DialogResult = DialogResult.OK; return; } //else not selecting a code if (!Security.IsAuthorized(Permissions.Setup, DateTime.MinValue, true)) { return; } string ada = ProcTable.Rows[e.Row]["ADACode"].ToString(); if (e.Col > 3) //if double clicked on a fee { Fee FeeCur = null; int feesched = 0; if (e.Col == 4) { FeeCur = Fees.GetFeeByOrder(ada, listFeeSched.SelectedIndex); feesched = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum; } if (e.Col == 5) { if (comboCompare1.SelectedIndex == 0) { return; } FeeCur = Fees.GetFeeByOrder(ada, comboCompare1.SelectedIndex - 1); feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].DefNum; } if (e.Col == 6) { if (comboCompare2.SelectedIndex == 0) { return; } FeeCur = Fees.GetFeeByOrder(ada, comboCompare2.SelectedIndex - 1); feesched = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].DefNum; } FormFeeEdit FormFE = new FormFeeEdit(); if (FeeCur == null) { FeeCur = new Fee(); FeeCur.ADACode = ada; FeeCur.FeeSched = feesched; Fees.Insert(FeeCur); FormFE.IsNew = true; } FormFE.FeeCur = FeeCur; FormFE.ShowDialog(); if (FormFE.DialogResult == DialogResult.OK) { Fees.Refresh(); changed = true; FillGrid(); } } else //not on a fee: Edit code instead { FormProcCodeEdit FormPCE = new FormProcCodeEdit(ProcedureCodes.GetProcCode(ada)); FormPCE.IsNew = false; FormPCE.ShowDialog(); if (FormPCE.DialogResult == DialogResult.OK) { //ProcedureCodes.Refresh(); changed = true; //Fees.Refresh();//fees were already refreshed within procCodeEdit FillGrid(); } } }