Пример #1
0
        private void FormAdjust_Load(object sender, System.EventArgs e)
        {
            if (AvaTax.IsEnabled())
            {
                //We do not want to allow the user to make edits or delete SalesTax and SalesTaxReturn Adjustments.  Popup if no permission so user knows why disabled.
                if (AvaTax.IsEnabled() &&
                    (_adjustmentCur.AdjType == AvaTax.SalesTaxAdjType || _adjustmentCur.AdjType == AvaTax.SalesTaxReturnAdjType) &&
                    !Security.IsAuthorized(Permissions.SalesTaxAdjEdit))
                {
                    DisableForm(textNote, butCancel);
                    textNote.ReadOnly = true;                  //This will allow the user to copy the note if desired.
                }
            }
            if (IsNew)
            {
                if (!Security.IsAuthorized(Permissions.AdjustmentCreate, true))                //Date not checked here.  Message will show later.
                {
                    if (!Security.IsAuthorized(Permissions.AdjustmentEditZero, true))          //Let user create an adjustment of zero if they have this perm.
                    {
                        MessageBox.Show(Lans.g("Security", "Not authorized for") + "\r\n" + GroupPermissions.GetDesc(Permissions.AdjustmentCreate));
                        DialogResult = DialogResult.Cancel;
                        return;
                    }
                    //Make sure amount is 0 after OK click.
                    _checkZeroAmount = true;
                }
            }
            else
            {
                if (!Security.IsAuthorized(Permissions.AdjustmentEdit, _adjustmentCur.AdjDate))
                {
                    butOK.Enabled     = false;
                    butDelete.Enabled = false;
                    //User can't edit but has edit zero amount perm.  Allow delete only if date is today.
                    if (Security.IsAuthorized(Permissions.AdjustmentEditZero, true) &&
                        _adjustmentCur.AdjAmt == 0 &&
                        _adjustmentCur.DateEntry.Date == MiscData.GetNowDateTime().Date)
                    {
                        butDelete.Enabled = true;
                    }
                }
                bool isAttachedToPayPlan = PayPlanLinks.GetForFKeyAndLinkType(_adjustmentCur.AdjNum, PayPlanLinkType.Adjustment).Count > 0;
                _listSplitsForAdjustment = PaySplits.GetForAdjustments(new List <long>()
                {
                    _adjustmentCur.AdjNum
                });
                if (_listSplitsForAdjustment.Count > 0 || isAttachedToPayPlan)
                {
                    butAttachProc.Enabled     = false;
                    butDetachProc.Enabled     = false;
                    labelProcDisabled.Visible = true;
                }
                //Do not let the user change the adjustment type if the current adjustment is a "discount plan" adjustment type.
                if (Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "dp")
                {
                    labelAdditions.Text       = Lan.g(this, "Discount Plan") + ": " + Defs.GetName(DefCat.AdjTypes, _adjustmentCur.AdjType);
                    labelSubtractions.Visible = false;
                    listTypePos.Visible       = false;
                    listTypeNeg.Visible       = false;
                }
            }
            textDateEntry.Text = _adjustmentCur.DateEntry.ToShortDateString();
            textAdjDate.Text   = _adjustmentCur.AdjDate.ToShortDateString();
            textProcDate.Text  = _adjustmentCur.ProcDate.ToShortDateString();
            if (Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "+")         //pos
            {
                textAmount.Text = _adjustmentCur.AdjAmt.ToString("F");
            }
            else if (Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "-")    //neg
            {
                textAmount.Text = (-_adjustmentCur.AdjAmt).ToString("F");              //shows without the neg sign
            }
            else if (Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "dp")   //Discount Plan (neg)
            {
                textAmount.Text = (-_adjustmentCur.AdjAmt).ToString("F");              //shows without the neg sign
            }
            comboClinic.SelectedClinicNum = _adjustmentCur.ClinicNum;
            comboProv.SetSelectedProvNum(_adjustmentCur.ProvNum);
            FillComboProv();
            if (_adjustmentCur.ProcNum != 0 && PrefC.GetInt(PrefName.RigorousAdjustments) == (int)RigorousAdjustments.EnforceFully)
            {
                comboProv.Enabled   = false;
                butPickProv.Enabled = false;
                comboClinic.Enabled = false;
                if (Security.IsAuthorized(Permissions.Setup, true))
                {
                    labelEditAnyway.Visible = true;
                    butEditAnyway.Visible   = true;
                }
            }
            //prevents FillProcedure from being called too many times.  Event handlers hooked back up after the lists are filled.
            listTypeNeg.SelectedIndexChanged -= listTypeNeg_SelectedIndexChanged;
            listTypePos.SelectedIndexChanged -= listTypePos_SelectedIndexChanged;
            List <Def> adjCat = Defs.GetDefsForCategory(DefCat.AdjTypes, true);

            //Positive adjustment types
            _listAdjPosCats = adjCat.FindAll(x => x.ItemValue == "+");
            _listAdjPosCats.ForEach(x => listTypePos.Items.Add(x.ItemName));
            listTypePos.SelectedIndex = _listAdjPosCats.FindIndex(x => x.DefNum == _adjustmentCur.AdjType);        //can be -1
            //Negative adjustment types
            _listAdjNegCats = adjCat.FindAll(x => x.ItemValue == "-");
            _listAdjNegCats.ForEach(x => listTypeNeg.Items.Add(x.ItemName));
            listTypeNeg.SelectedIndex         = _listAdjNegCats.FindIndex(x => x.DefNum == _adjustmentCur.AdjType);//can be -1
            listTypeNeg.SelectedIndexChanged += listTypeNeg_SelectedIndexChanged;
            listTypePos.SelectedIndexChanged += listTypePos_SelectedIndexChanged;
            FillProcedure();
            textNote.Text = _adjustmentCur.AdjNote;
        }
Пример #2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            bool isDiscountPlanAdj = (Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "dp");

            if (textAdjDate.errorProvider1.GetError(textAdjDate) != "" ||
                textProcDate.errorProvider1.GetError(textProcDate) != "" ||
                textAmount.errorProvider1.GetError(textAmount) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (PIn.Date(textAdjDate.Text).Date > DateTime.Today.Date && !PrefC.GetBool(PrefName.FutureTransDatesAllowed))
            {
                MsgBox.Show(this, "Adjustment date can not be in the future.");
                return;
            }
            if (textAmount.Text == "")
            {
                MessageBox.Show(Lan.g(this, "Please enter an amount."));
                return;
            }
            if (!isDiscountPlanAdj && listTypeNeg.SelectedIndex == -1 && listTypePos.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a type first.");
                return;
            }
            if (IsNew && AvaTax.IsEnabled() && listTypePos.SelectedIndex > -1 &&
                (_listAdjPosCats[listTypePos.SelectedIndex].DefNum == AvaTax.SalesTaxAdjType || _listAdjPosCats[listTypePos.SelectedIndex].DefNum == AvaTax.SalesTaxReturnAdjType) &&
                !Security.IsAuthorized(Permissions.SalesTaxAdjEdit))
            {
                return;
            }
            if (PrefC.GetInt(PrefName.RigorousAdjustments) == 0 && _adjustmentCur.ProcNum == 0)
            {
                MsgBox.Show(this, "You must attach a procedure to the adjustment.");
                return;
            }
            if (_adjRemAmt < 0)
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Remaining amount is negative.  Continue?", "Overpaid Procedure Warning"))
                {
                    return;
                }
            }
            bool            changeAdjSplit         = false;
            List <PaySplit> listPaySplitsForAdjust = new List <PaySplit>();

            if (IsNew)
            {
                //prevents backdating of initial adjustment
                if (!Security.IsAuthorized(Permissions.AdjustmentCreate, PIn.Date(textAdjDate.Text), true)) //Give message later.
                {
                    if (!_checkZeroAmount)                                                                  //Let user create as long as Amount is zero and has edit zero permissions.  This was checked on load.
                    {
                        MessageBox.Show(Lans.g("Security", "Not authorized for") + "\r\n" + GroupPermissions.GetDesc(Permissions.AdjustmentCreate));
                        return;
                    }
                }
            }
            else
            {
                //Editing an old entry will already be blocked if the date was too old, and user will not be able to click OK button
                //This catches it if user changed the date to be older.
                if (!Security.IsAuthorized(Permissions.AdjustmentEdit, PIn.Date(textAdjDate.Text)))
                {
                    return;
                }
                if (_adjustmentCur.ProvNum != comboProv.GetSelectedProvNum())
                {
                    listPaySplitsForAdjust = PaySplits.GetForAdjustments(new List <long>()
                    {
                        _adjustmentCur.AdjNum
                    });
                    foreach (PaySplit paySplit in listPaySplitsForAdjust)
                    {
                        if (!Security.IsAuthorized(Permissions.PaymentEdit, Payments.GetPayment(paySplit.PayNum).PayDate))
                        {
                            return;
                        }
                        if (comboProv.GetSelectedProvNum() != paySplit.ProvNum && PrefC.GetInt(PrefName.RigorousAccounting) == (int)RigorousAdjustments.EnforceFully)
                        {
                            changeAdjSplit = true;
                            break;
                        }
                    }
                    if (changeAdjSplit &&
                        !MsgBox.Show(this, MsgBoxButtons.OKCancel, "The provider for the associated payment splits will be changed to match the provider on the "
                                     + "adjustment."))
                    {
                        return;
                    }
                }
            }
            //DateEntry not allowed to change
            DateTime datePreviousChange = _adjustmentCur.SecDateTEdit;

            _adjustmentCur.AdjDate   = PIn.Date(textAdjDate.Text);
            _adjustmentCur.ProcDate  = PIn.Date(textProcDate.Text);
            _adjustmentCur.ProvNum   = comboProv.GetSelectedProvNum();
            _adjustmentCur.ClinicNum = comboClinic.SelectedClinicNum;
            if (listTypePos.SelectedIndex != -1)
            {
                _adjustmentCur.AdjType = _listAdjPosCats[listTypePos.SelectedIndex].DefNum;
                _adjustmentCur.AdjAmt  = PIn.Double(textAmount.Text);
            }
            if (listTypeNeg.SelectedIndex != -1)
            {
                _adjustmentCur.AdjType = _listAdjNegCats[listTypeNeg.SelectedIndex].DefNum;
                _adjustmentCur.AdjAmt  = -PIn.Double(textAmount.Text);
            }
            if (isDiscountPlanAdj)
            {
                //AdjustmentCur.AdjType is already set to a "discount plan" adj type.
                _adjustmentCur.AdjAmt = -PIn.Double(textAmount.Text);
            }
            if (_checkZeroAmount && _adjustmentCur.AdjAmt != 0)
            {
                MsgBox.Show(this, "Amount has to be 0.00 due to security permission.");
                return;
            }
            _adjustmentCur.AdjNote = textNote.Text;
            try{
                if (IsNew)
                {
                    Adjustments.Insert(_adjustmentCur);
                    SecurityLogs.MakeLogEntry(Permissions.AdjustmentCreate, _adjustmentCur.PatNum,
                                              _patCur.GetNameLF() + ", "
                                              + _adjustmentCur.AdjAmt.ToString("c"));
                    TsiTransLogs.CheckAndInsertLogsIfAdjTypeExcluded(_adjustmentCur, _isTsiAdj);
                }
                else
                {
                    Adjustments.Update(_adjustmentCur);
                    SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, _adjustmentCur.PatNum, _patCur.GetNameLF() + ", " + _adjustmentCur.AdjAmt.ToString("c"), 0
                                              , datePreviousChange);
                }
            }
            catch (Exception ex) {          //even though it doesn't currently throw any exceptions
                MessageBox.Show(ex.Message);
                return;
            }
            if (changeAdjSplit)
            {
                PaySplits.UpdateProvForAdjust(_adjustmentCur, listPaySplitsForAdjust);
            }
            DialogResult = DialogResult.OK;
        }
Пример #3
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!checkAllBilling.Checked && listBillingTypes.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one Billing Type must be selected.");
                return;
            }
            if (!checkAllProv.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one Provider must be selected.");
                return;
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one Clinic must be selected.");
                    return;
                }
            }
            ReportComplex report                 = new ReportComplex(true, false);
            List <long>   listProvNums           = new List <long>();
            List <long>   listClinicNums         = new List <long>();
            List <long>   listBillingTypeDefNums = new List <long>();

            if (checkAllProv.Checked)
            {
                for (int i = 0; i < _listProviders.Count; i++)
                {
                    listProvNums.Add(_listProviders[i].ProvNum);
                }
            }
            else
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum);
                }
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    if (!Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(0);
                    }
                    for (int i = 0; i < _listClinics.Count; i++)
                    {
                        listClinicNums.Add(_listClinics[i].ClinicNum);
                    }
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                            //we know that the list is a 1:1 to _listClinics
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                listClinicNums.Add(0);
                            }
                            else
                            {
                                listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                              //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            if (checkAllBilling.Checked)
            {
                for (int i = 0; i < _listBillingTypeDefs.Count; i++)
                {
                    listBillingTypeDefNums.Add(_listBillingTypeDefs[i].DefNum);
                }
            }
            else
            {
                for (int i = 0; i < listBillingTypes.SelectedIndices.Count; i++)
                {
                    listBillingTypeDefNums.Add(_listBillingTypeDefs[listBillingTypes.SelectedIndices[i]].DefNum);
                }
            }
            DataTable tablePats = RpActivePatients.GetActivePatientTable(dateStart.SelectionStart, dateEnd.SelectionStart, listProvNums, listClinicNums
                                                                         , listBillingTypeDefNums, checkAllProv.Checked, checkAllClin.Checked, checkAllBilling.Checked);
            string subtitleProvs   = "";
            string subtitleClinics = "";
            string subtitleBilling = "";

            if (checkAllProv.Checked)
            {
                subtitleProvs = Lan.g(this, "All Providers");
            }
            else
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        subtitleProvs += ", ";
                    }
                    subtitleProvs += _listProviders[listProv.SelectedIndices[i]].Abbr;
                }
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            if (checkAllBilling.Checked)
            {
                subtitleBilling = Lan.g(this, "All Billing Types");
            }
            else
            {
                for (int i = 0; i < listBillingTypes.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        subtitleBilling += ", ";
                    }
                    subtitleBilling += Defs.GetValue(DefCat.BillingTypes, _listBillingTypeDefs[listBillingTypes.SelectedIndices[i]].DefNum);
                }
            }
            report.ReportName = Lan.g(this, "Active Patients");
            report.AddTitle("Title", Lan.g(this, "Active Patients"));
            report.AddSubTitle("Date", dateStart.SelectionStart.ToShortDateString() + " - " + dateEnd.SelectionStart.ToShortDateString());
            report.AddSubTitle("Providers", subtitleProvs);
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics);
            }
            report.AddSubTitle("Billing", subtitleBilling);
            QueryObject query;

            if (PrefC.HasClinicsEnabled)
            {
                query = report.AddQuery(tablePats, "", "clinic", SplitByKind.Value, 0);
            }
            else
            {
                query = report.AddQuery(tablePats, "", "", SplitByKind.None, 0);
            }
            query.AddColumn("Name", 150, FieldValueType.String);
            query.AddColumn("Provider", 80, FieldValueType.String);
            query.AddColumn("Address", 150, FieldValueType.String);
            query.AddColumn("Address2", 90, FieldValueType.String);
            query.AddColumn("City", 100, FieldValueType.String);
            query.AddColumn("State", 40, FieldValueType.String);
            query.AddColumn("Zip", 70, FieldValueType.String);
            query.AddColumn("Carrier", 120, FieldValueType.String);
            query.AddGroupSummaryField("Patient Count:", "Carrier", "Name", SummaryOperation.Count);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;
        }
Пример #4
0
        private void FillProcedure()
        {
            if (_adjustmentCur.ProcNum == 0)
            {
                textProcDate2.Text       = "";
                textProcProv.Text        = "";
                textProcTooth.Text       = "";
                textProcDescription.Text = "";
                textProcFee.Text         = "";
                textProcWriteoff.Text    = "";
                textProcInsPaid.Text     = "";
                textProcInsEst.Text      = "";
                textProcAdj.Text         = "";
                textProcPatPaid.Text     = "";
                textProcAdjCur.Text      = "";
                labelProcRemain.Text     = "";
                _adjRemAmt = 0;
                return;
            }
            Procedure         procCur         = Procedures.GetOneProc(_adjustmentCur.ProcNum, false);
            List <ClaimProc>  listClaimProcs  = ClaimProcs.Refresh(procCur.PatNum);
            List <Adjustment> listAdjustments = Adjustments.Refresh(procCur.PatNum)
                                                .Where(x => x.ProcNum == procCur.ProcNum && x.AdjNum != _adjustmentCur.AdjNum).ToList();

            textProcDate.Text        = procCur.ProcDate.ToShortDateString();
            textProcDate2.Text       = procCur.ProcDate.ToShortDateString();
            textProcProv.Text        = Providers.GetAbbr(procCur.ProvNum);
            textProcTooth.Text       = Tooth.ToInternat(procCur.ToothNum);
            textProcDescription.Text = ProcedureCodes.GetProcCode(procCur.CodeNum).Descript;
            double procWO      = -ClaimProcs.ProcWriteoff(listClaimProcs, procCur.ProcNum);
            double procInsPaid = -ClaimProcs.ProcInsPay(listClaimProcs, procCur.ProcNum);
            double procInsEst  = -ClaimProcs.ProcEstNotReceived(listClaimProcs, procCur.ProcNum);
            double procAdj     = listAdjustments.Sum(x => x.AdjAmt);
            double procPatPaid = -PaySplits.GetTotForProc(procCur);

            textProcFee.Text      = procCur.ProcFeeTotal.ToString("F");
            textProcWriteoff.Text = procWO == 0?"":procWO.ToString("F");
            textProcInsPaid.Text  = procInsPaid == 0?"":procInsPaid.ToString("F");
            textProcInsEst.Text   = procInsEst == 0?"":procInsEst.ToString("F");
            textProcAdj.Text      = procAdj == 0?"":procAdj.ToString("F");
            textProcPatPaid.Text  = procPatPaid == 0?"":procPatPaid.ToString("F");
            //Intelligently sum the values above based on statuses instead of blindly adding all of the values together.
            //The remaining amount is typically called the "patient portion" so utilze the centralized method that gets the patient portion.
            decimal patPort    = ClaimProcs.GetPatPortion(procCur, listClaimProcs, listAdjustments);
            double  procAdjCur = 0;

            if (textAmount.errorProvider1.GetError(textAmount) == "")
            {
                if (listTypePos.SelectedIndex > -1)              //pos
                {
                    procAdjCur = PIn.Double(textAmount.Text);
                }
                else if (listTypeNeg.SelectedIndex > -1 || Defs.GetValue(DefCat.AdjTypes, _adjustmentCur.AdjType) == "dp")           //neg or discount plan
                {
                    procAdjCur = -PIn.Double(textAmount.Text);
                }
            }
            textProcAdjCur.Text = procAdjCur == 0?"":procAdjCur.ToString("F");
            //Add the current adjustment amount to the patient portion which will give the newly calculated remaining amount.
            _adjRemAmt           = (decimal)procAdjCur + (decimal)procPatPaid + patPort;
            labelProcRemain.Text = _adjRemAmt.ToString("c");
        }
Пример #5
0
        private void FillGrid()
        {
            Recalls.Synch(PatNum);
            Recalls.SynchScheduledApptFull(PatNum);
            RecallList = Recalls.GetList(PatNum);
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn(Lan.g("TableRecallsPat", "Type"), 90);

            gridMain.ListGridColumns.Add(col);
            //col=new ODGridColumn(Lan.g("TableRecallsPat","Disabled"),60,HorizontalAlignment.Center);
            //gridMain.Columns.Add(col);
            col = new GridColumn(Lan.g("TableRecallsPat", "PreviousDate"), 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRecallsPat", "Due Date"), 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRecallsPat", "Sched Date"), 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRecallsPat", "Interval"), 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRecallsPat", "Status"), 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn(Lan.g("TableRecallsPat", "Note"), 100);
            gridMain.ListGridColumns.Add(col);
            gridMain.ListGridRows.Clear();
            GridRow  row;
            GridCell cell;

            IsPerio       = false;
            butPerio.Text = Lan.g(this, "Set Perio");
            string cellStr;

            for (int i = 0; i < RecallList.Count; i++)
            {
                if (PrefC.GetLong(PrefName.RecallTypeSpecialPerio) == RecallList[i].RecallTypeNum)
                {
                    IsPerio       = true;
                    butPerio.Text = Lan.g(this, "Set Prophy");
                }
                row = new GridRow();
                row.Cells.Add(RecallTypes.GetDescription(RecallList[i].RecallTypeNum));
                //if(RecallList[i].IsDisabled){
                //	row.Cells.Add("X");
                //}
                //else{
                //	row.Cells.Add("");
                //}
                if (RecallList[i].DatePrevious.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(RecallList[i].DatePrevious.ToShortDateString());
                }
                if (RecallList[i].DateDue.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    cell = new GridCell(RecallList[i].DateDue.ToShortDateString());
                    if (RecallList[i].DateDue < DateTime.Today)
                    {
                        cell.Bold      = YN.Yes;
                        cell.ColorText = Color.Firebrick;
                    }
                    row.Cells.Add(cell);
                }
                if (RecallList[i].DateScheduled.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(RecallList[i].DateScheduled.ToShortDateString());
                }
                row.Cells.Add(RecallList[i].RecallInterval.ToString());
                row.Cells.Add(Defs.GetValue(DefCat.RecallUnschedStatus, RecallList[i].RecallStatus));
                cellStr = "";
                if (RecallList[i].IsDisabled)
                {
                    cellStr += Lan.g(this, "Disabled");
                }
                if (RecallList[i].DisableUntilDate.Year > 1880)
                {
                    if (cellStr != "")
                    {
                        cellStr += ", ";
                    }
                    cellStr += Lan.g(this, "Disabled until ") + RecallList[i].DisableUntilDate.ToShortDateString();
                }
                if (RecallList[i].DisableUntilBalance > 0)
                {
                    if (cellStr != "")
                    {
                        cellStr += ", ";
                    }
                    cellStr += Lan.g(this, "Disabled until balance ") + RecallList[i].DisableUntilBalance.ToString("c");
                }
                if (RecallList[i].Note != "")
                {
                    if (cellStr != "")
                    {
                        cellStr += ", ";
                    }
                    cellStr += RecallList[i].Note;
                }
                row.Cells.Add(cellStr);
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }