예제 #1
0
require_once "WebUtility.php";
require_once "Database.php";
require_once "Payment.php";
$slow = new SlowTemplate('template/admin');
$slow->setTemplateFile('index.tpl');
session_start();
//////////////////////////////////////////////////////////////////////////////
// handle the submission
if ($_SERVER["REQUEST_METHOD"] == 'POST') {
    if (isset($_POST["ok"])) {
        $reciept = "BCXY" . rand(1000, 9999);
        // need to be more random
        $payment = Payment::createNew($reciept, Payment::TYPE_PAYMENT_RECIEVED);
        if (is_object($payment)) {
            $amount = numberInput($_POST["amount"]);
            $payment->setTime(dateInput($_POST["day"] . " " . $_POST["time"]));
            $payment->setPhonenumber($_POST["phone"]);
            $payment->setName($_POST["name"]);
            $payment->setAccount(rand(1000, 9999));
            $payment->setStatus(Payment::STATUS_COMPLETED);
            $payment->setAmount($amount);
            $payment->setPostBalance($amount);
            $payment->update();
            print "Payment created";
        }
    }
}
//////////////////////////////////////////////////////////////////////////////
// display the page
$slow->assign(array("DAY" => date("d-m-Y"), "TIME" => date("H:s")));
$slow->parse();
echo '<p>Are you at threat of housing displacement?</p>';
echo '<div>';
checkBox("TaxesDifficulty", "Difficulty Paying Taxes");
checkBox("ForeclosureNotice", "Foreclosure Notice");
checkBox("LandlordEviction", "Landlord Eviction");
textInput("OtherHousingIssue", "Other");
echo '</div>';
textInput("AdditionalServices", "Are there any additional services you need?");
echo '<div class="fieldWrapper" id="divOtherNotes"><label for="OtherNotes">Other/Notes: </label><textarea id="OtherNotes" name="OtherNotes" rows="3" cols="50">' . $row["OtherNotes"] . '</textarea></div>';
dateInput("EnrollmentDate", "Enrollment Date");
echo '<h3>Christmas Coat Orders:</h3>';
checkBox("CoatOrder", "Coat Ordered");
echo 'Have you participated in previous Christmas food distributions in Brightmoor? ';
checkBox("PreviousChristmasFoodYes", "Yes");
checkBox("PreviousChristmasFoodNo", "No");
dateInput("CoatOrderDate", "Coat Order Date");
if ($row["ClientID"] != "") {
    echo '<input type="submit" value="Update Client Information"/></form>';
} else {
    echo '<input type="submit" value="Enter new client"/></form>';
}
?>
</div><!--end form style -->

<!--family member form -->
<div class="formStyle">
<?php 
echo '<h3>Family Information</h3>';
if ($row["ClientID"] != "") {
    echo '<div class="overflow-x">';
    /*$familyMembersSql = "SELECT FamilyMembers.*, Clients.ClientID FROM FamilyMembers INNER JOIN Clients ON FamilyMembers.ClientID=Clients.ClientID WHERE FamilyMembers.ClientID='$row[ClientID]' ORDER BY FamilyMembers.Age DESC, FamilyMembers.FamilyMemberName ASC";