D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
salvation.incrediblebengal.com
/
admin
/
Filename :
get_deliveryDetails.php
back
Copy
<?php include "config.php"; include "function.php"; error_reporting(); $entry = $_POST['entryId']; $cust_phone = $_POST['custPhone']; $cust_name = $_POST['custName']; $cust_address = $_POST['custAddress']; $totalPrice = $_POST['total_price']; $order_type = $_POST['order_type']; $waiter_name = $_SESSION['restroUser']; $ip_add = getUserIP(); $order_status = "running"; $waiter_name = "Warner"; $order_date = getOrderDate(); $order_datetime = getOrderDateTime(); if($entry == 1){ if(!empty($cust_phone) && !empty($order_type)){ // echo $cust_phone ."</br>".; // $totalPrice = 0; $check_ordr = "SELECT * FROM delivery_order WHERE customer_phone = $cust_phone AND order_date = '$order_date' AND order_type = '$order_type'"; $res = mysqli_query($conn, $check_ordr); if (mysqli_num_rows($res) > 0) { echo '<script>alert("Order Already in Process.")</script>'; } else{ $insrt_order = "INSERT INTO delivery_order (order_id, customer_phone, total_payment, order_type, order_status, order_date, waiter_name, customer_ip) VALUES ('', $cust_phone, $totalPrice, '$order_type', '$order_status', '$order_date', '$waiter_name', '$ip_add')"; $run_order= mysqli_query($conn, $insrt_order) or die("Data Entry Failed."); "<script>alert('Data inserted into Delivery Order.')</script>"; } $check_cust = "SELECT * FROM customer_details WHERE customer_phone = '$cust_phone' AND customer_name = '$cust_name'"; $run_cust_query = mysqli_query($conn,$check_cust) or die("not checking customer data."); if (mysqli_num_rows($run_cust_query) > 0){ echo '<script>alert("Already previous Customer .")</script>'; // echo '<script>window.location="table-order.php"</script>'; } else{ $insert_cust = "INSERT INTO customer_details (customer_id, customer_name, customer_phone, customer_address) VALUES ('', '$cust_name', $cust_phone, '$cust_address')"; $run_cust = mysqli_query($conn, $insert_cust) or die("Data Entry Failed."); if (!$run_cust) { echo "Customer Data not inserted."; } } $show_num = "SELECT * FROM delivery_order WHERE order_type = '$order_type' AND order_date = '$order_date' AND order_status = 'running' AND customer_phone = $cust_phone"; $run_show_num = mysqli_query($conn, $show_num); $row = mysqli_fetch_assoc($run_show_num); $order_id = $row['order_id']; // $check_cust = "SELECT * FROM delivery_orderlist WHERE customer_phone = '$cust_phone' AND "; // $run_cust_query = mysqli_query($conn,$check_cust) or die("not checking customer data."); // if (mysqli_num_rows($run_cust_query) > 0){ // echo '<script>alert("Already previous Customer .")</script>'; // // echo '<script>window.location="table-order.php"</script>'; // } $show_orderlist = "SELECT * FROM delivery_cart"; $connect_orderlist = mysqli_query($conn, $show_orderlist); while($rec = mysqli_fetch_assoc($connect_orderlist)){ $food_id = $rec['food_id']; $food_name = $rec['food_name']; $food_price = $rec['food_price']; $food_qty = $rec['food_qty']; $food_subtotal = $rec['food_subtotal']; $food_id = $rec['food_id']; $insert_orderlist = "INSERT INTO delivery_orderlist(order_id, order_type, food_id, food_name, food_price, food_qty, food_subtotal, order_date, customer_phone) VALUES($order_id, '$order_type', $food_id, '$food_name', $food_price, $food_qty, $food_subtotal, '$order_date', $cust_phone)"; $query_orderlist = mysqli_query($conn, $insert_orderlist) or die("Failed to move data."); } // $run_editItems = mysqli_query($conn, $edit_tableItems) or die("Update Failed."); // echo '<script>window.location="new-order.php"</script>'; } } $del_cart = "DELETE FROM `delivery_cart`"; $run_delCart = mysqli_query($conn, $del_cart) or die(mysqli_error()); if (!$run_delCart) { $status = '<div class="alert alert-success" role="alert" data-auto-dismiss="3000">Delivery cart not empty.</div>'; } header("location: print-pdf/takeAway_kot.php?order_date=$order_date&customer_phone=$cust_phone&order_id=$order_id"); ?>