Example #1
0
require_once "show_panel_lib_c.php";
$data = new DataLibrary();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>Grain Bank</title>
<link rel="stylesheet" type="text/css" href="../css/main.css">	
<script type="text/javascript" src="../js/ajax.js"></script>
</head>
<body>
<div id="md_t" class="mdiv-t">top</div>
<div id="md_l" class="mdiv-l"><?php 
$output = '';
$response = $data->getData('CALL grainBalance(1)');
if (!$response['status']) {
    $output = $data->parseErrors($response['message']);
}
$result = $response['result'];
$crow = 0;
$output .= "<table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Balance</th>\n<th>Change</th>\n</tr>\n</thead>";
while ($row = $result->fetch()) {
    $rstyle = $crow & 1 ? 'tr-odd' : 'tr-eve';
    $disp = null;
    $disp[] = $row["grain_type"];
    $disp[] = $row["balance"];
    $disp[] = date("m/d/Y", strtotime($row["lastChange"]));
    $output .= "<tr id='table_balance_{$crow}' class='{$rstyle}'>";
    foreach ($disp as $value) {
        $output .= "<td>{$value}</td>\n";
Example #2
0
<?php

require_once 'data_library.php';
$data = new DataLibrary();
$form_grainID = 0;
$form_grain_type = '';
$form_call = 'add';
$showInput = 'none';
if (isset($_POST)) {
    $type = isset($_POST['call']) ? $_POST['call'] : 'bad';
    switch ($type) {
        case 'add':
            $guid = $data->generateGUID();
            $GrainName = addslashes($_POST['element_0']);
            $sql = "INSERT INTO grain_type (grain_type, grainUUID) VALUES ('{$GrainName}', '{$guid}');";
            $result = $data->getData($sql);
            if (!$result['status']) {
                echo $data->parseErrors($result['message']);
            }
            break;
        case 'edit':
            $GrainID = intval($_POST['ID']);
            $GrainName = addslashes($_POST['element_0']);
            $sql = "UPDATE grain_type SET grain_type = '{$GrainName}' WHERE grainID = {$GrainID};";
            $result = $data->getData($sql);
            if (!$result['status']) {
                echo $data->parseErrors($result['message']);
            }
            break;
        default:
            break;
Example #3
0
<?php

require_once 'data_library.php';
$data = new DataLibrary();
if (isset($_POST)) {
    switch ($_POST['type']) {
        case 'add':
            //$guid = $data->generateGUID();
            $userID = intval($_POST['element_0']);
            $grainID = intval($_POST['element_1']);
            $orderID = intval($_POST['element_2']);
            $amount = intval($_POST['element_3']);
            $sql = "INSERT INTO grain_inventory (grainID_fk, userID_fk, orderID, transactionAmount) VALUES ({$grainID}, {$userID}, {$orderID}, {$amount});";
            $result = $data->getData($sql);
            if (!$result['status']) {
                echo 'Failed<br />';
                echo $data->parseErrors($result['message']);
            }
            break;
        case 'edit':
            break;
        default:
            break;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/grain.css">
<link rel="stylesheet" type="text/css" href="../css/view.css">