include "../classes/security_functions.php"; //creates 3 objects needed for this script. $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>
include "../settings.php"; include "../language/{$cfg_language}"; include "../classes/db_functions.php"; include "../classes/security_functions.php"; include "../classes/display.php"; $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, 'Report Viewer', $lang); if (!$sec->isLoggedIn()) { header("location: ../login.php"); exit; } if (isset($_GET['sale_id'])) { $sale_id = $_GET['sale_id']; $customer_id = $_GET['sale_customer_id']; $sale_date = $_GET['sale_date']; $temp_first_name = $dbf->idToField("{$cfg_tableprefix}" . 'customers', 'first_name', $customer_id); $temp_last_name = $dbf->idToField("{$cfg_tableprefix}" . 'customers', 'last_name', $customer_id); $sale_customer_name = $temp_first_name . ' ' . $temp_last_name; } $display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang); $display->displayTitle("{$lang->saleDetails}"); $tableheaders = array("{$lang->rowID}", "{$lang->itemName}", "{$lang->brand}", "{$lang->category}", "{$lang->supplier}", "{$lang->quantityPurchased}", "{$lang->unitPrice}", "{$lang->totalItemCost}"); $tablefields = array('id', 'item_id', 'brand_id', 'category_id', 'supplier_id', 'quantity_purchased', 'item_unit_price', 'item_total_cost'); $display->displayReportTable("{$cfg_tableprefix}", 'sales_items', $tableheaders, $tablefields, 'sale_id', "{$sale_id}", '', '', 'id', "{$sale_customer_name}<br>{$sale_date}<br><br>Items in sale<br>"); ?> </body> </html>
for ($k = 0; $k < count($tableheaders); $k++) { echo "<th align='center'>\n<font color='{$display->header_text_color}' face='{$display->headerfont_face}' size='{$display->headerfont_size}'>{$tableheaders[$k]}</font>\n</th>\n"; } echo '</tr>' . "\n\n"; $rowCounter = 0; $subtotal = 0; $total = 0; $category_result = mysql_query("SELECT * FROM {$categories_table} order by category"); while ($row = mysql_fetch_assoc($category_result)) { $categories_id[] = $row['id']; $categories_name[] = $row['category']; $categories_total[$row['id']] = 0; $categories_subtotal[$row['id']] = 0; } while ($row = mysql_fetch_assoc($result3)) { $category_of_item = $dbf->idToField($cfg_tableprefix . 'items', 'category_id', $row['item_id']); $categories_subtotal[$category_of_item] += $row['item_total_cost'] - $row['item_total_tax']; $categories_total[$category_of_item] += $row['item_total_cost']; } for ($k = 0; $k < count($categories_id); $k++) { if ($rowCounter % 2 == 0) { echo "\n<tr bgcolor={$display->rowcolor1}>\n"; } else { echo "\n<tr bgcolor={$display->rowcolor2}>\n"; } $id = $categories_id[$k]; $name = $categories_name[$k]; $subtotal = number_format($categories_subtotal[$id], 2, '.', ''); $total = number_format($categories_total[$id], 2, '.', ''); $tax = number_format($total - $subtotal, 2, '.', ''); echo "\n<td align='center'>\n<font color='{$display->rowcolor_text}' face='{$display->rowfont_face}' size='{$display->rowfont_size}'>{$name}</font>\n</td>\n";
include "../classes/security_functions.php"; include "../classes/display.php"; include "../classes/form.php"; $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, 'Report Viewer', $lang); if (!$sec->isLoggedIn()) { header("location: ../login.php"); exit; } if (isset($_POST['selected_employee'])) { $selected_employee = $_POST['selected_employee']; $date_range = $_POST['date_range']; $dates = explode(':', $date_range); $date1 = $dates[0]; $date2 = $dates[1]; } $first_name = $dbf->idToField($cfg_tableprefix . 'users', 'first_name', $selected_employee); $last_name = $dbf->idToField($cfg_tableprefix . 'users', 'last_name', $selected_employee); $display_name = $first_name . ' ' . $last_name; $display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang); $display->displayTitle("{$cfg_company} {$lang->employeeReport}"); $tableheaders = array("{$lang->rowID}", "{$lang->date}", "{$lang->customer}", "{$lang->itemsPurchased}", "{$lang->paidWith}", "{$lang->saleSubTotal}", "{$lang->saleTotalCost}", "{$lang->showSaleDetails}"); $tablefields = array('id', 'date', 'customer_id', 'items_purchased', 'paid_with', 'sale_sub_total', 'sale_total_cost', 'sale_details'); $display->displayReportTable("{$cfg_tableprefix}", 'sales', $tableheaders, $tablefields, 'sold_by', "{$selected_employee}", "{$date1}", "{$date2}", 'date', "{$lang->listOfSaleBy} {$display_name}<br>{$lang->between} {$date1} and {$date2}"); ?> </body> </html>
$quantity_value = $row['quantity']; $reorder_level_value = $row['reorder_level']; $id = $row['id']; } } else { $display->displayTitle("{$lang->addItem}"); } //creates a form object $f1 = new form('process_form_items.php', 'POST', 'items', '400', $cfg_theme, $lang); //creates form parts. $f1->createInputField("<b>{$lang->itemName}:</b> ", 'text', 'item_name', "{$item_name_value}", '24', '160'); $f1->createInputField("{$lang->description}: ", 'text', 'description', "{$description_value}", '24', '160'); $f1->createInputField("{$lang->itemNumber}: ", 'text', 'item_number', "{$item_number_value}", '24', '160'); $brandtable = "{$cfg_tableprefix}" . 'brands'; $brand_option_titles = $dbf->getAllElements("{$brandtable}", 'brand', 'brand'); $brand_option_titles[0] = $dbf->idToField("{$brandtable}", 'brand', "{$brand_id_value}"); $brand_option_values = $dbf->getAllElements("{$brandtable}", 'id', 'brand'); $brand_option_values[0] = $brand_id_value; $f1->createSelectField("<b>{$lang->brand}:</b>", 'brand_id', $brand_option_values, $brand_option_titles, '160'); $categorytable = "{$cfg_tableprefix}" . 'categories'; $category_option_titles = $dbf->getAllElements("{$categorytable}", 'category', 'category'); $category_option_titles[0] = $dbf->idToField("{$categorytable}", 'category', "{$category_id_value}"); $category_option_values = $dbf->getAllElements("{$categorytable}", 'id', 'category'); $category_option_values[0] = $category_id_value; $f1->createSelectField("<b>{$lang->category}:</b>", 'category_id', $category_option_values, $category_option_titles, '160'); $suppliertable = "{$cfg_tableprefix}" . 'suppliers'; $supplier_option_titles = $dbf->getAllElements("{$suppliertable}", 'supplier', 'supplier'); $supplier_option_titles[0] = $dbf->idToField("{$suppliertable}", 'supplier', "{$supplier_id_value}"); $supplier_option_values = $dbf->getAllElements("{$suppliertable}", 'id', 'supplier'); $supplier_option_values[0] = $supplier_id_value; $f1->createSelectField("<b>{$lang->supplier}:</b>", 'supplier_id', $supplier_option_values, $supplier_option_titles, '160');
echo "<tr><td align='left'><center><small><font color='white'>({$lang->scanInCustomer})</font></small></center>"; echo "<font color='white'>{$lang->customerID} / {$lang->accountNumber}: </font><input type='text' name='customer' size='6'>\n\t<input type='submit'></td></tr>\n\t</form>"; } if (isset($_SESSION['current_sale_customer_id'])) { if (isset($_POST['item'])) { $item = $_POST['item']; $discount = '0%'; if ($cfg_numberForBarcode == "Account/Item Number") { $item = $dbf->fieldToid($items_table, 'item_number', $_POST['item']); } if ($dbf->isValidItem($item)) { if ($dbf->isItemOnDiscount($item)) { $discount = $dbf->getPercentDiscount($item) . '%'; $itemPrice = $dbf->getDiscountedPrice($item); } else { $itemPrice = $dbf->idToField($items_table, 'unit_price', $item); } $itemTax = $dbf->idToField($items_table, 'tax_percent', $item); $_SESSION['items_in_sale'][] = $item . ' ' . $itemPrice . ' ' . $itemTax . ' ' . '1' . ' ' . $discount; } else { echo "{$lang->itemWithID}/{$lang->itemNumber} " . $_POST['item'] . ', ' . "{$lang->isNotValid}"; } } if (isset($_SESSION['items_in_sale'])) { $num_items = count($_SESSION['items_in_sale']); } else { $num_items = 0; } $temp_item_name = ''; $temp_item_id = ''; $temp_quantity = '';
<?php session_start(); include "settings.php"; include "language/{$cfg_language}"; include "classes/db_functions.php"; include "classes/security_functions.php"; $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, 'Public', $lang); if (!$sec->isLoggedIn()) { header("location: login.php"); exit; } $tablename = $cfg_tableprefix . 'users'; $auth = $dbf->idToField($tablename, 'type', $_SESSION['session_user_id']); $first_name = $dbf->idToField($tablename, 'first_name', $_SESSION['session_user_id']); $last_name = $dbf->idToField($tablename, 'last_name', $_SESSION['session_user_id']); $name = $first_name . ' ' . $last_name; $dbf->optimizeTables(); ?> <HTML> <head> </head> <body> <?php if ($auth == "Admin") { ?> <p> <img border="0" src="images/home_print.gif" width="33" height="29" valign="top"><font color="#005B7F" size="4"> <b><?php
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang); $sec = new security_functions($dbf, 'Report Viewer', $lang); if (!$sec->isLoggedIn()) { header("location: ../login.php"); exit; } if (isset($_POST['selected_category'])) { $selected_category = $_POST['selected_category']; $date_range = $_POST['date_range']; $dates = explode(':', $date_range); $date1 = $dates[0]; $date2 = $dates[1]; } $sales_table = $cfg_tableprefix . 'sales'; $sales_items_table = $cfg_tableprefix . 'sales_items'; $display_name = $dbf->idToField($cfg_tableprefix . 'categories', 'category', $selected_category); $display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang); $display->displayTitle("{$cfg_company} {$lang->categoryReport}"); $tableheaders = array("{$lang->saleID}", "{$lang->itemName}", "{$lang->unitPrice}", "{$lang->quantityPurchased}", "{$lang->tax}", "{$lang->itemTotalCost}"); $tablefields = array('sale_id', 'item_id', 'item_unit_price', 'quantity_purchased', 'item_total_tax', 'item_total_cost'); $result = mysql_query("SELECT * FROM {$sales_table} WHERE date between \"{$date1}\" and \"{$date2}\" ORDER BY id DESC", $dbf->conn); $result2 = mysql_query("SELECT * FROM {$sales_table} WHERE date between \"{$date1}\" and \"{$date2}\" ORDER BY id ASC", $dbf->conn); $row = mysql_fetch_assoc($result); $high_id = $row['id']; $row = mysql_fetch_assoc($result2); $low_id = $row['id']; $result3 = mysql_query("SELECT * FROM {$sales_items_table} WHERE sale_id BETWEEN \"{$low_id}\" and \"{$high_id}\" ORDER BY id DESC", $dbf->conn); echo "<center><h4><font color='{$display->list_of_color}'>{$lang->listOfSalesFor} {$display_name}<br>{$lang->between} {$date1} {$lang->and} {$date2}</font></h4></center>"; echo '<hr>'; if (@mysql_num_rows($result) == 0) { echo "<div align='center'>{$lang->noDataInTable} <b>{$sales_table}</b> {$lang->table}.</div>";
} $item_id = $_POST['item_id']; $sale_id = $_POST['sale_id']; $row_id = $_POST['row_id']; $old_quantity = $_POST['old_quantity']; //gets variables entered by user. $quantity_purchased = $_POST['quantity_purchased']; $item_unit_price = $_POST['item_unit_price']; $item_tax_percent = $_POST['item_tax_percent']; $item_total_tax = $item_unit_price * $quantity_purchased * ($item_tax_percent / 100); $item_total_cost = $item_unit_price * $quantity_purchased + $item_total_tax; $item_unit_price = number_format($item_unit_price, 2, '.', ''); $item_total_tax = number_format($item_total_tax, 2, '.', ''); $item_total_cost = number_format($item_total_cost, 2, '.', ''); $changeInQuantity = $old_quantity - $quantity_purchased; $currentQuantity = $dbf->idToField($cfg_tableprefix . 'items', 'quantity', $item_id); $newQuantity = $currentQuantity + $changeInQuantity; //insure all fields are filled in. if ($quantity_purchased == '' or $item_unit_price == '' or $item_tax_percent == '') { echo "{$lang->forgottenFields}"; exit; } } else { //outputs error message because user did not use form to fill out data. echo "{$lang->mustUseForm}"; exit; } $field_names = array('quantity_purchased', 'item_unit_price', 'item_tax_percent', 'item_total_tax', 'item_total_cost'); $field_data = array("{$quantity_purchased}", "{$item_unit_price}", "{$item_tax_percent}", "{$item_total_tax}", "{$item_total_cost}"); $dbf->update($field_names, $field_data, $tablename, $row_id, true); $dbf->updateItemQuantity($item_id, $newQuantity);
$dbf = new db_functions($cfg_server, $cfg_username, $cfg_password, $cfg_database, $cfg_tableprefix, $cfg_theme, $lang); $sec = new security_functions($dbf, 'Report Viewer', $lang); if (!$sec->isLoggedIn()) { header("location: ../login.php"); exit; } if (isset($_POST['selected_brand'])) { $selected_brand = $_POST['selected_brand']; $date_range = $_POST['date_range']; $dates = explode(':', $date_range); $date1 = $dates[0]; $date2 = $dates[1]; } $sales_table = $cfg_tableprefix . 'sales'; $sales_items_table = $cfg_tableprefix . 'sales_items'; $display_name = $dbf->idToField($cfg_tableprefix . 'brands', 'brand', $selected_brand); $display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang); $display->displayTitle("{$cfg_company} {$lang->brandReport}"); $tableheaders = array("{$lang->saleID}", "{$lang->itemName}", "{$lang->unitPrice}", "{$lang->quantityPurchased}", "{$lang->tax}", "{$lang->itemTotalCost}"); $tablefields = array('sale_id', 'item_id', 'item_unit_price', 'quantity_purchased', 'item_total_tax', 'item_total_cost'); $result = mysql_query("SELECT * FROM {$sales_table} WHERE date between \"{$date1}\" and \"{$date2}\" ORDER BY id DESC", $dbf->conn); $result2 = mysql_query("SELECT * FROM {$sales_table} WHERE date between \"{$date1}\" and \"{$date2}\" ORDER BY id ASC", $dbf->conn); $row = mysql_fetch_assoc($result); $high_id = $row['id']; $row = mysql_fetch_assoc($result2); $low_id = $row['id']; $result3 = mysql_query("SELECT * FROM {$sales_items_table} WHERE sale_id BETWEEN \"{$low_id}\" and \"{$high_id}\" ORDER BY id DESC", $dbf->conn); echo "<center><h4><font color='{$display->list_of_color}'>{$lang->listOfSalesFor} {$display_name}<br>{$lang->between} {$date1} {$lang->and} {$date2}</font></h4></center>"; echo '<hr>'; if (@mysql_num_rows($result) == 0) { echo "<div align='center'>{$lang->noDataInTable} <b>{$sales_table}</b> {$lang->table}.</div>";
} $table_bg = $display->sale_bg; $num_items = count($_SESSION['items_in_sale']); if ($num_items == 0) { echo "<b>{$lang->youMustSelectAtLeastOneItem}</b><br>"; echo "<a href=javascript:history.go(-1)>{$lang->refreshAndTryAgain}</a>"; exit; } $customers_table = $cfg_tableprefix . 'customers'; $items_table = $cfg_tableprefix . 'items'; $sales_items_table = $cfg_tableprefix . 'sales_items'; $sales_table = $cfg_tableprefix . 'sales'; //general sale info $paid_with = isset($_POST['paid_with']) ? $_POST['paid_with'] : ''; $comment = isset($_POST['comment']) ? $_POST['comment'] : ''; $customer_name = $dbf->idToField($customers_table, 'first_name', $_SESSION['current_sale_customer_id']) . ' ' . $dbf->idToField($customers_table, 'last_name', $_SESSION['current_sale_customer_id']); //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);
$tablename = "{$cfg_tableprefix}" . 'discounts'; $result = mysql_query("SELECT * FROM {$tablename} WHERE id=\"{$id}\"", $dbf->conn); $row = mysql_fetch_assoc($result); $item_id_value = $row['item_id']; $percent_off_value = $row['percent_off']; $comment_value = $row['comment']; } } else { $display->displayTitle("{$lang->addDiscount}"); } //creates a form object $f1 = new form('process_form_discounts.php', 'POST', 'discounts', '300', $cfg_theme, $lang); //creates form parts. $itemtable = "{$cfg_tableprefix}" . 'items'; $item_option_titles = $dbf->getAllElements("{$itemtable}", 'item_name', 'item_name'); $item_option_titles[0] = $dbf->idToField("{$itemtable}", 'item_name', "{$item_id_value}"); $item_option_values = $dbf->getAllElements("{$itemtable}", 'id', 'item_name'); $item_option_values[0] = $item_id_value; $f1->createSelectField("<b>{$lang->itemName}:</b>", 'item_id', $item_option_values, $item_option_titles, '160'); $f1->createInputField("<b>{$lang->percentOff}: (%)</b> ", 'text', 'percent_off', "{$percent_off_value}", '24', '150'); $f1->createInputField("{$lang->comment}: ", 'text', 'comment', "{$comment_value}", '24', '150'); //sends 2 hidden varibles needed for process_form_discounts.php. echo "\t\t\n\t\t<input type='hidden' name='action' value='{$action}'>\n\t\t<input type='hidden' name='id' value='{$id}'>"; $f1->endForm(); $dbf->closeDBlink(); ?> </body> </html>
header("location: ../login.php"); exit; } if (isset($_POST['selected_customer'])) { $selected_customer = $_POST['selected_customer']; $date_range = $_POST['month1']; $dates = explode(':', $date_range); $month1 = $_POST['month1']; $day1 = $_POST['day1']; $year1 = $_POST['year1']; $month2 = $_POST['month2']; $day2 = $_POST['day2']; $year2 = $_POST['year2']; $date1 = date("{$year1}-{$month1}-{$day1}"); $date2 = date("{$year2}-{$month2}-{$day2}"); } $first_name = $dbf->idToField($cfg_tableprefix . 'customers', 'first_name', $selected_customer); $last_name = $dbf->idToField($cfg_tableprefix . 'customers', 'last_name', $selected_customer); $display_name = $first_name . ' ' . $last_name; $display = new display($dbf->conn, $cfg_theme, $cfg_currency_symbol, $lang); $display->displayTitle("{$cfg_company} {$lang->customerReportDateRange}"); $tableheaders = array("{$lang->rowID}", "{$lang->date}", "{$lang->itemsPurchased}", "{$lang->paidWith}", "{$lang->soldBy}", "{$lang->saleSubTotal}", "{$lang->saleTotalCost}", "{$lang->showSaleDetails}"); $tablefields = array('id', 'date', 'items_purchased', 'paid_with', 'sold_by', 'sale_sub_total', 'sale_total_cost', 'sale_details'); $display->displayReportTable("{$cfg_tableprefix}", 'sales', $tableheaders, $tablefields, 'customer_id', "{$selected_customer}", "{$date1}", "{$date2}", 'date', "{$lang->listOfSalesFor} {$display_name}<br>{$lang->between} {$date1} {$lang->and} {$date2}"); ?> </body> </html>
<?php session_start(); include "settings.php"; include "language/{$cfg_language}"; include "classes/db_functions.php"; include "classes/security_functions.php"; //create 3 objects that are needed in this script. $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, 'Public', $lang); $tablename = $cfg_tableprefix . 'users'; $auth = $dbf->idToField($tablename, 'type', $_SESSION['session_user_id']); $userLoginName = $dbf->idToField($tablename, 'username', $_SESSION['session_user_id']); $dbf->closeDBlink(); // Display HTML-- ?> <HTML> <HEAD> <SCRIPT LANGUAGE="Javascript"> <!--- function decision(message, url) { if(confirm(message) ) { parent.location.href = url; } } // ---> </SCRIPT>
for ($k = 0; $k < count($tableheaders); $k++) { echo "<th align='center'>\n<font color='{$display->header_text_color}' face='{$display->headerfont_face}' size='{$display->headerfont_size}'>{$tableheaders[$k]}</font>\n</th>\n"; } echo '</tr>' . "\n\n"; $rowCounter = 0; $subtotal = 0; $total = 0; $brand_result = mysql_query("SELECT * FROM {$brands_table} order by brand"); while ($row = mysql_fetch_assoc($brand_result)) { $brands_id[] = $row['id']; $brands_name[] = $row['brand']; $brands_total[$row['id']] = 0; $brands_subtotal[$row['id']] = 0; } while ($row = mysql_fetch_assoc($result3)) { $brand_of_item = $dbf->idToField($cfg_tableprefix . 'items', 'brand_id', $row['item_id']); $brands_subtotal[$brand_of_item] += $row['item_total_cost'] - $row['item_total_tax']; $brands_total[$brand_of_item] += $row['item_total_cost']; } for ($k = 0; $k < count($brands_id); $k++) { if ($rowCounter % 2 == 0) { echo "\n<tr bgcolor={$display->rowcolor1}>\n"; } else { echo "\n<tr bgcolor={$display->rowcolor2}>\n"; } $id = $brands_id[$k]; $name = $brands_name[$k]; $subtotal = number_format($brands_subtotal[$id], 2, '.', ''); $total = number_format($brands_total[$id], 2, '.', ''); $tax = number_format($total - $subtotal, 2, '.', ''); echo "\n<td align='center'>\n<font color='{$display->rowcolor_text}' face='{$display->rowfont_face}' size='{$display->rowfont_size}'>{$name}</font>\n</td>\n";