ok
Direktori : /home2/selectio/public_html/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/public_html/lilyexpresslive/software/admin/pickup_edit_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; $id=$_POST['print_id']; if(empty($_POST['awb_no'])) { $valid = 0; $error_message .= 'AWB Number can not be empty..<br>'; } elseif(($_POST['awb_no']!=$_POST['old_awb_value'])) { $new_ref=$_POST['awb_no']; $statement = $pdo->prepare("SELECT * FROM pickup_entry WHERE ref_no=?"); $statement->execute(array($new_ref)); $total = $statement->rowCount(); if( $total ==0 ) { $new_awb=$new_ref; } else { $valid = 0; $error_message .= 'AWB Number already Exists..<br>'; } } else { $new_awb=$_POST['awb_no']; } if($valid==1) { $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("UPDATE pickup_entry SET ref_no=?,client_id=?,pincode=?,customer_id=?,address=?,city=?,state=?,phone=?,c_weight=?,a_weight=?,pics=?,gst_no=?,destination=?,created_at=?,pickup_customer_name=?,pickup_customer_dbcode=? WHERE id=?"); $result=$statement->execute(array($new_awb,$_POST['client_id'],$_POST['pincode'],$_POST['customer_id'],$_POST['address'],$_POST['city'],$_POST['state'],$_POST['phone'],$_POST['a_weight'],$_POST['a_weight'],$_POST['pics'],$_POST['gst_no'],$_POST['destination'],$_POST['created'],$custs_name,$custs_db_code,$_REQUEST['id'])); $statement = $pdo->prepare("UPDATE tbl_customer SET destination_city=? WHERE cust_id=?"); $result=$statement->execute(array($_POST['destination'],$_POST['customer_id'])); } elseif($valid==0){ $result=0;} if($result==1) { $txt='Success..'; $error='1'; } else { $txt='Failed..'; $error='0'; } $datas[] = array('txt' => $txt, 'error' => $error,'awb_number'=>$_REQUEST['id']); echo json_encode($datas); ?>