www
/
wwwroot
/
magazinmiorita.be
/
admin
➕ New
📤 Upload
✎ Editing:
order_details.php
← Back
<?php include('../includes/inc.config.php'); if(!isset($_GET['print'])){ include('check_session.php'); } //ini_set("display_errors",1); if(isset($_GET['action']) && $_GET['action'] == 'cancel'){ $update_order = $database->execute("update orders set `status` = '2' where id = '".$_GET['id']."'"); $update_tranz = $database->execute("update tranzactions set `status` = '2' where order_id = '".$_GET['id']."'"); if($update_order && $update_tranz){ $message = 'Order was set as canceled!'; $msg_type = 'succ'; }else{ $message = 'Order can not be set as canceled! Please check and try again.'; $msg_type = 'err'; } } if(isset($_GET['action']) && $_GET['action'] == 'delete'){ $get_stock = $database->execute("select * from orders where id = '".$_GET['id']."'"); $dt = $database->assoc($get_stock); $array = unserialize($dt['history']); foreach($array as $his){ $dd = explode('|',$his); $qty = $dd[4]; $code = $dd[6]; $update_local_stock = $database->execute("update products set `sku` = 'sku + $qty' where code = '".$code."'"); } $delete_order = $database->execute("delete from orders where id = '".$_GET['id']."'"); $delete_tranz = $database->execute("delete from tranzactions where order_id = '".$_GET['id']."'"); if($delete_order && $delete_tranz){ header('Location: orders.php?m=dok'); exit; }else{ $message = 'Order can not be deleted! Please check and try again.'; $msg_type = 'err'; } } if(isset($_GET['action']) && $_GET['action'] == 'accept'){ $get_stock = $database->execute("select * from orders where id = '".$_GET['id']."'"); $dt = $database->assoc($get_stock); $array = unserialize($dt['history']); foreach($array as $key=>$val){ $dd = explode('|',$val); $qty = $dd[4]; $code = $dd[6]; $update_local_stock = $database->execute("update products set `sku` = sku - $qty where code = '".$code."'"); //$update_stock = $rsql->execute("update products set `sku` = sku - $qty where code = '".$code."'"); } $update_order = $database->execute("update orders set `status` = '1' where id = '".$_GET['id']."'"); $update_tranz = $database->execute("update tranzactions set `status` = '1' where order_id = '".$_GET['id']."'"); if($update_order && $update_tranz){ $message = 'Order was set as paid successfully!'; $msg_type = 'succ'; }else{ $message = 'Order can not be set as paid! Please check and try again.'; $msg_type = 'err'; } } if(isset($_GET['action']) && $_GET['action'] == 'tranzit'){ $update_order = $database->execute("update orders set `status` = '3' where id = '".$_GET['id']."'"); if($update_order){ $message = 'Order was set as is on tranzit!'; $msg_type = 'succ'; }else{ $message = 'Order can not be updated! Please check and try again.'; $msg_type = 'err'; } } $get_orders_results = array(); $get_orders = $database->execute(" SELECT * FROM `orders` WHERE `id` = '".$_GET['id']."' "); while($row = $database->fetch($get_orders)){ $row['price'] = money_format('%.2n',$row['price']); $row['amount'] = money_format('%.2n',$row['amount']); $row['products'] = unserialize($row['history']); $txx = array(); $get_taxes = $database->execute("SELECT * FROM `taxes`"); $totals = 0; $total_tax = 0; $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['tax'] = $txx; $row['history'] = $cart_ch; $get_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)); $smarty->assign("order", $get_orders_results); $smarty->display(END_PATH.'order_details.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