private void butRun_Click(object sender, EventArgs e) { List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool(); if (splits.Count == 0) { MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check."); return; } Cursor = Cursors.WaitCursor; for (int i = 0; i < splits.Count; i++) { Claim claim = Claims.GetClaim(splits[i].ClaimNum); ClaimPayment cp = new ClaimPayment(); cp.CheckDate = claim.DateService; cp.CheckAmt = splits[i].InsPayAmt; cp.ClinicNum = claim.ClinicNum; cp.CarrierName = splits[i].Carrier; ClaimPayments.Insert(cp); List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum); for (int j = 0; j < claimP.Count; j++) { claimP[j].DateCP = claim.DateService; claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum; ClaimProcs.Update(claimP[j]); } } Cursor = Cursors.Default; MessageBox.Show(Lan.g(this, "Insurance checks created: ") + splits.Count); }
private void butDelete_Click(object sender, System.EventArgs e) { //this button is disabled if user does not have permision to edit. if (IsNew) { DialogResult = DialogResult.Cancel; //causes claimPayment to be deleted. return; } if (!MsgBox.Show(this, true, "Delete this insurance check?")) { return; } try{ ClaimPayments.Delete(ClaimPaymentCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } for (int i = 0; i < splits.Count; i++) { if (splits[i].ClaimPaymentNum == ClaimPaymentCur.ClaimPaymentNum) { SecurityLogs.MakeLogEntry(Permissions.InsPayEdit, splits[i].PatNum, "Delete for patient: " + Patients.GetLim(splits[i].PatNum).GetNameLF() + ", " + Lan.g(this, "Total Amt: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Claim Split: ") + splits[i].InsPayAmt.ToString("c")); } } DialogResult = DialogResult.OK; }
/// <summary>Deletes the selected insurance payment selected.</summary> private void deleteEOBToolStripMenuItem_Click(object sender, EventArgs e) { RpUnfinalizedInsPay.UnfinalizedInsPay unfinalPay = (RpUnfinalizedInsPay.UnfinalizedInsPay)gridMain.Rows[gridMain.SelectedIndices[0]].Tag; if (unfinalPay.ClaimPaymentCur == null) { MsgBox.Show(this, "This claim payment has been deleted."); return; } //Most likely this claim payment is marked as partial. Everyone should have permission to delete a partial payment. //Added a check to make sure user has permission and claimpayment is not partial. if (!Security.IsAuthorized(Permissions.InsPayEdit, unfinalPay.ClaimPaymentCur.CheckDate) && !unfinalPay.ClaimPaymentCur.IsPartial) { return; } if (!MsgBox.Show(this, true, "Delete this insurance check?")) { return; } try { ClaimPayments.Delete(unfinalPay.ClaimPaymentCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } LoadData(); FillGrid(); }
private void butOK_Click(object sender, System.EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "" ) { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } if (tb2.SelectedIndices.Length == 0) { MessageBox.Show(Lan.g(this, "At least one item must be selected, or use the delete button.")); return; } if (comboClinic.SelectedIndex == 0) { ClaimPaymentCur.ClinicNum = 0; } else { ClaimPaymentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } ClaimPaymentCur.CheckAmt = PIn.PDouble(textAmount.Text); ClaimPaymentCur.CheckDate = PIn.PDate(textDate.Text); ClaimPaymentCur.CheckNum = textCheckNum.Text; ClaimPaymentCur.BankBranch = textBankBranch.Text; ClaimPaymentCur.CarrierName = textCarrierName.Text; ClaimPaymentCur.Note = textNote.Text; try{ ClaimPayments.Update(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } //this could be optimized to only save changes. //Would require a starting AL to compare to. //But this isn't bad, since changes all saved at the very end ArrayList ALselected = new ArrayList(); for (int i = 0; i < tb2.SelectedIndices.Length; i++) { ALselected.Add(tb2.SelectedIndices[i]); } for (int i = 0; i < splits.Length; i++) { if (ALselected.Contains(i)) //row is selected { ClaimProcs.SetForClaim(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, true); } else //row not selected { ClaimProcs.SetForClaim(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, false); } } DialogResult = DialogResult.OK; }
private void FillGrid() { DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); long clinicNum = 0; if (comboClinic.SelectedIndex > 0) { clinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } ListClaimPay = ClaimPayments.GetForDateRange(dateFrom, dateTo, clinicNum); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g(this, "Date"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Amount"), 75, HorizontalAlignment.Right); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Partial"), 40, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Carrier"), 250); gridMain.Columns.Add(col); if (!PrefC.GetBool(PrefName.EasyNoClinics)) { col = new ODGridColumn(Lan.g(this, "Clinic"), 100); gridMain.Columns.Add(col); } col = new ODGridColumn(Lan.g(this, "Note"), 100); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < ListClaimPay.Count; i++) { row = new ODGridRow(); if (ListClaimPay[i].CheckDate.Year < 1800) { row.Cells.Add(""); } else { row.Cells.Add(ListClaimPay[i].CheckDate.ToShortDateString()); } row.Cells.Add(ListClaimPay[i].CheckAmt.ToString("c")); row.Cells.Add(ListClaimPay[i].IsPartial?"X":""); row.Cells.Add(ListClaimPay[i].CarrierName); if (!PrefC.GetBool(PrefName.EasyNoClinics)) { row.Cells.Add(Clinics.GetDesc(ListClaimPay[i].ClinicNum)); } row.Cells.Add(ListClaimPay[i].Note); gridMain.Rows.Add(row); } gridMain.EndUpdate(); gridMain.ScrollToEnd(); }
private void butRun_Click(object sender, EventArgs e) { List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool(); if (splits.Count == 0) { MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check."); DialogResult = DialogResult.OK; //Close the window because there is nothing else to do return; } Cursor = Cursors.WaitCursor; string invalidClaimDate = ""; DateTime curDate = MiscData.GetNowDateTime().Date; for (int i = 0; i < splits.Count; i++) { Claim claim = Claims.GetClaim(splits[i].ClaimNum); if (claim == null) { continue; } if (claim.DateReceived.Date > curDate && !PrefC.GetBool(PrefName.AllowFutureInsPayments) && !PrefC.GetBool(PrefName.FutureTransDatesAllowed)) { invalidClaimDate += "\r\n" + Lan.g(this, "PatNum") + " " + claim.PatNum + ", " + claim.DateService.ToShortDateString(); continue; } ClaimPayment cp = new ClaimPayment(); cp.CheckDate = claim.DateReceived; cp.CheckAmt = splits[i].InsPayAmt; cp.ClinicNum = claim.ClinicNum; cp.CarrierName = splits[i].Carrier; cp.PayType = Defs.GetFirstForCategory(DefCat.InsurancePaymentType, true).DefNum; ClaimPayments.Insert(cp); List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum); for (int j = 0; j < claimP.Count; j++) { if (claimP[j].ClaimPaymentNum != 0 || claimP[j].InsPayAmt == 0) //If claimpayment already attached to claimproc or ins didn't pay. { continue; //Do not change } claimP[j].DateCP = claim.DateReceived; claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum; ClaimProcs.Update(claimP[j]); } } Cursor = Cursors.Default; if (invalidClaimDate != "") { invalidClaimDate = "\r\n" + Lan.g(this, "Cannot make future-dated insurance payments for these claims:") + invalidClaimDate; } MsgBoxCopyPaste messageBox = new MsgBoxCopyPaste(Lan.g(this, "Insurance checks created:") + " " + splits.Count + invalidClaimDate); messageBox.Show(); DialogResult = DialogResult.OK; //Close the window because there is nothing else to do }
private void FormClaimPayEdit_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) //cancel //ClaimProcs never saved in the first place { ClaimPayments.Delete(ClaimPaymentCur); } }
/// <summary>Creates a check for the claim selected. Copied logic from FormClaimEdit.cs</summary> private void createCheckToolStripMenuItem_Click(object sender, EventArgs e) { if (!Security.IsAuthorized(Permissions.InsPayCreate)) //date not checked here, but it will be checked when saving the check to prevent backdating { return; } if (PrefC.GetBool(PrefName.ClaimPaymentBatchOnly)) { //Is there a permission in the manage module that would block this behavior? Are we sending the user into a TRAP?! MsgBox.Show(this, "Please use Batch Insurance in Manage Module to Finalize Payments."); return; } RpUnfinalizedInsPay.UnfinalizedInsPay unfinalPay = (RpUnfinalizedInsPay.UnfinalizedInsPay)gridMain.ListGridRows[gridMain.SelectedIndices[0]].Tag; if (unfinalPay.ClaimCur == null) { MsgBox.Show(this, "Unable to find claim for this partial payment."); return; } List <ClaimProc> listClaimProcForClaim = ClaimProcs.RefreshForClaim(unfinalPay.ClaimCur.ClaimNum); if (!listClaimProcForClaim.Any(x => x.Status.In(ClaimProcs.GetInsPaidStatuses()))) { MessageBox.Show(Lan.g(this, "There are no valid received payments for this claim.")); return; } ClaimPayment claimPayment = new ClaimPayment(); claimPayment.CheckDate = MiscData.GetNowDateTime().Date; //Today's date for easier tracking by the office and to avoid backdating before accounting lock dates. claimPayment.IsPartial = true; claimPayment.ClinicNum = unfinalPay.ClinicCur.ClinicNum; Family famCur = Patients.GetFamily(unfinalPay.PatientCur.PatNum); List <InsSub> listInsSub = InsSubs.RefreshForFam(famCur); List <InsPlan> listInsPlan = InsPlans.RefreshForSubList(listInsSub); claimPayment.CarrierName = Carriers.GetName(InsPlans.GetPlan(unfinalPay.ClaimCur.PlanNum, listInsPlan).CarrierNum); ClaimPayments.Insert(claimPayment); double amt = ClaimProcs.AttachAllOutstandingToPayment(claimPayment.ClaimPaymentNum, PrefC.DateClaimReceivedAfter); claimPayment.CheckAmt = amt; try { ClaimPayments.Update(claimPayment); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } FormClaimEdit.FormFinalizePaymentHelper(claimPayment, unfinalPay.ClaimCur, unfinalPay.PatientCur, famCur); LoadData(); FillGrid(); }
private void butDelete_Click(object sender, System.EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; return; } if (MessageBox.Show(Lan.g(this, "Delete this insurance check?"), "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } try{ ClaimPayments.Delete(ClaimPaymentCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date first."); return; } if (PIn.Date(textDate.Text).Date > DateTime.Today.Date && !PrefC.GetBool(PrefName.FutureTransDatesAllowed) && !PrefC.GetBool(PrefName.AllowFutureInsPayments)) { MsgBox.Show(this, "Payments cannot be for a date in the future."); return; //probably not necesasary since this is an old form, but just in case we use it again } if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (gridMain.SelectedIndices.Length == 0) { MessageBox.Show(Lan.g(this, "At least one item must be selected, or use the delete button.")); return; } if (IsNew) { //prevents backdating of initial check if (!Security.IsAuthorized(Permissions.InsPayCreate, PIn.Date(textDate.Text))) { return; } //prevents attaching claimprocs with a date that is older than allowed by security. } 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.InsPayEdit, PIn.Date(textDate.Text))) { return; } } if (comboClinic.SelectedIndex == 0) { ClaimPaymentCur.ClinicNum = 0; } else { ClaimPaymentCur.ClinicNum = _listClinics[comboClinic.SelectedIndex - 1].ClinicNum; } ClaimPaymentCur.CheckAmt = PIn.Double(textAmount.Text); ClaimPaymentCur.CheckDate = PIn.Date(textDate.Text); ClaimPaymentCur.CheckNum = textCheckNum.Text; ClaimPaymentCur.BankBranch = textBankBranch.Text; ClaimPaymentCur.CarrierName = textCarrierName.Text; ClaimPaymentCur.Note = textNote.Text; try{ ClaimPayments.Update(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } //this could be optimized to only save changes. //Would require a starting list to compare to. //But this isn't bad, since changes all saved at the very end List <int> selectedRows = new List <int>(); for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { selectedRows.Add(gridMain.SelectedIndices[i]); } for (int i = 0; i < splits.Count; i++) { if (selectedRows.Contains(i)) //row is selected { ClaimProcs.SetForClaimOld(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, true); //Audit trail isn't perfect, since it doesn't make an entry if you remove a claim from a payment. //And it always makes more audit trail entries when you click OK, even if you didn't actually attach new claims. //But since this will cover the vast majority if situations. if (IsNew) { SecurityLogs.MakeLogEntry(Permissions.InsPayCreate, splits[i].PatNum, Patients.GetLim(splits[i].PatNum).GetNameLF() + ", " + Lan.g(this, "Total Amt: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Claim Split: ") + splits[i].InsPayAmt.ToString("c")); } else { SecurityLogs.MakeLogEntry(Permissions.InsPayEdit, splits[i].PatNum, Patients.GetLim(splits[i].PatNum).GetNameLF() + ", " + Lan.g(this, "Total Amt: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Claim Split: ") + splits[i].InsPayAmt.ToString("c")); } } else //row not selected //If user had not been attaching their inspayments to checks, then this will cause such payments to annoyingly have their //date changed to the current date. This prompts them to call us. Then, we tell them to attach to checks. { ClaimProcs.SetForClaimOld(splits[i].ClaimNum, ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate, false); } } DialogResult = DialogResult.OK; }
///<summary>Fills grid based on values in _listEtrans. ///Set isRefreshNeeded to true when we need to reinitialize local dictionarys after in memory list is also updated. Required true for first time running. ///Also allows you to passed in predetermined filter options.</summary> private void FillGrid(bool isRefreshNeeded, List <string> listSelectedStatuses, List <long> listSelectedClinicNums, string carrierName, string checkTraceNum, string amountMin, string amountMax) { Action actionCloseProgress = null; if (isRefreshNeeded) { actionCloseProgress = ODProgressOld.ShowProgressStatus("Etrans835", this, Lan.g(this, "Gathering data") + "...", false); _dictEtrans835s.Clear(); _dictEtransClaims.Clear(); _dictClaimPayExists.Clear(); List <Etrans835Attach> listAttached = Etrans835Attaches.GetForEtrans(_listEtranss.Select(x => x.EtransNum).ToArray()); Dictionary <long, string> dictEtransMessages = new Dictionary <long, string>(); List <X12ClaimMatch> list835ClaimMatches = new List <X12ClaimMatch>(); Dictionary <long, int> dictClaimMatchCount = new Dictionary <long, int>(); //1:1 with _listEtranss. Stores how many claim matches each 835 has. int batchQueryInterval = 500; //Every 500 rows we get the next 500 message texts to save memory. int rowCur = 0; foreach (Etrans etrans in _listEtranss) { if (rowCur % batchQueryInterval == 0) { int range = Math.Min(batchQueryInterval, _listEtranss.Count - rowCur); //Either the full batchQueryInterval amount or the remaining amount of etrans. dictEtransMessages = EtransMessageTexts.GetMessageTexts(_listEtranss.GetRange(rowCur, range).Select(x => x.EtransMessageTextNum).ToList(), false); } rowCur++; ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Processing 835: ") + ": " + rowCur + " out of " + _listEtranss.Count)); List <Etrans835Attach> listAttachedTo835 = listAttached.FindAll(x => x.EtransNum == etrans.EtransNum); X835 x835 = new X835(etrans, dictEtransMessages[etrans.EtransMessageTextNum], etrans.TranSetId835, listAttachedTo835, true); _dictEtrans835s.Add(etrans.EtransNum, x835); List <X12ClaimMatch> listClaimMatches = x835.GetClaimMatches(); dictClaimMatchCount.Add(etrans.EtransNum, listClaimMatches.Count); list835ClaimMatches.AddRange(listClaimMatches); } #region Set 835 unattached in batch and build _dictEtransClaims and _dictClaimPayCheckNums. ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Gathering internal claim matches."))); List <long> listClaimNums = Claims.GetClaimFromX12(list835ClaimMatches); //Can return null. ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Building data sets."))); int claimIndexCur = 0; List <long> listMatchedClaimNums = new List <long>(); foreach (Etrans etrans in _listEtranss) { X835 x835 = _dictEtrans835s[etrans.EtransNum]; if (listClaimNums != null) { x835.SetClaimNumsForUnattached(listClaimNums.GetRange(claimIndexCur, dictClaimMatchCount[etrans.EtransNum])); } claimIndexCur += dictClaimMatchCount[etrans.EtransNum]; listMatchedClaimNums.AddRange(x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(x => x.ClaimNum).ToList()); } List <Claim> listClaims = Claims.GetClaimsFromClaimNums(listMatchedClaimNums.Distinct().ToList()); _dictClaimPayExists = ClaimPayments.HasClaimPayment(listMatchedClaimNums); //Every claim num is associated to a bool. True when there is an existing claimPayment. foreach (Etrans etrans in _listEtranss) { X835 x835 = _dictEtrans835s[etrans.EtransNum]; #region _dictEtransClaims, _dictClaimPayCheckNums _dictEtransClaims.Add(etrans.EtransNum, new List <Claim>()); List <long> listSubClaimNums = x835.ListClaimsPaid.FindAll(x => x.ClaimNum != 0).Select(y => y.ClaimNum).ToList(); List <Claim> listClaimsFor835 = listClaims.FindAll(x => listSubClaimNums.Contains(x.ClaimNum)); foreach (Hx835_Claim claim in x835.ListClaimsPaid) { Claim claimCur = listClaimsFor835.FirstOrDefault(x => x.ClaimNum == claim.ClaimNum); //Can be null. if (claimCur == null && claim.IsAttachedToClaim && claim.ClaimNum == 0) { claimCur = new Claim(); //Create empty claim since user detached claim manually, will not be considered in GetStringStatus(...). } if (claimCur != null && claim.IsPreauth) //User attached preauth to internal claim, no payment needed to be considered 'Finalized' in GetStringStatus(...). { _dictClaimPayExists[claim.ClaimNum] = true; } _dictEtransClaims[etrans.EtransNum].Add(claimCur); } #endregion } ODEvent.Fire(new ODEventArgs("Etrans835", Lan.g(this, "Filling Grid."))); #endregion } gridMain.BeginUpdate(); #region Initilize columns only once if (gridMain.Columns.Count == 0) { ODGridColumn col; col = new ODGridColumn(Lan.g("TableEtrans835s", "Patient Name"), 250); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableEtrans835s", "Carrier Name"), 190); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableEtrans835s", "Status"), 80); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableEtrans835s", "Date"), 80); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableEtrans835s", "Amount"), 80); gridMain.Columns.Add(col); if (PrefC.HasClinicsEnabled) { col = new ODGridColumn(Lan.g("TableEtrans835s", "Clinic"), 70); gridMain.Columns.Add(col); } col = new ODGridColumn(Lan.g("TableEtrans835s", "Code"), 37, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableEtrans835s", "Note"), 0); gridMain.Columns.Add(col); } #endregion gridMain.Rows.Clear(); foreach (Etrans etrans in _listEtranss) { X835 x835 = _dictEtrans835s[etrans.EtransNum]; #region Filter: Carrier Name if (carrierName != "" && !x835.PayerName.ToLower().Contains(carrierName.ToLower())) { continue; } #endregion string status = GetStringStatus(etrans.EtransNum); #region Filter: Status if (!listSelectedStatuses.Contains(status.Replace("*", ""))) //The filter will ignore finalized with detached claims. { continue; } #endregion //List of ClinicNums for the current etrans.ListClaimsPaid from the DB. List <long> listClinicNums = _dictEtransClaims[etrans.EtransNum].Select(x => x == null? 0 :x.ClinicNum).Distinct().ToList(); #region Filter: Clinics if (PrefC.HasClinicsEnabled && !listClinicNums.Exists(x => listSelectedClinicNums.Contains(x))) { continue; //The ClinicNums associated to the 835 do not match any of the selected ClinicNums, so nothing to show in this 835. } #endregion #region Filter: Check and Trace Value if (checkTraceNum != "" && !x835.TransRefNum.Contains(checkTraceNum)) //Trace Number does not match { continue; } #endregion #region Filter: Insurance Check Range Min and Max if (amountMin != "" && x835.InsPaid < PIn.Decimal(amountMin) || amountMax != "" && x835.InsPaid > PIn.Decimal(amountMax)) { continue; //Either the InsPaid is below or above our range. } #endregion ODGridRow row = new ODGridRow(); #region Column: Patient Name List <string> listPatNames = x835.ListClaimsPaid.Select(x => x.PatientName.ToString()).Distinct().ToList(); string patName = (listPatNames.Count > 0 ? listPatNames[0] : ""); if (listPatNames.Count > 1) { patName = "(" + POut.Long(listPatNames.Count) + ")"; } row.Cells.Add(patName); #endregion row.Cells.Add(x835.PayerName); row.Cells.Add(status); //See GetStringStatus(...) for possible values. row.Cells.Add(POut.Date(etrans.DateTimeTrans)); row.Cells.Add(POut.Decimal(x835.InsPaid)); #region Column: Clinic if (PrefC.HasClinicsEnabled) { string clinicAbbr = ""; if (listClinicNums.Count == 1) { if (listClinicNums[0] == 0) { clinicAbbr = Lan.g(this, "Unassigned"); } else { clinicAbbr = Clinics.GetAbbr(listClinicNums[0]); } } else if (listClinicNums.Count > 1) { clinicAbbr = "(" + Lan.g(this, "Multiple") + ")"; } row.Cells.Add(clinicAbbr); } #endregion row.Cells.Add(x835._paymentMethodCode); row.Cells.Add(etrans.Note); row.Tag = etrans; gridMain.Rows.Add(row); } gridMain.EndUpdate(); actionCloseProgress?.Invoke(); }
///<summary>Saves the selected rows to database. MUST close window after this.</summary> private bool SaveToDB() { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return(false); } //Prevent backdating---------------------------------------------------------------------------------------- DateTime date = PIn.PDate(textDate.Text); if (IsNew) { if (!Security.IsAuthorized(Permissions.DepositSlips, date)) { return(false); } } else { //We enforce security here based on date displayed, not date entered if (!Security.IsAuthorized(Permissions.DepositSlips, date)) { return(false); } } DepositCur.DateDeposit = PIn.PDate(textDate.Text); //amount already handled. DepositCur.BankAccountInfo = PIn.PString(textBankAccountInfo.Text); if (IsNew) { Deposits.Insert(DepositCur); if (Accounts.DepositsLinked() && DepositCur.Amount > 0) { //create a transaction here Transaction trans = new Transaction(); trans.DepositNum = DepositCur.DepositNum; trans.UserNum = Security.CurUser.UserNum; Transactions.Insert(trans); //first the deposit entry JournalEntry je = new JournalEntry(); je.AccountNum = DepositAccounts[comboDepositAccount.SelectedIndex]; je.CheckNumber = Lan.g(this, "DEP"); je.DateDisplayed = DepositCur.DateDeposit; //it would be nice to add security here. je.DebitAmt = DepositCur.Amount; je.Memo = Lan.g(this, "Deposit"); je.Splits = Accounts.GetDescript(PrefB.GetInt("AccountingIncomeAccount")); je.TransactionNum = trans.TransactionNum; JournalEntries.Insert(je); //then, the income entry je = new JournalEntry(); je.AccountNum = PrefB.GetInt("AccountingIncomeAccount"); //je.CheckNumber=; je.DateDisplayed = DepositCur.DateDeposit; //it would be nice to add security here. je.CreditAmt = DepositCur.Amount; je.Memo = Lan.g(this, "Deposit"); je.Splits = Accounts.GetDescript(DepositAccounts[comboDepositAccount.SelectedIndex]); je.TransactionNum = trans.TransactionNum; JournalEntries.Insert(je); } } else { Deposits.Update(DepositCur); } if (IsNew) //never allowed to change or attach more checks after initial creation of deposit slip { for (int i = 0; i < gridPat.SelectedIndices.Length; i++) { PatPayList[gridPat.SelectedIndices[i]].DepositNum = DepositCur.DepositNum; Payments.Update(PatPayList[gridPat.SelectedIndices[i]]); } for (int i = 0; i < gridIns.SelectedIndices.Length; i++) { ClaimPayList[gridIns.SelectedIndices[i]].DepositNum = DepositCur.DepositNum; ClaimPayments.Update(ClaimPayList[gridIns.SelectedIndices[i]]); } } if (IsNew) { SecurityLogs.MakeLogEntry(Permissions.DepositSlips, 0, DepositCur.DateDeposit.ToShortDateString() + " New " + DepositCur.Amount.ToString("c")); } else { SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, 0, DepositCur.DateDeposit.ToShortDateString() + " " + DepositCur.Amount.ToString("c")); } return(true); }
private void butOK_Click(object sender, System.EventArgs e) { if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date."); return; } if (textCarrierName.Text == "") { MsgBox.Show(this, "Please enter a carrier."); return; } if (textDate.errorProvider1.GetError(textDate) != "" || textAmount.errorProvider1.GetError(textAmount) != "" || textDateIssued.errorProvider1.GetError(textDateIssued) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (PIn.Double(textAmount.Text) == 0) { MsgBox.Show(this, "Please enter an amount."); return; } if (IsNew) { //prevents backdating of initial check if (!Security.IsAuthorized(Permissions.InsPayCreate, PIn.Date(textDate.Text))) { return; } //prevents attaching claimprocs with a date that is older than allowed by security. } 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.InsPayEdit, PIn.Date(textDate.Text))) { return; } } if (!PrefC.GetBool(PrefName.EasyNoClinics)) { if (comboClinic.SelectedIndex == 0) { ClaimPaymentCur.ClinicNum = 0; } else { ClaimPaymentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } } ClaimPaymentCur.CheckDate = PIn.Date(textDate.Text); ClaimPaymentCur.DateIssued = PIn.Date(textDateIssued.Text); ClaimPaymentCur.CheckAmt = PIn.Double(textAmount.Text); ClaimPaymentCur.CheckNum = textCheckNum.Text; ClaimPaymentCur.BankBranch = textBankBranch.Text; ClaimPaymentCur.CarrierName = textCarrierName.Text; ClaimPaymentCur.Note = textNote.Text; try{ if (IsNew) { ClaimPayments.Insert(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. } else { ClaimPayments.Update(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. } } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } ClaimProcs.SynchDateCP(ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate); DialogResult = DialogResult.OK; }
private void butPrint_Click(object sender, System.EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (IsNew) { if (!SaveToDB()) { return; } } else //not new //Only allowed to change date and bank account info, NOT attached checks. //We enforce security here based on date displayed, not date entered. //If user is trying to change date without permission: { DateTime date = PIn.PDate(textDate.Text); if (Security.IsAuthorized(Permissions.DepositSlips, date, true)) { if (!SaveToDB()) { return; } } //if security.NotAuthorized, then it simply skips the save process before printing } //refresh the lists because some items may not be highlighted PatPayList = Payments.GetForDeposit(DepositCur.DepositNum); ClaimPayList = ClaimPayments.GetForDeposit(DepositCur.DepositNum); Queries.TableQ = new DataTable(); for (int i = 0; i < 5; i++) //add 5 columns { Queries.TableQ.Columns.Add(new System.Data.DataColumn()); //blank columns } Queries.CurReport = new ReportOld(); Queries.CurReport.ColTotal = new double[Queries.TableQ.Columns.Count]; DataRow row; ArrayList patNumAL = new ArrayList(); for (int i = 0; i < PatPayList.Length; i++) { patNumAL.Add(PatPayList[i].PatNum); } int[] patNums = new int[patNumAL.Count]; patNumAL.CopyTo(patNums); Patient[] pats = Patients.GetMultPats(patNums); for (int i = 0; i < PatPayList.Length; i++) { row = Queries.TableQ.NewRow(); row[0] = PatPayList[i].PayDate.ToShortDateString(); row[1] = Patients.GetOnePat(pats, PatPayList[i].PatNum).GetNameLF(); row[2] = PatPayList[i].CheckNum; row[3] = PatPayList[i].BankBranch; row[4] = PatPayList[i].PayAmt.ToString("F"); Queries.TableQ.Rows.Add(row); Queries.CurReport.ColTotal[4] += PatPayList[i].PayAmt; } for (int i = 0; i < ClaimPayList.Length; i++) { row = Queries.TableQ.NewRow(); row[0] = ClaimPayList[i].CheckDate.ToShortDateString(); row[1] = ClaimPayList[i].CarrierName; row[2] = ClaimPayList[i].CheckNum; row[3] = ClaimPayList[i].BankBranch; row[4] = ClaimPayList[i].CheckAmt.ToString("F"); Queries.TableQ.Rows.Add(row); Queries.CurReport.ColTotal[4] += ClaimPayList[i].CheckAmt; } //done filling now set up table Queries.CurReport.ColWidth = new int[Queries.TableQ.Columns.Count]; Queries.CurReport.ColPos = new int[Queries.TableQ.Columns.Count + 1]; Queries.CurReport.ColPos[0] = 0; Queries.CurReport.ColCaption = new string[Queries.TableQ.Columns.Count]; Queries.CurReport.ColAlign = new HorizontalAlignment[Queries.TableQ.Columns.Count]; FormQuery FormQuery2 = new FormQuery(); FormQuery2.IsReport = true; FormQuery2.ResetGrid(); //necessary won't work without Queries.CurReport.Title = "Deposit Slip"; Queries.CurReport.SubTitle = new string[2]; Queries.CurReport.SubTitle[0] = ((Pref)PrefB.HList["PracticeTitle"]).ValueString; Queries.CurReport.SubTitle[1] = DepositCur.DateDeposit.ToShortDateString(); Queries.CurReport.Summary = new string[1]; Queries.CurReport.Summary[0] = DepositCur.BankAccountInfo; Queries.CurReport.ColPos[0] = 20; Queries.CurReport.ColPos[1] = 110; Queries.CurReport.ColPos[2] = 260; Queries.CurReport.ColPos[3] = 350; Queries.CurReport.ColPos[4] = 440; Queries.CurReport.ColPos[5] = 530; Queries.CurReport.ColCaption[0] = "Date"; Queries.CurReport.ColCaption[1] = "Name"; Queries.CurReport.ColCaption[2] = "Check Number"; Queries.CurReport.ColCaption[3] = "Bank-Branch"; Queries.CurReport.ColCaption[4] = "Amount"; Queries.CurReport.ColAlign[4] = HorizontalAlignment.Right; FormQuery2.ShowDialog(); DialogResult = DialogResult.OK; //this is imporant, since we don't want to insert the deposit slip twice. }
///<summary></summary> private void FillGrids() { if (IsNew) { DateTime dateStart = PIn.PDate(textDateStart.Text); int clinicNum = 0; if (comboClinic.SelectedIndex != 0) { clinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } int[] payTypes = new int[listPayType.SelectedIndices.Count]; for (int i = 0; i < payTypes.Length; i++) { payTypes[i] = DefB.Short[(int)DefCat.PaymentTypes][listPayType.SelectedIndices[i]].DefNum; } PatPayList = Payments.GetForDeposit(dateStart, clinicNum, payTypes); ClaimPayList = ClaimPayments.GetForDeposit(dateStart, clinicNum); } else { PatPayList = Payments.GetForDeposit(DepositCur.DepositNum); ClaimPayList = ClaimPayments.GetForDeposit(DepositCur.DepositNum); } //Fill Patient Payment Grid--------------------------------------- ArrayList patNumAL = new ArrayList(); for (int i = 0; i < PatPayList.Length; i++) { patNumAL.Add(PatPayList[i].PatNum); } int[] patNums = new int[patNumAL.Count]; patNumAL.CopyTo(patNums); Patient[] pats = Patients.GetMultPats(patNums); gridPat.BeginUpdate(); gridPat.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Date"), 80); gridPat.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Patient"), 130); gridPat.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Type"), 90); gridPat.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Check Number"), 95); gridPat.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Bank-Branch"), 80); gridPat.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipPat", "Amount"), 80); gridPat.Columns.Add(col); gridPat.Rows.Clear(); OpenDental.UI.ODGridRow row; for (int i = 0; i < PatPayList.Length; i++) { row = new OpenDental.UI.ODGridRow(); row.Cells.Add(PatPayList[i].PayDate.ToShortDateString()); row.Cells.Add(Patients.GetOnePat(pats, PatPayList[i].PatNum).GetNameLF()); row.Cells.Add(DefB.GetName(DefCat.PaymentTypes, PatPayList[i].PayType)); row.Cells.Add(PatPayList[i].CheckNum); row.Cells.Add(PatPayList[i].BankBranch); row.Cells.Add(PatPayList[i].PayAmt.ToString("F")); gridPat.Rows.Add(row); } gridPat.EndUpdate(); //Fill Insurance Payment Grid------------------------------------- gridIns.BeginUpdate(); gridIns.Columns.Clear(); col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Date"), 80); gridIns.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Carrier"), 220); gridIns.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Check Number"), 95); gridIns.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Bank-Branch"), 80); gridIns.Columns.Add(col); col = new ODGridColumn(Lan.g("TableDepositSlipIns", "Amount"), 90); gridIns.Columns.Add(col); gridIns.Rows.Clear(); for (int i = 0; i < ClaimPayList.Length; i++) { row = new OpenDental.UI.ODGridRow(); row.Cells.Add(ClaimPayList[i].CheckDate.ToShortDateString()); row.Cells.Add(ClaimPayList[i].CarrierName); row.Cells.Add(ClaimPayList[i].CheckNum); row.Cells.Add(ClaimPayList[i].BankBranch); row.Cells.Add(ClaimPayList[i].CheckAmt.ToString("F")); gridIns.Rows.Add(row); } gridIns.EndUpdate(); }
///<summary>Saves the selected rows to database. MUST close window after this.</summary> private bool SaveToDB() { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return(false); } //Prevent backdating---------------------------------------------------------------------------------------- DateTime date = PIn.Date(textDate.Text); if (IsNew) { if (!Security.IsAuthorized(Permissions.DepositSlips, date)) { return(false); } } else { //We enforce security here based on date displayed, not date entered if (!Security.IsAuthorized(Permissions.DepositSlips, date)) { return(false); } } DepositCur.DateDeposit = PIn.Date(textDate.Text); //amount already handled. DepositCur.BankAccountInfo = PIn.String(textBankAccountInfo.Text); if (IsNew) { if (gridPat.SelectedIndices.Length + gridIns.SelectedIndices.Length > 18) { if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "No more than 18 items will fit on a QuickBooks deposit slip. Continue anyway?")) { return(false); } } Deposits.Insert(DepositCur); if (Accounts.DepositsLinked() && DepositCur.Amount > 0) { if (PrefC.GetInt(PrefName.AccountingSoftware) == (int)AccountingSoftware.QuickBooks) { //Create a deposit within QuickBooks. try { Cursor.Current = Cursors.WaitCursor; QuickBooks.CreateDeposit(DepositAccountsQB[comboDepositAccount.SelectedIndex] , PrefC.GetString(PrefName.QuickBooksIncomeAccount), DepositCur.Amount); Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; if (MessageBox.Show(ex.Message + "\r\n\r\nA deposit has not been created in QuickBooks, continue anyway?", "QuickBooks Deposit Create Failed", MessageBoxButtons.YesNo) != DialogResult.Yes) { return(false); } } } else { //create a transaction here Transaction trans = new Transaction(); trans.DepositNum = DepositCur.DepositNum; trans.UserNum = Security.CurUser.UserNum; Transactions.Insert(trans); //first the deposit entry JournalEntry je = new JournalEntry(); je.AccountNum = DepositAccounts[comboDepositAccount.SelectedIndex]; je.CheckNumber = Lan.g(this, "DEP"); je.DateDisplayed = DepositCur.DateDeposit; //it would be nice to add security here. je.DebitAmt = DepositCur.Amount; je.Memo = Lan.g(this, "Deposit"); je.Splits = Accounts.GetDescript(PrefC.GetLong(PrefName.AccountingIncomeAccount)); je.TransactionNum = trans.TransactionNum; JournalEntries.Insert(je); //then, the income entry je = new JournalEntry(); je.AccountNum = PrefC.GetLong(PrefName.AccountingIncomeAccount); //je.CheckNumber=; je.DateDisplayed = DepositCur.DateDeposit; //it would be nice to add security here. je.CreditAmt = DepositCur.Amount; je.Memo = Lan.g(this, "Deposit"); je.Splits = Accounts.GetDescript(DepositAccounts[comboDepositAccount.SelectedIndex]); je.TransactionNum = trans.TransactionNum; JournalEntries.Insert(je); } } } else { Deposits.Update(DepositCur); } if (IsNew) //never allowed to change or attach more checks after initial creation of deposit slip { for (int i = 0; i < gridPat.SelectedIndices.Length; i++) { PatPayList[gridPat.SelectedIndices[i]].DepositNum = DepositCur.DepositNum; Payments.Update(PatPayList[gridPat.SelectedIndices[i]], false); } for (int i = 0; i < gridIns.SelectedIndices.Length; i++) { ClaimPayList[gridIns.SelectedIndices[i]].DepositNum = DepositCur.DepositNum; ClaimPayments.Update(ClaimPayList[gridIns.SelectedIndices[i]]); } } if (IsNew) { SecurityLogs.MakeLogEntry(Permissions.DepositSlips, 0, DepositCur.DateDeposit.ToShortDateString() + " New " + DepositCur.Amount.ToString("c")); } else { SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, 0, DepositCur.DateDeposit.ToShortDateString() + " " + DepositCur.Amount.ToString("c")); } return(true); }
private void FormReportsMore_Load(object sender, EventArgs e) { butPW.Visible = Programs.IsEnabled(ProgramName.PracticeWebReports); listProdInc.Items.AddRange(new string[] { Lan.g(this, "Today"), Lan.g(this, "Yesterday"), Lan.g(this, "This Month"), Lan.g(this, "Last Month"), Lan.g(this, "This Year"), Lan.g(this, "More Options") }); listDaily.Items.AddRange(new string[] { Lan.g(this, "Adjustments"), Lan.g(this, "Payments"), Lan.g(this, "Procedures"), Lan.g(this, "Writeoffs"), Lan.g(this, "Incomplete Procedure Notes"), Lan.g(this, "Routing Slips") }); listMonthly.Items.AddRange(new string[] { Lan.g(this, "Aging Report"), Lan.g(this, "Claims Not Sent"), Lan.g(this, "Capitation Utilization"), Lan.g(this, "Finance Charge Report"), Lan.g(this, "Outstanding Insurance Claims"), Lan.g(this, "Procedures Not Billed to Insurance"), Lan.g(this, "PPO Writeoffs"), Lan.g(this, "Payment Plans"), Lan.g(this, "Receivable Breakdown"), Lan.g(this, "Unearned Income"), Lan.g(this, "Insurance Overpaid"), }); listLists.Items.AddRange(new string[] { Lan.g(this, "Appointments"), Lan.g(this, "Birthdays"), Lan.g(this, "Insurance Plans"), Lan.g(this, "New Patients"), Lan.g(this, "Patients - Raw"), Lan.g(this, "Patients Notes"), Lan.g(this, "Prescriptions"), Lan.g(this, "Procedure Codes"), Lan.g(this, "Referrals - Raw"), Lan.g(this, "Referral Analysis"), Lan.g(this, "Referred Proc Tracking"), Lan.g(this, "Treatment Finder") //Lan.g(this,"Treatment Plan Manager")//js too buggy }); listPublicHealth.Items.AddRange(new string[] { Lan.g(this, "Raw Screening Data"), Lan.g(this, "Raw Population Data") }); listArizonaPrimaryCare.Items.AddRange(new string[] { Lan.g(this, "Eligibility File"), Lan.g(this, "Encounter File") }); //Arizona primary care list and label must only be visible when the Arizona primary //care option is checked in the miscellaneous options. if (UsingArizonaPrimaryCare()) { labelArizonaPrimaryCare.Visible = true; listArizonaPrimaryCare.Visible = true; } //Notify user if partial batch ins payments exist. List <ClaimPayment> listClaimPay = ClaimPayments.GetForDateRange(DateTime.Now.AddMonths(-1), DateTime.Now, 0); for (int i = 0; i < listClaimPay.Count; i++) { if (listClaimPay[i].IsPartial) { MsgBox.Show(this, "Reports will not be accurate until partial insurance payments are completed."); break; } } }
private void FillGrid() { DateTime dateFrom = PIn.Date(textDateFrom.Text); DateTime dateTo = PIn.Date(textDateTo.Text); long clinicNum = 0; if (comboClinic.SelectedIndex > 0) { clinicNum = _listClinics[comboClinic.SelectedIndex - 1].ClinicNum; } long selectedGroupNum = 0; if (comboPayGroup.SelectedIndex != 0) { selectedGroupNum = _listCPGroups[comboPayGroup.SelectedIndex - 1].DefNum; } DataTable tableClaimPayments = ClaimPayments.GetForDateRange(dateFrom, dateTo, clinicNum, selectedGroupNum); ListClaimPay = ClaimPaymentCrud.TableToList(tableClaimPayments); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g(this, "Date"), 65); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Type"), 70); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Amount"), 75, HorizontalAlignment.Right); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Partial"), 40, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Carrier"), 180); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "PayGroup"), 80); gridMain.ListGridColumns.Add(col); if (PrefC.HasClinicsEnabled) { col = new GridColumn(Lan.g(this, "Clinic"), 80); gridMain.ListGridColumns.Add(col); } col = new GridColumn(Lan.g(this, "Note"), 180); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g(this, "Scanned"), 40, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; for (int i = 0; i < ListClaimPay.Count; i++) { row = new GridRow(); if (ListClaimPay[i].CheckDate.Year < 1800) { row.Cells.Add(""); } else { row.Cells.Add(ListClaimPay[i].CheckDate.ToShortDateString()); } row.Cells.Add(Defs.GetName(DefCat.InsurancePaymentType, ListClaimPay[i].PayType)); row.Cells.Add(ListClaimPay[i].CheckAmt.ToString("c")); row.Cells.Add(ListClaimPay[i].IsPartial?"X":""); row.Cells.Add(ListClaimPay[i].CarrierName); row.Cells.Add(Defs.GetName(DefCat.ClaimPaymentGroups, ListClaimPay[i].PayGroup)); if (PrefC.HasClinicsEnabled) { row.Cells.Add(Clinics.GetAbbr(ListClaimPay[i].ClinicNum)); } row.Cells.Add(ListClaimPay[i].Note); row.Cells.Add((tableClaimPayments.Rows[i]["hasEobAttach"].ToString() == "1")?"X":""); gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); gridMain.ScrollToEnd(); }