ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/check-cargo-awb.php |
<?php ob_start(); session_start(); include("inc/config.php"); date_default_timezone_set('Asia/Kolkata'); $date = date("Y-m-d"); if(isset($_POST["id"])) { $name = $_POST["id"]; if(isset($_POST["destination"])){$destination = $_POST["destination"];}else{ $destination=''; } if(isset($_POST["gvalue"])){$gvalue = $_POST["gvalue"];}else{ $gvalue=''; } /*Temporary Status Check Diable*/ /*if($gvalue==2){ $statement = $pdo->prepare("SELECT tbl_customer.cust_name as customer_name,tbl_customer.cust_code as dpcode,pickup_entry.*,tbl_user.full_name as client_name FROM `pickup_entry` INNER JOIN tbl_user INNER JOIN tbl_customer ON pickup_entry.client_id=tbl_user.id AND pickup_entry.customer_id=tbl_customer.cust_id WHERE tbl_user.role='Cargo' and (pickup_entry.status='pending' or pickup_entry.status='picked') and pickup_entry.ref_no='$name' order by pickup_entry.id asc limit 1"); }else { $statement = $pdo->prepare("SELECT tbl_customer.cust_name as customer_name,tbl_customer.cust_code as dpcode,pickup_entry.*,tbl_user.full_name as client_name FROM `pickup_entry` INNER JOIN tbl_user INNER JOIN tbl_customer ON pickup_entry.client_id=tbl_user.id AND pickup_entry.customer_id=tbl_customer.cust_id WHERE tbl_user.role='Cargo' and (pickup_entry.status='pending' or pickup_entry.status='picked') and pickup_entry.ref_no like '%".$name."%' order by pickup_entry.id asc limit 5"); }*/ if($gvalue==2){ $statement = $pdo->prepare("SELECT tbl_customer.cust_name as customer_name,tbl_customer.cust_code as dpcode,pickup_entry.*,tbl_user.full_name as client_name FROM `pickup_entry` INNER JOIN tbl_user INNER JOIN tbl_customer ON pickup_entry.client_id=tbl_user.id AND pickup_entry.customer_id=tbl_customer.cust_id WHERE tbl_user.role='Cargo' and pickup_entry.ref_no='$name' order by pickup_entry.id asc limit 1"); }else { $statement = $pdo->prepare("SELECT tbl_customer.cust_name as customer_name,tbl_customer.cust_code as dpcode,pickup_entry.*,tbl_user.full_name as client_name FROM `pickup_entry` INNER JOIN tbl_user INNER JOIN tbl_customer ON pickup_entry.client_id=tbl_user.id AND pickup_entry.customer_id=tbl_customer.cust_id WHERE tbl_user.role='Cargo' and pickup_entry.ref_no like '%".$name."%' order by pickup_entry.id asc limit 5"); } $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count=$statement->rowCount(); if($count==1) { foreach ($result as $row) { $id = $row['id']; $read_status = $row['read_status']; $customer_name = $row['customer_name']; $dpcode = $row['dpcode']; $ref_no = $row['ref_no']; $pics = $row['pics']; $address = $row['address']; $phone = $row['phone']; $c_weight = $row['c_weight']; $destination = $row['destination']; $client_id = $row['client_name']; $created_at = $row['created_at']; $created_at=date_create($row['created_at']); $created_at=date_format($created_at,'Y-m-d'); $invoice_no = $row['invoice_no']; $invoice_value = $row['invoice_value']; $e_way_bill_no = $row['e_way_bill_no']; $a_weight = $row['a_weight']; $length1= $row['length1']; $width1= $row['width1']; $height1= $row['height1']; $nob1= $row['nob1']; $act_wt1= $row['act_wt1']; $length2= $row['length2']; $width2= $row['width2']; $height2= $row['height2']; $nob2= $row['nob2']; $act_wt2= $row['act_wt2']; $length3= $row['length3']; $width3= $row['width3']; $height3= $row['height3']; $nob3= $row['nob3']; $act_wt3= $row['act_wt3']; $length4= $row['length4']; $width4= $row['width4']; $height4= $row['height4']; $nob4= $row['nob4']; $act_wt4= $row['act_wt4']; $length5= $row['length5']; $width5= $row['width5']; $height5= $row['height5']; $nob5= $row['nob5']; $act_wt5= $row['act_wt5']; if($length1==""){$length1=0;}if($width1==""){$width1=0;}if($length1==""){$length1=0;}if($height1==""){$height1=0;}if($nob1==""){$nob1=0;}if($act_wt1==""){$act_wt1=0;} if($length2==""){$length2=0;}if($width2==""){$width2=0;}if($length2==""){$length2=0;}if($height2==""){$height2=0;}if($nob2==""){$nob2=0;}if($act_wt2==""){$act_wt2=0;} if($length3==""){$length3=0;}if($width3==""){$width3=0;}if($length3==""){$length3=0;}if($height3==""){$height3=0;}if($nob3==""){$nob3=0;}if($act_wt3==""){$act_wt3=0;} if($length4==""){$length4=0;}if($width4==""){$width4=0;}if($length4==""){$length4=0;}if($height4==""){$height4=0;}if($nob4==""){$nob4=0;}if($act_wt4==""){$act_wt4=0;} if($length5==""){$length5=0;}if($width5==""){$width5=0;}if($length5==""){$length5=0;}if($height5==""){$height5=0;}if($nob5==""){$nob5=0;}if($act_wt5==""){$act_wt5=0;} } $status="Success"; $datas[] = array('invoice_no'=>$invoice_no,'invoice_value'=>$invoice_value,'e_way_bill_no'=>$e_way_bill_no,'a_weight'=>$a_weight,'dpcode'=>$dpcode,'read_status'=> $read_status,'customer_name'=>$customer_name,'id' => $id,'status'=>$status,'ref_no'=>$ref_no,'pics'=>$pics,'address'=>$address,'phone'=>$phone,'c_weight'=>$c_weight,'destination'=>$destination,'client_id'=>$client_id,'created'=>$created_at,'today'=>$date,'length1'=>$length1,'width1'=>$width1,'height1'=>$height1,'nob1'=>$nob1,'act_wt1'=>$act_wt1,'length2'=>$length2,'width2'=>$width2,'height2'=>$height2,'nob2'=>$nob2,'act_wt2'=>$act_wt2,'length3'=>$length3,'width3'=>$width3,'height3'=>$height3,'nob3'=>$nob3,'act_wt3'=>$act_wt3,'length4'=>$length4,'width4'=>$width4,'height4'=>$height4,'nob4'=>$nob4,'act_wt4'=>$act_wt4,'length5'=>$length5,'width5'=>$width5,'height5'=>$height5,'nob5'=>$nob5,'act_wt5'=>$act_wt5); echo json_encode($datas); } elseif($count==0) { $id=0; $status="Invalid AWB Number"; $datas[] = array('id' => $id,'status'=>$status); echo json_encode($datas); } else { foreach ($result as $row) { $id = $row['id']; $read_status = $row['read_status']; $customer_name = $row['customer_name']; $dpcode = $row['dpcode']; $ref_no = $row['ref_no']; $pics = $row['pics']; $address = $row['address']; $phone = $row['phone']; $c_weight = $row['c_weight']; $destination = $row['destination']; $client_id = $row['client_name']; $created_at = $row['created_at']; $created_at=date_create($row['created_at']); $created_at=date_format($created_at,'Y-m-d'); $invoice_no = $row['invoice_no']; $invoice_value = $row['invoice_value']; $e_way_bill_no = $row['e_way_bill_no']; $a_weight = $row['a_weight']; $status=2; $datas[] = array('invoice_no'=>$invoice_no,'invoice_value'=>$invoice_value,'e_way_bill_no'=>$e_way_bill_no,'a_weight'=>$a_weight,'dpcode'=>$dpcode,'read_status'=> $read_status,'customer_name'=>$customer_name,'id' => $id,'status'=>$status,'ref_no'=>$ref_no,'pics'=>$pics,'address'=>$address,'phone'=>$phone,'c_weight'=>$c_weight,'destination'=>$destination,'client_id'=>$client_id,'created'=>$created_at,'today'=>$date); } echo json_encode($datas); } } ?>