ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/pickup_add_ajax.php |
<?php ob_start(); session_start(); $clientId=$_SESSION['user']['id']; $clientLocation=$_SESSION['user']['location']; $clientType=$_SESSION['user']['role']; // $location=$_POST['location']; include("inc/config.php"); // var_dump($_POST); $valid = 1; // ********************************** Generate AWB No Start ******************************************** $statement = $pdo->prepare("SELECT MAX(id) as big_id FROM pickup_entry"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); //$rows = mysqli_num_rows($result); foreach ($result as $row) { $bid=$row['big_id']; //print_r($bid); if($bid!='') { $awb_n=$row['big_id']+1; $awb_no=1000001+$awb_n; } else { $awb_no=1000001; } } if($clientType=='Admin') { $pic_status='picked'; $pic_desc='Entry Successfully Picked'; } else { /*$pic_status='pending'; $pic_desc='Shipment soft data uploaded successfully';*/ $pic_status='picked'; $pic_desc='Entry Successfully Picked'; } if($valid==1) { $statement = $pdo->prepare("SHOW TABLE STATUS LIKE 'pickup_entry'"); $statement->execute(); $result = $statement->fetchAll(); foreach($result as $row) { $ai_id=$row[10]; } $custs_name='';$custs_db_code=''; $statement1 = $pdo->prepare("SELECT * FROM tbl_customer where cust_id=".$_POST['customer_id']); $statement1->execute(); $result1= $statement1->fetchAll(PDO::FETCH_ASSOC); foreach ($result1 as $row1) { $custs_name = $row1['cust_name']; $custs_db_code=$row1['cust_code']; } date_default_timezone_set('Asia/Kolkata'); //$date = date('Y/m/d h:i:s a', time()); $statement = $pdo->prepare("INSERT INTO pickup_entry (awb_no,ref_no,client_id,status,pincode,shipping_mode,customer_id,address,city,state,phone,c_weight,a_weight,content_desc,total_charges,other_charges,payment_mode,pics,gst_no,destination,created_at,last_updated_status_date,delivered_date,pickup_customer_name,pickup_customer_dbcode) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $result1=$statement->execute(array($awb_no,$_POST['awb_no'],$_POST['client_id'],$pic_status,$_POST['pincode'],$_POST['shipping_mode'],$_POST['customer_id'],$_POST['address'],$_POST['city'],$_POST['state'],$_POST['phone'],$_POST['a_weight'],$_POST['a_weight'],$_POST['content_desc'],$_POST['total_charges'],$_POST['other_charges'],$_POST['payment_mode'],$_POST['pics'],$_POST['gst_no'],$_POST['destination'],$_POST['created'],$_POST['created'],$_POST['created'],$custs_name,$custs_db_code)); $statement_update = $pdo->prepare("UPDATE tbl_awb set status=0 WHERE awb_code='".$_POST['awb_no']."'"); $statement_update->execute(); /*Tracking Module Start*/ $statement = $pdo->prepare("INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark,created_at) VALUES (?,?,?,?,?,?,?)"); $result2=$statement->execute(array($ai_id,$clientId,$clientLocation,$pic_status,$pic_desc,'Material Safe...',$_POST['created'])); } if($result1==1 && $result2==1) { $txt='Success..'; $error='1'; } else { $txt='Failed..'; $error='0'; } $datas[] = array('txt' => $txt, 'error' => $error,'awb_number'=>$awb_no,'p_id'=>$ai_id); echo json_encode($datas); ?>