예제 #1
0
    }
} else {
    //outputs error message because user did not use form to fill out data.
    echo "{$lang->mustUseForm}";
    exit;
}
switch ($action) {
    //finds out what action needs to be taken and preforms it by calling methods from dbf class.
    case $action == "insert":
        $dbf->insert($field_names, $field_data, $tablename, true);
        break;
    case $action == "update":
        $dbf->update($field_names, $field_data, $tablename, $id, true);
        break;
    case $action == "delete":
        $dbf->deleteRow($tablename, $id);
        break;
    default:
        echo "{$lang->noActionSpecified}";
        break;
}
$dbf->closeDBlink();
?>
<br>
<a href="manage_discounts.php"><?php 
echo $lang->manageDiscounts;
?>
--></a>
<br>
<a href="form_discounts.php?action=insert"><?php 
echo $lang->discountAnItem;
예제 #2
0
$lang = new language();
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang);
$sec = new security_functions($dbf, 'Admin', $lang);
//checks if user is logged in.
if (!$sec->isLoggedIn()) {
    header("location: ../login.php");
    exit;
}
if (isset($_GET['item_id']) and isset($_GET['sale_id']) and isset($_GET['row_id'])) {
    $item_id = $_GET['item_id'];
    $sale_id = $_GET['sale_id'];
    $row_id = $_GET['row_id'];
}
$returned_quantity = $dbf->idToField($cfg_tableprefix . 'sales_items', 'quantity_purchased', $row_id);
$newQuantity = $dbf->idToField($cfg_tableprefix . 'items', 'quantity', $item_id) + $returned_quantity;
$dbf->deleteRow($cfg_tableprefix . 'sales_items', $row_id);
$dbf->updateItemQuantity($item_id, $newQuantity);
$dbf->updateSaleTotals($sale_id);
?>
<br>
<a href="manage_sales.php"><?php 
echo $lang->manageSales;
?>
--></a>
<br>
<a href="sale_ui.php"><?php 
echo $lang->startSale;
?>
 --></a>
</body>
</html>