function display_orders($status) { $warehouse = SCA::getService('../WarehouseService/WarehouseService.php'); $orders = $warehouse->getOrdersByStatus($status); if (count($orders->order) == 0) { echo "None\n"; return; } include_once "./table.php"; table_start(); table_row_start(); table_cell('<b>Order ID</b>', '#DDDDFF'); table_cell('<b>Name</b>', '#DDDDFF'); table_cell('<b>Status</b>', '#DDDDFF'); table_row_end(); $odd = false; foreach ($orders->order as $order) { table_row_start(); if (!$odd) { table_cell("<a href=\"./order_details.php?orderId=" . $order->orderId . "\">" . $order->orderId . "</a>"); table_cell(isset($order->customer->name) ? $order->customer->name : 'no name supplied'); table_cell($order->status); } else { table_cell("<a href=\"./order_details.php?orderId=" . $order->orderId . "\">" . $order->orderId . "</a>", '#DDFFFF'); table_cell(isset($order->customer->name) ? $order->customer->name : 'no name supplied', '#DDFFFF'); table_cell($order->status, '#DDFFFF'); } $odd = !$odd; table_row_end(); } table_end(); }
function display_cart($cart) { $cell_colour = "#DDFFFF"; table_start(); table_row_start(); table_cell('<b>Product</b>', $cell_colour); table_cell('<b>Quantity</b>', $cell_colour); table_cell('<b>Price</b>', $cell_colour); table_row_end(); $total = 0; foreach ($cart->item as $value) { table_row_start(); table_cell($value->description); table_cell($value->quantity); table_cell($value->price * $value->quantity); $total += $value->price * $value->quantity; table_row_end(); } table_row_start(); table_cell(''); table_cell('<b> Total </b>', $cell_colour); table_cell("<b>{$total}<b>", $cell_colour); table_row_end(); table_end(); }
function display_catalog($catalog) { table_start(); table_row_start(); table_cell('Product'); table_cell('Price'); table_row_end(); foreach ($catalog->item as $value) { table_row_start(); table_cell('<a href="view_product.php?product_code=' . $value->itemId . '">' . $value->description . '</a>'); table_cell($value->price); table_row_end(); } table_end(); }
function display_customer($customer) { table_start(); table_row_start(); table_cell('<b>Name</b>', '#DDFFFF'); table_cell(isset($customer->name) ? $customer->name : 'no name supplied'); table_row_end(); $address_labels = array('Street', 'City', 'State', 'Zip'); $i = 0; foreach ($customer->shipping as $value) { table_row_start(); table_cell('<b>' . $address_labels[$i++] . '</b>', '#DDFFFF'); table_cell($value); table_row_end(); } table_end(); }
function display_events($events) { include_once "table.php"; table_start(); table_row_start(); table_cell('<b>Date</b>', '#DDDDFF'); table_cell('<b>Status</b>', '#DDDDFF'); table_cell('<b>Description</b>', '#DDDDFF'); table_row_end(); foreach ($events->event as $event) { table_row_start(); table_cell($event->timeStamp); table_cell($event->status); table_cell($event->description); table_row_end(); } table_end(); }