Ejemplo n.º 1
0
function PrintAge($Month, $Day, $Year, $Flags)
{
    echo FormatAge($Month, $Day, $Year, $Flags);
}
Ejemplo n.º 2
0
while ($aRow = mysql_fetch_array($rsKidsMissing)) {
    extract($aRow);
    $birthDate = "";
    if ($birthYear != "") {
        $birthDate = $birthDay . "/" . $birthMonth . "/" . $birthYear;
    }
    echo "<tr>";
    echo "<td><a href='../PersonView.php?PersonID=" . $kidId . "'>";
    echo "\t<span class=\"fa-stack\">";
    echo "\t<i class=\"fa fa-square fa-stack-2x\"></i>";
    echo "\t<i class=\"fa fa-search-plus fa-stack-1x fa-inverse\"></i>";
    echo "\t</span></a></td>";
    echo "<td>" . $firstName . "</td>";
    echo "<td>" . $LastName . "</td>";
    echo "<td>" . $birthDate . "</td>";
    echo "<td>" . FormatAge($birthMonth, $birthDay, $birthYear, "") . "</td>";
    echo "<td>" . $Address1 . " " . $Address2 . " " . $city . " " . $state . " " . $zip . "</td>";
    echo "</tr>";
}
?>
			</tbody>
		</table>
	</div>
</div>

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		$('#sundayschool').dataTable();
		$('#sundayschoolMissing').dataTable();
	} );
</script>
Ejemplo n.º 3
0
function CanvassBriefingSheets($iFYID)
{
    // Instantiate the directory class and build the report.
    $pdf = new PDF_CanvassBriefingReport();
    // Read in report settings from database
    $rsConfig = mysql_query("SELECT cfg_name, IFNULL(cfg_value, cfg_default) AS value FROM config_cfg WHERE cfg_section='ChurchInfoReport'");
    if ($rsConfig) {
        while (list($cfg_name, $cfg_value) = mysql_fetch_row($rsConfig)) {
            $pdf->{$cfg_name} = $cfg_value;
        }
    }
    $aQuestions = file("CanvassQuestions.txt");
    $iNumQuestions = count($aQuestions);
    // Get all the families which need canvassing
    $sSQL = "SELECT *, a.per_FirstName AS CanvasserFirstName, a.per_LastName AS CanvasserLastName FROM family_fam \n\t         LEFT JOIN person_per a ON fam_Canvasser = a.per_ID\n\t\t\t WHERE fam_OkToCanvass=\"TRUE\" AND fam_Canvasser>0 ORDER BY fam_Canvasser, fam_Name";
    $rsFamilies = RunQuery($sSQL);
    $topPledgeLevel = TopPledgersLevel($iFYID, 20);
    // mjw fix this- percentage should be a config option
    $canvasserX = 160;
    $topY = 20;
    $memberNameX = $pdf->leftX;
    $memberGenderX = $memberNameX + 30;
    $memberRoleX = $memberGenderX + 15;
    $memberAgeX = $memberRoleX + 30;
    $memberClassX = $memberAgeX + 20;
    $memberCellX = $memberClassX + 20;
    $memberEmailX = $memberCellX + 25;
    while ($aFamily = mysql_fetch_array($rsFamilies)) {
        $curY = $topY;
        $pdf->SetFont('Times', '', 24);
        $pdf->WriteAt($pdf->leftX, $curY, $aFamily["fam_Name"]);
        $pdf->SetFont('Times', '', 16);
        $pdf->PrintRightJustified($canvasserX, $curY, "Canvasser: " . $aFamily["CanvasserFirstName"] . " " . $aFamily["CanvasserLastName"]);
        $curY += 8;
        $pdf->SetFont('Times', '', 14);
        $pdf->WriteAt($pdf->leftX, $curY, $pdf->MakeSalutation($aFamily["fam_ID"]));
        $curY += 5;
        if ($aFamily["fam_Address1"] != "") {
            $pdf->WriteAt($pdf->leftX, $curY, $aFamily["fam_Address1"]);
            $curY += 5;
        }
        if ($aFamily["fam_Address2"] != "") {
            $pdf->WriteAt($pdf->leftX, $curY, $aFamily["fam_Address2"]);
            $curY += 5;
        }
        $pdf->WriteAt($pdf->leftX, $curY, $aFamily["fam_City"] . ", " . $aFamily["fam_State"] . "  " . $aFamily["fam_Zip"]);
        $curY += 5;
        if ($aFamily["fam_Country"] != "" && $aFamily["fam_Country"] != "United States" && $aFamily["fam_Country"] != "USA") {
            $pdf->WriteAt($pdf->leftX, $curY, $aFamily["fam_Country"]);
            $curY += 5;
        }
        $pdf->WriteAt($pdf->leftX, $curY, $pdf->StripPhone($aFamily["fam_HomePhone"]));
        $curY += 5;
        // Get pledges for this fiscal year, this family
        $sSQL = "SELECT plg_Amount FROM pledge_plg \n\t\t\t\t WHERE plg_FYID = " . $iFYID . " AND plg_PledgeOrPayment=\"Pledge\" AND plg_FamID = " . $aFamily["fam_ID"] . " ORDER BY plg_Amount DESC";
        $rsPledges = RunQuery($sSQL);
        $pledgeCount = mysql_num_rows($rsPledges);
        $sPledgeStatus = "";
        if ($pledgeCount == 0) {
            $sPledgeStatus .= gettext("Did not pledge");
        } else {
            $aPledge = mysql_fetch_array($rsPledges);
            if ($aPledge["plg_Amount"] >= $topPledgeLevel) {
                $sPledgeStatus .= gettext("Top pledger");
            } else {
                $sPledgeStatus .= gettext("Pledged");
            }
        }
        $curY += $pdf->incrementY;
        $pdf->SetFont('Times', '', 12);
        $pdf->WriteAt($pdf->leftX, $curY, gettext("Pledge status: "));
        $pdf->SetFont('Times', 'B', 12);
        $pdf->WriteAt($pdf->leftX + 25, $curY, $sPledgeStatus);
        $pdf->SetFont('Times', '', 12);
        $curY += 2 * $pdf->incrementY;
        //Get the family members for this family
        $sSQL = "SELECT per_ID, per_Title, per_FirstName, per_LastName, per_Suffix, per_Gender,\n\t\t\t\tper_BirthMonth, per_BirthDay, per_BirthYear, per_Flags, \n\t\t\t\tper_HomePhone, per_WorkPhone, per_CellPhone, per_Email, per_WorkEmail,\n\t\t\t\tcls.lst_OptionName AS sClassName, fmr.lst_OptionName AS sFamRole\n\t\t\t\tFROM person_per\n\t\t\t\tLEFT JOIN list_lst cls ON per_cls_ID = cls.lst_OptionID AND cls.lst_ID = 1\n\t\t\t\tLEFT JOIN list_lst fmr ON per_fmr_ID = fmr.lst_OptionID AND fmr.lst_ID = 2\n\t\t\t\tWHERE per_fam_ID = " . $aFamily["fam_ID"] . " ORDER BY fmr.lst_OptionSequence";
        $rsFamilyMembers = RunQuery($sSQL);
        $pdf->SetFont('Times', 'B', 10);
        $pdf->WriteAt($memberNameX, $curY, gettext("Name"));
        $pdf->WriteAt($memberGenderX, $curY, gettext("M/F"));
        $pdf->WriteAt($memberRoleX, $curY, gettext("Role"));
        $pdf->WriteAt($memberAgeX, $curY, gettext("Age"));
        $pdf->WriteAt($memberClassX, $curY, gettext("Member"));
        $pdf->WriteAt($memberCellX, $curY, gettext("Cell Phone"));
        $pdf->WriteAt($memberEmailX, $curY, gettext("Email"));
        $curY += $pdf->incrementY;
        $pdf->SetFont('Times', '', 10);
        while ($aFamilyMember = mysql_fetch_array($rsFamilyMembers)) {
            if ($aFamilyMember["per_Gender"] == 1) {
                $sGender = "M";
            } else {
                $sGender = "F";
            }
            $sAge = FormatAge($aFamilyMember["per_BirthMonth"], $aFamilyMember["per_BirthDay"], $aFamilyMember["per_BirthYear"], $aFamilyMember["per_Flags"]);
            $pdf->WriteAt($memberNameX, $curY, $aFamilyMember["per_FirstName"] . " " . $aFamilyMember["per_LastName"]);
            $pdf->WriteAt($memberGenderX, $curY, $sGender);
            $pdf->WriteAt($memberRoleX, $curY, $aFamilyMember["sFamRole"]);
            $pdf->WriteAt($memberAgeX, $curY, $sAge);
            $pdf->WriteAt($memberClassX, $curY, $aFamilyMember["sClassName"]);
            $pdf->WriteAt($memberCellX, $curY, $pdf->StripPhone($aFamilyMember["per_CellPhone"]));
            $pdf->WriteAt($memberEmailX, $curY, $aFamilyMember["per_Email"]);
            $curY += $pdf->incrementY;
        }
        // Go back around to get group affiliations
        if (mysql_num_rows($rsFamilyMembers) > 0) {
            mysql_data_seek($rsFamilyMembers, 0);
            while ($aMember = mysql_fetch_array($rsFamilyMembers)) {
                // Get the Groups this Person is assigned to
                $sSQL = "SELECT grp_Name, role.lst_OptionName AS roleName\n\t\t\t\t\t\tFROM group_grp\n\t\t\t\t\t\tLEFT JOIN person2group2role_p2g2r ON p2g2r_grp_ID = grp_ID\n\t\t\t\t\t\tLEFT JOIN list_lst role ON lst_OptionID = p2g2r_rle_ID AND lst_ID = grp_RoleListID\n\t\t\t\t\t\tWHERE person2group2role_p2g2r.p2g2r_per_ID = " . $aMember["per_ID"] . "\n\t\t\t\t\t\tORDER BY grp_Name";
                $rsAssignedGroups = RunQuery($sSQL);
                if (mysql_num_rows($rsAssignedGroups) > 0) {
                    $groupStr = "Assigned groups for " . $aMember["per_FirstName"] . " " . $aMember["per_LastName"] . ": ";
                    $countGroups = 0;
                    while ($aGroup = mysql_fetch_array($rsAssignedGroups)) {
                        $groupStr .= $aGroup["grp_Name"] . " (" . $aGroup["roleName"] . ") ";
                        if ($countGroups == 0) {
                            $curY += $pdf->incrementY;
                        }
                        if (++$countGroups >= 2) {
                            $countGroups = 0;
                            $pdf->WriteAt($pdf->leftX, $curY, $groupStr);
                            $groupStr = "        ";
                        }
                    }
                    $pdf->WriteAt($pdf->leftX, $curY, $groupStr);
                }
            }
        }
        $curY += 2 * $pdf->incrementY;
        $spaceLeft = 275 - $curY;
        $spacePerQuestion = $spaceLeft / $iNumQuestions;
        for ($i = 0; $i < $iNumQuestions; $i++) {
            $pdf->WriteAt($pdf->leftX, $curY, $i + 1 . ". " . $aQuestions[$i]);
            $curY += $spacePerQuestion;
        }
        $pdf->AddPage();
    }
    $pdf->Output("CanvassBriefing" . date("Ymd") . ".pdf", "D");
}