$totals['shipping'] = 0; $totals['cost'] = 0; foreach ($invoices as $key => $inv) { $totals['tax'] += $inv['tax']; $totals['tax2'] += $inv['tax2']; $totals['shipping'] += $inv['shipping']; $totals['cost'] += $inv['cost']; $invoices[$key]['issue_date'] = date($SYSTEM["regional"]["invoicedate"], $invoices[$key]['issue_date']); $invoices[$key]['due_date'] = date($SYSTEM["regional"]["invoicedate"], $invoices[$key]['due_date']); $invoices[$key]['tax'] = currency_format($inv['tax']); $invoices[$key]['tax2'] = currency_format($inv['tax2']); $invoices[$key]['shipping'] = currency_format($inv['shipping']); $invoices[$key]['cost'] = currency_format($inv['cost']); $invoices[$key]['total'] = currency_format($inv['total']); } $totals['total'] = $totals['cost'] + $totals['tax'] + $totals['tax2'] + $totals['shipping']; $totals['cost'] = currency_format($totals['cost']); $totals['tax'] = currency_format($totals['tax']); $totals['tax2'] = currency_format($totals['tax2']); $totals['shipping'] = currency_format($totals['shipping']); $totals['total'] = currency_format($totals['total']); $tpl->set('item', $item); $tpl->set('value', $value); $tpl->set('param', $param); $tpl->set('search', $search); $tpl->set('invoices', $invoices); $tpl->set('message', $message); $tpl->set('totals', $totals); $tpl->display(); releaseConnection($db);
function addAdminAccount() { require_once 'DB.php'; $TC = new TypicalConfig(SITE_ROOT . 'includes/config.php'); $TC->loadConfig(); $config = $TC->getVars('var'); unset($TC); $dsn = $config['db_type'] . "://" . $config['db_user'] . ":" . $config['db_pass'] . "@" . $config['db_host'] . "/" . $config['db_name']; $check = acquireConnection($db, $dsn); if (!$check) { $db_prefix = $config['db_prefix']; include 'sql_admin.php'; echo "<p>Inserting Admin Account..."; $error = array(); $result = $db->query($sql); $err = checkDBError($result); if ($err) { $error[] = $err . " ::> " . $sql; echo '<span class="check_fail">FAILED!</span></p><p>The error message was:<b> ' . $err . '</b><br>on the query:<br>' . $sql; die; } echo '<span class="check_pass">DONE!</span></p>'; releaseConnection($db); return true; } return false; }