/// <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(); }