コード例 #1
0
    if ($item_id == '' or $percent_off == '') {
        echo "{$lang->forgottenFields}";
        exit;
    } else {
        $field_names = array('item_id', 'percent_off', 'comment');
        $field_data = array("{$item_id}", "{$percent_off}", "{$comment}");
    }
} 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 
コード例 #2
0
ファイル: addsale.php プロジェクト: bravia2015/c2t-pos
//totals
$finalTax = $_POST['totalTax'];
$sale_total_cost = $_POST['finalTotal'];
$temp_total_items_purchased = $_POST['totalItemsPurchased'];
$amt_tendered = $_POST['amt_tendered'];
$amt_change = $amt_tendered - $sale_total_cost;
$amt_tendered = number_format($amt_tendered, 2, '.', '');
$amt_change = number_format($amt_change, 2, '.', '');
$now = date("F j, Y, g:i a");
echo "\n<center>{$now}<br>\n<h4>{$lang->orderBy}: {$customer_name} [{$lang->paidWith} {$paid_with}]</h4>\n\n<table border='0' cellspacing='0' cellpadding='2' bgcolor='{$table_bg}'>\n\n\t\t   <tr>\n\t\t   <th><font color='CCCCCC'>{$lang->itemOrdered}</font></th>\n\t   \t   <th><font color='CCCCCC'>{$lang->unitPrice}</font></th>\n\t\t   <th><font color='CCCCCC'>{$lang->quantity}</font></th>\n\t\t   <th><font color='CCCCCC'>{$lang->extendedPrice}</font></th>\n\t\t   </tr>";
$todaysDate = date("Y-m-d");
$subtotal = number_format($sale_total_cost - $finalTax, 2, '.', '');
$final_tax = number_format($finalTax, 2, '.', '');
$field_names = array('date', 'customer_id', 'sale_sub_total', 'sale_total_cost', 'paid_with', 'items_purchased', 'sold_by', 'comment');
$field_data = array($todaysDate, $_SESSION['current_sale_customer_id'], $subtotal, $sale_total_cost, $paid_with, $temp_total_items_purchased, $_SESSION['session_user_id'], $comment);
$dbf->insert($field_names, $field_data, $sales_table, false);
$saleID = mysql_insert_id();
$field_names = array('sale_id', 'item_id', 'quantity_purchased', 'item_unit_price', 'item_buy_price', 'item_tax_percent', 'item_total_tax', 'item_total_cost');
$temp_item_id = '';
$temp_item_name = '';
$temp_quantity_purchased = 0;
$temp_item_unit_price = 0;
$temp_item_buy_price = 0;
$temp_item_tax_percent = 0;
$temp_item_tax = 0;
$temp_item_cost = 0;
$item_info = array();
//Add to sales_items table
for ($k = 0; $k < $num_items; $k++) {
    $item_info = explode(' ', $_SESSION['items_in_sale'][$k]);
    $temp_item_id = $item_info[0];