Example #1
0
require_once "SlowTemplate.php";
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")));
textInput("CellPhoneNumber", "Cell Phone Number");
echo '<div class="fieldWrapper">';
emailInput("EmailAddress", "Email Address");
echo '</div>';
echo '<h3>Family Information:</h3>';
numberInput("FamilySize", "Family Size");
numberInput("AdultsNumber", "Number of Adults");
numberInput("ChildrenNumber", "Number of Children");
echo '<h4>Age Range:</h4>';
numberInput("AgeRange05", "0-5");
numberInput("AgeRange617", "6-17");
numberInput("AgeRange1829", "18-29");
numberInput("AgeRange3039", "30-39");
numberInput("AgeRange4049", "40-49");
numberInput("AgeRange5064", "50-64");
numberInput("AgeRange65", "65+");
echo '<h3>Household Information. This information is to help determine future services!</h3>
<p style="display:inline;">Do you have access to facilities to prepare food (stove/oven): </p>';
$hasStoveChecked = NULL;
$noStoveChecked = NULL;
if ($row["HasStove"] == 'Yes') {
    $hasStoveChecked = 'checked';
}
if ($row["HasStove"] == 'No') {
    $noStoveChecked = 'checked';
}
echo '

<label for="stoveYes">Yes</label><input type="radio" name="HasStove" id="stoveYes" value="Yes" ' . $hasStoveChecked . '>
 <label for="stoveNo">No</label><input type="radio" name="HasStove" id="stoveNo" value="No" ' . $noStoveChecked . '><br /><br />';
/*