private static void SummarizePayment(Transaction ti, OrganizationMember om, StringBuilder sb) { if ((ti.Amt ?? 0) == 0 || om == null) return; var ts = om.TransactionSummary(DbUtil.Db); if (ts != null) sb.AppendFormat(@" <tr><td colspan='2'> <table cellpadding=4> <tr> <td>Registrant Fee</td> <td>Amount Paid</td> <td>Amount Due</td> </tr> <tr> <td align='right'>{0}</td> <td align='right'>{1}</td> <td align='right'>{2}</td> </tr> </table> </td></tr> ", ts.IndAmt.ToString2("c"), om.TotalPaid(DbUtil.Db).ToString("c"), om.AmountDue(DbUtil.Db).ToString("c")); }
private void Populate() { if (dopopulate) { dopopulate = false; if (!OrgId.HasValue || !PeopleId.HasValue) return; } var i = (from mm in DbUtil.Db.OrganizationMembers where mm.OrganizationId == OrgId && mm.PeopleId == PeopleId select new { mm, mm.Person.Name, mm.Organization.OrganizationName, mm.Organization, mm.OrgMemMemTags, mm.Organization.IsMissionTrip, ts = DbUtil.Db.ViewTransactionSummaries.SingleOrDefault(tt => tt.RegId == mm.TranId && tt.PeopleId == PeopleId && tt.OrganizationId == OrgId) }).SingleOrDefault(); if (i == null) throw new Exception($"missing OrgMember at oid={OrgId}, pid={PeopleId}"); om = i.mm; TransactionSummary = i.ts; this.CopyPropertiesFrom(om); Name = i.Name; IsMissionTrip = i.IsMissionTrip ?? false; if (TransactionSummary != null) { AmountPaidTransactions = IsMissionTrip ? om.TotalPaid(DbUtil.Db) : TransactionSummary.IndPaid; AmountDue = IsMissionTrip ? om.AmountDue(DbUtil.Db) : TransactionSummary.IndDue; } OrgName = i.OrganizationName; Organization = i.Organization; OrgMemMemTags = i.OrgMemMemTags.ToList(); Setting = DbUtil.Db.CreateRegistrationSettings(OrgId ?? 0); }