Exemplo n.º 1
0
        public void ContactForm()
        {
            doc.NewPage();

            var t = new PdfPTable(1);
            t.SetNoBorder();
            t.AddCentered("InReach/Outreach Card", 1, h1font);
            t.AddCentered("Contact Summary", 1, h2font);
            t.AddRight("Contact Date: _______________", bfont);

            doc.Add(t);

            DisplayTable("Contact Reason", 5.7f, 1.2f, 24f, new List<string>
            {
                "Out-Reach (not a church member)",
                "In-Reach (church/group member)",
                "Information",
                "Bereavement",
                "Health",
                "Personal",
                "Other"
            });

            DisplayTable("Type of Contact", 5.7f, 8f, 24f, new List<string>
            {
                "Personal Visit",
                "Phone Call",
                "Card Sent",
                "Email Sent",
            });
            DisplayTable("Results", 5.7f, 14.5f, 24f, new List<string>
            {
                "Not at Home",
                "Left Door Hanger",
                "Left Message",
                "Contact Made",
                "Gospel Shared",
                "Profession of Faith",
                "Prayer Request Rec'd",
                "Prayed for Person",
                "Already Saved",
            });
            DisplayNotes("Team Members", 4, 7.5f, 6f, 18.5f);
            DisplayNotes("Specific Comments on Contact", 5, 18.5f, 1.2f, 13f);

            DisplayTable("Actions to be taken", 12f, 1f, 6.5f, new List<string>
            {
                "Recycle to me on ____/____/____",
                "Random Recycle",
                "Follow-up Completed",
            });

            var t2 = new PdfPTable(1);
            t2.TotalWidth = 7.5f * 72f;
            t2.SetNoBorder();
            t2.LockedWidth = true;
            t2.AddCentered("Internal Use Only", 1, smallfont);
            t2.WriteSelectedRows(0, -1, 36f, 56f, dc);
        }
Exemplo n.º 2
0
        public void ContactForm(ProspectInfo p)
        {
            /* There is no look up table for Contact Results because they are hardcoded into the form for actually adding a contact to a record
             * Another Setting is used to allow for customization of the blank Contact Form.  It is called "ContactFormResults"
             * The code takes a semi-colon seperated string stored in ContactFormResults and converts it to a list.
             * If ContactFormResults does not exist in Settings then the default list is used.
             *
             * However, because the results are hardcoded, there will be no translation between the results on this form and the results on the Contact page itself.
             * We will implement extra values for this table to accomodate this at some point.
             * */
            var Db = DbUtil.Db;
            List<string> ContactResult =
                Db.Setting(
                "ContactFormResults",
                "Not at Home;Left Door Hanger;Left Message;Contact Made;Gospel Shared;Profession of Faith;Prayer Request Rec'd;Prayed for Person;Already Saved"
                ).Split(';').ToList();

            doc.NewPage();

            var t = new PdfPTable(2);

            t.SetNoBorder();
            t.AddCentered("InReach/Outreach Card for {0} ({1})".Fmt(p.Name, p.PeopleId), 2, h1font);
            t.AddCentered("Contact Summary", 2, h2font);
            /* Added line for noting the Ministry recording the contact*/
            t.AddLeft("Ministry: ______________________", 1, bfont);
            t.AddRight("Contact Date: _______________", 1, bfont);

            doc.Add(t);

            var ContactReason = Db.ContactReasons.Select(rr => rr.Description).Take(10).ToList();
            var ContactType = Db.ContactTypes.Select(rr => rr.Description).Take(10).ToList();

            DisplayTable("Contact Reason", 5.7f, 1.2f, 24.2f, ContactReason);
            DisplayTable("Type of Contact", 5.7f, 8f, 24.2f, ContactType);
            DisplayTable("Results", 5.7f, 14.5f, 24.2f, ContactResult);

            DisplayNotes("Team Members", 3, 6f, 13.7f, 6.5f);
            DisplayNotes("Specific Comments on Contact", 5, 18.5f, 1.2f, 13f);
            DisplayTable("Actions to be taken", 12f, 1f, 6.5f, new List<string>
            {
                "Recycle to me on ____/____/____",
                "Random Recycle",
                "Follow-up Completed",
                "Other Action:___________________________________",
            });

            var t2 = new PdfPTable(1);
            t2.TotalWidth = 7.5f * 72f;
            t2.SetNoBorder();
            t2.LockedWidth = true;
            t2.AddCentered("Internal Use Only", 1, smallfont);
            t2.WriteSelectedRows(0, -1, 36f, 56f, dc);
        }
Exemplo n.º 3
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            dt = Util.Now;

            doc = new Document(PageSize.LETTER.Rotate(), 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            var roles = DbUtil.Db.CurrentRoles();
            var i = (from o in DbUtil.Db.Organizations
                     where o.LimitToRole == null || roles.Contains(o.LimitToRole)
                     where o.OrganizationId == orgid
                     select new
                     {
                         o.OrganizationName,
                         o.LeaderName,
                         o.FirstMeetingDate
                     }).SingleOrDefault();

            w.PageEvent = new HeadFoot
            {
                HeaderText = "Recent Attendee Report: {0} - {1} ({2})".Fmt(
                    i.OrganizationName, i.LeaderName, i.FirstMeetingDate.HasValue ? "since " + i.FirstMeetingDate.FormatDate() : "no First Meeting Date set"),
                FooterText = "Recent Attendee Report"
            };
            doc.Open();

            var q = Attendees(orgid.Value);

            if (!orgid.HasValue || i == null || q.Count() == 0)
                doc.Add(new Phrase("no data"));
            else
            {
                var mt = new PdfPTable(1);
                mt.SetNoPadding();
                mt.HeaderRows = 1;

                float[] widths = new float[] { 4f, 6f, 7f, 2.6f, 2f, 3f };
                var t = new PdfPTable(widths);
                t.DefaultCell.Border = PdfPCell.NO_BORDER;
                t.DefaultCell.VerticalAlignment = PdfPCell.ALIGN_TOP;
                t.DefaultCell.SetLeading(2.0f, 1f);
                t.WidthPercentage = 100;

                t.AddHeader("Name", boldfont);
                t.AddHeader("Address", boldfont);
                t.AddHeader("Phone/Email", boldfont);
                t.AddHeader("Last Att.", boldfont);
                t.AddHeader("Birthday", boldfont);
                t.AddHeader("Status", boldfont);
                mt.AddCell(t);

                var color = BaseColor.BLACK;
                bool? v = null;

                foreach (var p in q)
                {
                    if (color == BaseColor.WHITE)
                        color = new GrayColor(240);
                    else
                        color = BaseColor.WHITE;

                    t = new PdfPTable(widths);
                    t.SetNoBorder();
                    t.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
                    t.DefaultCell.BackgroundColor = color;

                    if (v != p.visitor)
                        t.Add("             ------ {0} ------".Fmt(p.visitor == true ? "Guests and Previous Members" : "Members"), 6, bigboldfont);
                    v = p.visitor;

                    t.Add(p.Name, font);

                    var ph = new Paragraph();
                    ph.AddLine(p.Address, font);
                    ph.AddLine(p.Address2, font);
                    ph.AddLine(p.CSZ, font);
                    t.AddCell(ph);

                    ph = new Paragraph();
                    ph.AddLine(p.HomePhone.FmtFone("H"), font);
                    ph.AddLine(p.CellPhone.FmtFone("C"), font);
                    ph.AddLine(p.Email, font);
                    t.AddCell(ph);

                    t.Add(p.LastAttend.FormatDate(), font);
                    t.Add(p.Birthday, font);
                    t.Add(p.AttendType, font);
                    t.CompleteRow();

                    t.Add("", font);
                    t.Add(p.AttendStr, 4, monofont);
                    t.AddRight("{0:n1}{1}".Fmt(p.AttendPct, p.AttendPct.HasValue ? "%" : ""), font);

                    mt.AddCell(t);
                }
                doc.Add(mt);
            }
            doc.Close();
        }
Exemplo n.º 4
0
        private void DisplayTable(string title, float width, float x, float y, List<string> reasons)
        {
            var t = new PdfPTable(new float[] { 1.3f, width-1.3f });
            t.TotalWidth = width * cm2pts;
            t.SetNoBorder();
            t.LockedWidth = true;
            t.DefaultCell.MinimumHeight = 1f * cm2pts;
            t.DefaultCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;

            t.AddPlainRow(title, bfont);
            foreach (var r in reasons)
            {
                t.AddRight("_____", font);
                t.Add(r, font);
            }
            t.WriteSelectedRows(0, -1, x * cm2pts, y * cm2pts, dc);
        }
Exemplo n.º 5
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            dt = Util.Now;

            doc = new Document(PageSize.LETTER, 36, 36, 36, 36);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);
            w.PageEvent = pageEvents;
            doc.Open();
            dc = w.DirectContent;
            ct = new ColumnText(dc);

            if (!qid.HasValue)
                doc.Add(new Phrase("no data"));
            else
            {
                pageEvents.StartPageSet("Outreach/Inreach Report: {0:d}".Fmt(dt));
                IQueryable<ProspectInfo> q = GetProspectInfo(AlphaSort);
                if (!q.Any())
                    doc.Add(new Phrase("no data"));
                else
                    foreach (var p in q)
                    {
                        doc.NewPage();
                        var t = new PdfPTable(new float[] { 62f, 61f, 67f });
                        t.SetNoPadding();
                        var t1 = new PdfPTable(1);
                        t1.SetNoBorder();
                        var t2 = new PdfPTable(new float[] { 30f, 31f });
                        t2.SetNoBorder();
                        var t3 = new PdfPTable(new float[] { 27f, 40f });
                        t3.SetNoBorder();

                        var ph = new Paragraph();
                        ph.Add(new Chunk(p.Name, bfont));
                        ph.Add(new Chunk(" ({0})".Fmt(p.PeopleId), smallfont));
                        t1.AddCell(ph);
                        ph = new Paragraph();
                        ph.AddLine(p.Address, font);
                        ph.AddLine(p.Address2, font);
                        ph.AddLine(p.CityStateZip, font);
                        ph.Add("\n");
                        ph.AddLine(p.HomePhone.FmtFone("H"), font);
                        ph.AddLine(p.CellPhone.FmtFone("C"), font);
                        ph.AddLine(p.EMail, font);
                        t1.AddCell(ph);
                        t.AddCell(t1);

                        t2.Add("Position in Family:", font);
                        t2.Add(p.PositionInFamily, font);
                        t2.Add("Gender:", font);
                        t2.Add(p.Gender, font);
                        t2.Add("Marital Status:", font);
                        t2.Add(p.MaritalStatus, font);
                        t2.Add("", font);
                        t2.CompleteRow();

                        if (p.ChristAsSavior.HasValue())
                            t2.Add(p.ChristAsSavior, 2, font);
                        if (p.InfoBecomeAChristian.HasValue())
                            t2.Add(p.InfoBecomeAChristian, 2, font);
                        if (p.InterestedInJoining.HasValue())
                            t2.Add(p.InterestedInJoining, 2, font);
                        if (p.PleaseVisit.HasValue())
                            t2.Add(p.PleaseVisit, 2, font);

                        t.AddCell(t2);

                        t3.Add("Member Status:", font);
                        t3.Add(p.MemberStatus, font);
                        t3.Add("Origin:", font);
                        t3.Add(p.Origin, font);
                        t3.Add("Age:", font);
                        t3.Add(p.Age, font);
                        t3.Add("Comments:", 2, font);
                        t3.Add(p.Comment, 2, font);

                        t.AddCell(t3);
                        doc.Add(t);

                        if (p.Family.Count() > 0)
                        {
                            t = new PdfPTable(5);
                            t.SetNoBorder();
                            t.AddRow("Family Summary", bfont);
                            t.AddHeader("Name", bfont);
                            t.AddHeader("Age", bfont);
                            t.AddHeader("Cell Phone", bfont);
                            t.AddHeader("Position in Family", bfont);
                            t.AddHeader("Member Status", bfont);
                            foreach (var fm in p.Family)
                            {
                                t.Add(fm.Name, font);
                                t.Add(fm.Age.ToString(), font);
                                t.Add(fm.CellPhone.FmtFone(), font);
                                t.Add(fm.PositionInFamily, font);
                                t.Add(fm.MemberStatus, font);
                            }
                            doc.Add(t);
                        }
                        if (p.Comments.Count() > 0)
                        {
                            t = new PdfPTable(new float[] { 31f, 134f });
                            t.SetNoBorder();
                            t.AddRow("Comments", bfont);
                            t.AddHeader("Field", bfont);
                            t.AddHeader("Comments", bfont);
                            foreach (var c in p.Comments)
                            {
                                t.Add(c.CommentField, bfont);
                                t.Add(c.Comments, font);
                            }
                            doc.Add(t);
                        }

                        if (p.Attends.Count() > 0)
                        {
                            t = new PdfPTable(new float[] { 24f, 73f, 56f, 34f });
                            t.SetNoBorder();
                            t.AddRow("Attendance Summary", bfont);
                            t.AddHeader("Date", bfont);
                            t.AddHeader("Event", bfont);
                            t.AddHeader("Teacher", bfont);
                            t.AddHeader("Schedule", bfont);
                            foreach (var a in p.Attends)
                            {
                                t.Add(a.MeetingDate.FormatDate(), font);
                                t.Add(a.MeetingName, font);
                                t.Add(a.Teacher, font);
                                t.Add(a.MeetingDate.ToString2("t"), font);
                            }
                            doc.Add(t);
                        }

                        if (p.Contacts.Count() > 0)
                        {
                            t = new PdfPTable(new float[] { 31f, 134f });
                            t.SetNoBorder();
                            t.AddRow("Contacts", font);
                            t.AddHeader("Date/Type/Team", font);
                            t.AddHeader("Comments", font);
                            foreach (var a in p.Contacts)
                            {
                                t.AddHeader("{0:d}\n{1}\n{2}".Fmt(a.ContactDate, a.TypeOfContact, a.Team), font);
                                t.AddHeader(a.Comments, font);
                            }
                            doc.Add(t);
                        }

                        if (p.Memberships.Count() > 0)
                        {
                            t = new PdfPTable(4);
                            t.SetNoBorder();
                            t.AddRow("Current Enrollment", bfont);
                            t.AddHeader("Division", bfont);
                            t.AddHeader("Organization", bfont);
                            t.AddHeader("Member Type", bfont);
                            t.AddHeader("Enroll Date", bfont);
                            foreach (var m in p.Memberships)
                            {
                                t.Add(m.DivisionName, font);
                                t.Add(m.Name, font);
                                t.Add(m.MemberType, font);
                                t.Add(m.EnrollDate.FormatDate(), font);
                            }
                            doc.Add(t);
                        }
                        if (p.FamilyComments.Count() > 0)
                        {
                            t = new PdfPTable(new float[] { 31f, 134f });
                            t.SetNoBorder();
                            t.AddRow("Family Comments", bfont);
                            t.AddHeader("Field", bfont);
                            t.AddHeader("Comments", bfont);
                            foreach (var c in p.FamilyComments)
                            {
                                t.Add(c.CommentField, bfont);
                                t.Add(c.Comments, font);
                            }
                            doc.Add(t);
                        }
                        if (ShowForm)
                            ContactForm();
                    }
            }
            pageEvents.EndPageSet();
            doc.Close();
        }
Exemplo n.º 6
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            doc = new Document(PageSize.LETTER, 36, 36, 36, 36);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);
            doc.Open();
            dc = w.DirectContent;

            doc.NewPage();

            var t = new PdfPTable(1);
            t.SetNoBorder();
            t.AddCentered("In-Reach/Outreach Card", 1, h1font);
            t.AddCentered("Contact Summary", 1, h2font);
            t.AddRight("Contact Date: _______________", bfont);

            doc.Add(t);

            DisplayTable("Contact Reason", 5.7f, 1.2f, 24f, new List<string>
            {
                "Out-Reach (not a church member)",
                "In-Reach (church/group member)",
                "Information",
                "Bereavement",
                "Health",
                "Personal",
                "Other"
            });

            DisplayTable("Type of Contact", 5.7f, 8f, 24f, new List<string>
            {
                "Personal Visit",
                "Phone Call",
                "Card Sent",
                "Email Sent",
            });
            DisplayTable("Results", 5.7f, 14.5f, 24f, new List<string>
            {
                "Not at Home",
                "Left Door Hanger",
                "Left Message",
                "Contact Made",
                "Gospel Shared",
                "Profession of Faith",
                "Prayer Request Rec'd",
                "Prayed for Person",
                "Already Saved",
            });
            DisplayNotes("Team Members", 4, 7.5f, 6f, 18.5f);
            DisplayNotes("Specific Comments on Contact", 5, 18.5f, 1.2f, 13f);

            DisplayTable("Actions to be taken", 12f, 1f, 6.5f, new List<string>
            {
                "Recycle to me on ____/____/____",
                "Random Recycle",
                "Follow-up Completed",
            });

            var t2 = new PdfPTable(1);
            t2.TotalWidth = 7.5f * 72f;
            t2.SetNoBorder();
            t2.LockedWidth = true;
            t2.AddCentered("Internal Use Only", 1, smallfont);
            t2.WriteSelectedRows(0, -1, 36f, 46f, dc);

            doc.Close();
        }
Exemplo n.º 7
0
        public override void ExecuteResult(ControllerContext context)
        {
            var Response = context.HttpContext.Response;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "filename=foo.pdf");

            dt = Util.Now;

            doc = new Document(PageSize.LETTER.Rotate(), 36, 36, 64, 64);
            var w = PdfWriter.GetInstance(doc, Response.OutputStream);

            var i = (from m in DbUtil.Db.Meetings
                     where m.MeetingId == mtgid
                     select new
                     {
                         m.Organization.OrganizationName,
                         m.Organization.LeaderName,
                         m.MeetingDate
                     }).SingleOrDefault();

            w.PageEvent = new HeadFoot
            {
                HeaderText = $"Guests/Absents Report: {i.OrganizationName} - {i.LeaderName} {i.MeetingDate:g}",
                FooterText = "Guests/Absents Report"
            };
            doc.Open();

            var q = VisitsAbsents(mtgid.Value);

            if (!mtgid.HasValue || i == null || !q.Any())
                doc.Add(new Paragraph("no data"));
            else
            {
                var mt = new PdfPTable(1);
                mt.SetNoPadding();
                mt.HeaderRows = 1;

                float[] widths = {4f, 6f, 7f, 2.6f, 2f, 3f};
                var t = new PdfPTable(widths);
                t.DefaultCell.Border = Rectangle.NO_BORDER;
                t.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
                t.DefaultCell.SetLeading(2.0f, 1f);
                t.WidthPercentage = 100;

                t.AddHeader("Name", boldfont);
                t.AddHeader("Address", boldfont);
                t.AddHeader("Phone/Email", boldfont);
                t.AddHeader("Last Att.", boldfont);
                t.AddHeader("Birthday", boldfont);
                t.AddHeader("Guest/Member", boldfont);
                mt.AddCell(t);

                var color = BaseColor.BLACK;
                bool? v = null;
                foreach (var p in q)
                {
                    if (color == BaseColor.WHITE)
                        color = new GrayColor(240);
                    else
                        color = BaseColor.WHITE;

                    t = new PdfPTable(widths);
                    t.SetNoBorder();
                    t.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
                    t.DefaultCell.BackgroundColor = color;

                    if (v != p.visitor)
                        t.Add($"             ------ {(p.visitor ? "Guests" : "Absentees")} ------", 6, bigboldfont);
                    v = p.visitor;

                    t.Add(p.Name, font);

                    var ph = new Paragraph();
                    ph.AddLine(p.Address, font);
                    ph.AddLine(p.Address2, font);
                    ph.AddLine(p.CSZ, font);
                    t.AddCell(ph);

                    ph = new Paragraph();
                    ph.AddLine(p.HomePhone.FmtFone("H"), font);
                    ph.AddLine(p.CellPhone.FmtFone("C"), font);
                    ph.AddLine(p.Email, font);
                    t.AddCell(ph);

                    t.Add(p.LastAttend.FormatDate(), font);
                    t.Add(p.Birthday, font);
                    t.Add(p.Status, font);
                    t.CompleteRow();

                    if (p.Status == null || !p.Status.StartsWith("Visit"))
                    {
                        t.Add("", font);
                        t.Add($"{p.AttendStr}           {p.AttendPct:n1}{(p.AttendPct.HasValue ? "%" : "")}", 5, monofont);
                    }

                    mt.AddCell(t);
                }
                doc.Add(mt);
            }
            doc.Close();
        }