www
/
wwwroot
/
magazinmiorita.be
/
admin
➕ New
📤 Upload
✎ Editing:
orders.php
← Back
<?php include('../includes/inc.config.php'); include('check_session.php'); $limit = 15; $page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]); $startpoint = ($page * $limit) - $limit; $search = ($_GET['search'] ? 'search='.$_GET['search'].'&' : ''); $url = '?'.$search.'page='; $set_view = $database->execute("UPDATE `orders` SET `view` = '1'"); $orders_results = array(); $search = ''; $src_key = $_GET['search']; if(isset($_GET['search']) && $_GET['search'] != '' || isset($_POST['search']) && $_POST['search'] != ''){ $orders = $database->execute("Select * from orders AS ord INNER JOIN customers AS cust ON ord.user_id = cust.id where cust.fname like '%$src_key%' or cust.lname like '%$src_key%' LIMIT {$startpoint} , {$limit}"); $statement = " orders AS ord INNER JOIN customers AS cust ON cust.id = ord.user_id where cust.fname like '%$src_key%' or cust.lname like '%$src_key%' "; }else{ $orders = $database->execute("Select * from orders LIMIT {$startpoint} , {$limit}"); $statement = ' `orders` '; } $orders_results = array(); while($row = $database->fetch($orders)){ $row['price'] = money_format('%.2n',$row['price']); $row['amount'] = money_format('%.2n',$row['amount']); $row['products'] = unserialize($row['history']); $txx = array(); $tt_tax1 = 0; $tt_tax2 = 0; foreach ($row['products'] as $key => $item){ $itemdata = explode('|',$item); $ch['qt'] = $itemdata[4]; $ch['price'] = $itemdata[3]; $ch['price_tax'] = ((int)($data->tax_data($data->item_data($itemdata[0],'tax')) ? $data->tax_data($data->item_data($itemdata[0],'tax')) : '6')/100)*$itemdata[3]; $ch['type'] = $itemdata[2]; $ch['weight'] = $itemdata[1]; $ch['item_id'] = $itemdata[0]; $ch['amount'] = $itemdata[3]*$itemdata[4]; $ch['calc_total'] += $ch['amount']; $ch['chsubtotal'] = $ch['calc_total']; $ch['chtotal'] = money_format('%.2n',$data->vat($ch['calc_total'],$data->settings('tax'))); $ch['ord_chtotal'] = $data->vat($ch['calc_total'],$data->settings('tax')); $ch['tax'] = ($data->tax_data($data->item_data($itemdata[0],'tax')) ? $data->tax_data($data->item_data($itemdata[0],'tax')) : '6'); if($data->item_data($itemdata[0],'tax') == 'tax_1'){ $part = $ch['tax']*$itemdata[3]; $tt_tax1 += $ch['price_tax']; }else if($data->item_data($itemdata[0],'tax') == 'tax_2'){ $part = $ch['tax']*$itemdata[3]; $tt_tax2 += $ch['price_tax']; }else{ $part = $ch['tax']*$itemdata[3]; $tt_tax1 += $ch['price_tax']; } $ch['key'] = $key; $cart_ch[] = $ch; } $total_tax1 = $tt_tax1; $total_tax2 = $tt_tax2; $row['total_amount'] = money_format('%.2n',$ch['chsubtotal'] + $total_tax1 + $total_tax2 ); $row['history'] = $cart_ch; $orders_results[] = $row; } $smarty->assign("chtotal", $ch['chtotal']); $smarty->assign("tax", $ch['tax']); $smarty->assign("total_tax1", money_format('%.2n',$total_tax1)); $smarty->assign("total_tax2", money_format('%.2n',$total_tax2)); $smarty->assign("chsubtotal", money_format('%.2n',$ch['chsubtotal'] - $total_tax1 - $total_tax2)); if(isset($_GET['action']) && $_GET['action'] == 'delete'){ $del_order = $database->execute("DELETE FROM `orders` WHERE `id` = '".$_GET['id']."'"); $del_Tranzaction = $database->execute("DELETE FROM `tranzactions` WHERE `order_id` = '".$_GET['id']."'"); if($del_order){ $_SESSION['message'] = 'Order deleted successfully!'; $_SESSION['mtype'] = 'succ'; header("Location: orders.php"); exit; } } $smarty->assign('pagination', $data->apagination($statement,$limit,$page,$url)); $smarty->assign("orders", $orders_results); $smarty->display(END_PATH.'orders.tpl'); ?>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel