private void writeContributions(ContributorInfo c) { string hdrContributions = " Date Fund Name Amount Date Fund Name Amount\n\n"; rWrite(hdrContributions); var q2 = APIContribution.contributions(Db, c, fd, td); var contrib = new List <string>(); foreach (var ci in q2) { contrib.Add("{0:MM/dd/yyyy} {1,-16}{2,11:N2}" .Fmt(ci.ContributionDate, ci.Fund, ci.ContributionAmount)); } var n = contrib.Count; var nrows = n / 32 * 16; var remainder = n % 32; if (remainder < 16) { nrows += remainder; } else { nrows += 16; } int row, c1; for (row = 0, c1 = 0; row < nrows; row++, c1++) { if (row % 16 == 0) { c1 = row * 2; } var line = contrib[c1]; var c2 = c1 + 16; if (c2 < n) { line += " " + contrib[c2]; } if (row > 0 && row % 16 == 0) { pageStatement += 1; writeHeader(c); rWrite(hdrContributions); rWrite("\n"); } rWrite(line + "\n"); } if (nrows > 0) { rWrite("\n"); } }
private void writeSummary(ContributorInfo c) { string hdr1Pledge = " Pledge History Current Year Summary ({0:MM/dd/yyyy})\n".Fmt(td); string hdr2Pledge = " Fund Name Pledge Given Fund Name Amount This Year\n\n"; var recPledges = new List <string>(); decimal Total = 0; rWrite(hdr1Pledge + hdr2Pledge); foreach (var p in APIContribution.pledges(Db, c, td)) { if (p.Fund != null) { recPledges.Add("{0,-16}{1,12:N2} {2,12:N2} ".Fmt(p.Fund, p.PledgeAmount, p.ContributionAmount)); } } foreach (var ci in APIContribution.quarterlySummary(Db, c, fd, td)) { Total += ci.ContributionAmount.Value; if (recPledges != null && recPledges.Count > 0 && countRec < recPledges.Count) { recPledges[countRec] += "{0,-20}{1,14:N2} ".Fmt(ci.Fund, ci.ContributionAmount); } else { recPledges.Add("{0,43}{1,-20}{2,14:N2} ".Fmt("", ci.Fund, ci.ContributionAmount)); } countRec++; } countRec = 0; foreach (var s in recPledges) { countRec++; if (countRec > 6 && (countRec % 6) == 1) { pageStatement++; writeHeader(c); rWrite(hdr1Pledge + hdr2Pledge); } rWrite(s + "\n"); } if (countRec != 0) { rWrite("\n"); } rWrite(totalLine + Total.ToString("C").PadLeft(25) + "\n"); countRec = 0; }
private void writeHeader(ContributorInfo c) { var isAddress2 = c.Address2 != null; if (newPage > 0) { rWrite(newPage); } newPage = (char)12; rWrite(dateLine); rWrite(churchAddr); rWrite(nineSpaces); rWrite(c.Name.PadRight(42) + "Envelope: # " + c.PeopleId.ToString() + "\n"); rWrite(nineSpaces); if (pageStatement == 1) { rWrite(c.Address1 + "\n"); if (isAddress2) { rWrite(nineSpaces); rWrite(c.Address2); rWrite("\n"); } rWrite(nineSpaces); rWrite(c.City + ", " + c.State + " " + Util.FmtZip(c.Zip) + "\n"); if (!isAddress2) { rWrite("\n"); } rWrite(disclaimer); } else { rWrite("\n" + nineSpaces + "Cont.....Page " + pageStatement.ToString() + "\n".PadRight(6, '\n')); } rWrite("-------------------------------------------------------------------------------\n\n"); }