ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/get_cargo_unique_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['awb'])){ $awb = $_POST['awb']; } $type = $_POST['type']; if($type=='easyEdit'){ $success=array(); $awb_id=array(); $invoice_no=array(); $invoice_value=array(); $e_way_bill_no=array(); $nob=array(); $created_date=array(); $a_weight=array(); $c_weight=array(); $length1=array();$width1=array();$height1=array();$nob1=array();$act_wt1=array(); $length2=array();$width2=array();$height2=array();$nob2=array();$act_wt2=array(); $length3=array();$width3=array();$height3=array();$nob3=array();$act_wt3=array(); $length4=array();$width4=array();$height4=array();$nob4=array();$act_wt4=array(); $length5=array();$width5=array();$height5=array();$nob5=array();$act_wt5=array(); $destination=array(); $awb_id = $_POST['awb_id']; $awb_id = $_POST['awb_id']; $invoice_no = $_POST['invoice_no']; $invoice_value = $_POST['invoice_value']; $e_way_bill_no = $_POST['e_way_bill_no']; $nob = $_POST['nob']; $a_weight = $_POST['a_weight']; $c_weight = $_POST['c_weight']; $created_date=$_POST['date']; $length1 = $_POST['length1'];$width1 = $_POST['width1'];$height1 = $_POST['height1'];$nob1 = $_POST['nob1'];$act_wt1 = $_POST['act_wt1']; $length2 = $_POST['length2'];$width2 = $_POST['width2'];$height2 = $_POST['height2'];$nob2 = $_POST['nob2'];$act_wt2 = $_POST['act_wt2']; $length3 = $_POST['length3'];$width3 = $_POST['width3'];$height3 = $_POST['height3'];$nob3 = $_POST['nob3'];$act_wt3 = $_POST['act_wt3']; $length4 = $_POST['length4'];$width4 = $_POST['width4'];$height4 = $_POST['height4'];$nob4 = $_POST['nob4'];$act_wt4 = $_POST['act_wt4']; $length5 = $_POST['length5'];$width5 = $_POST['width5'];$height5 = $_POST['height5'];$nob5 = $_POST['nob5'];$act_wt5 = $_POST['act_wt5']; $destination = $_POST['destination']; $update_date="2022-03-12"; $clientId=$_POST['user_id']; $clientLocation=$_POST['user_location']; $i=0; $statement = $pdo->prepare("SELECT MAX(read_count) as readCount FROM `pickup_entry`"); $statement->execute(); $get_data = $statement->fetchAll(PDO::FETCH_ASSOC); foreach($get_data as $data) { $readCount=$data['readCount']; } if($readCount=='' || empty($readCount)){ $readCount=1; } foreach($awb_id as $id) { $readCount=$readCount+1;; $state = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE id='$id'"); $state->execute(); $get_data = $state->fetchAll(PDO::FETCH_ASSOC); foreach($get_data as $get) { $ref=$get['ref_no']; $c_nop=$get['pics']; } if(!is_numeric($c_nop) || empty($c_nop)){ $c_nop=0; } $statement = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE id=?"); $statement->execute(array($id)); $get_data = $statement->fetchAll(PDO::FETCH_ASSOC); foreach($get_data as $data) { $c_status=$data['status']; } if($c_status=='pending') { $statement = $pdo->prepare("UPDATE `pickup_entry` set invoice_no=?,invoice_value=?,e_way_bill_no=?,pics=?,a_weight=?,c_weight=?,length1=?,width1=?,height1=?,nob1=?,act_wt1=?,length2=?,width2=?,height2=?,nob2=?,act_wt2=?,length3=?,width3=?,height3=?,nob3=?,act_wt3=?,length4=?,width4=?,height4=?,nob4=?,act_wt4=?,length5=?,width5=?,height5=?,nob5=?,act_wt5=?,status=?,read_status=?,read_count=?,created_at=?,destination=? WHERE id=?"); $result=$statement->execute(array($invoice_no[$i],$invoice_value[$i],$e_way_bill_no[$i],$nob[$i],$a_weight[$i],$c_weight[$i],$length1[$i],$width1[$i],$height1[$i],$nob1[$i],$act_wt1[$i],$length2[$i],$width2[$i],$height2[$i],$nob2[$i],$act_wt2[$i],$length3[$i],$width3[$i],$height3[$i],$nob3[$i],$act_wt3[$i],$length4[$i],$width4[$i],$height4[$i],$nob4[$i],$act_wt4[$i],$length5[$i],$width5[$i],$height5[$i],$nob5[$i],$act_wt5[$i],'picked',0,$readCount,$created_date[$i],$destination[$i],$id)); $statement = $pdo->prepare("INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark,created_at) VALUES(?,?,?,?,?,?,?)"); $statement->execute(array($id,$clientId,$clientLocation,'picked','Entry Successfully Picked','Material Safe...',$created_date[$i])); } else{ /*$statement = $pdo->prepare("UPDATE `pickup_entry` set pics=?,read_status=?,read_count=?,created_at=? WHERE id=?"); $result=$statement->execute(array($nob[$i],0,$readCount,$update_date,$id));*/ $statement = $pdo->prepare("UPDATE `pickup_entry` set invoice_no=?,invoice_value=?,e_way_bill_no=?,pics=?,a_weight=?,c_weight=?,length1=?,width1=?,height1=?,nob1=?,act_wt1=?,length2=?,width2=?,height2=?,nob2=?,act_wt2=?,length3=?,width3=?,height3=?,nob3=?,act_wt3=?,length4=?,width4=?,height4=?,nob4=?,act_wt4=?,length5=?,width5=?,height5=?,nob5=?,act_wt5=?,status=?,read_status=?,read_count=?,created_at=?,destination=? WHERE id=?"); $result=$statement->execute(array($invoice_no[$i],$invoice_value[$i],$e_way_bill_no[$i],$nob[$i],$a_weight[$i],$c_weight[$i],$length1[$i],$width1[$i],$height1[$i],$nob1[$i],$act_wt1[$i],$length2[$i],$width2[$i],$height2[$i],$nob2[$i],$act_wt2[$i],$length3[$i],$width3[$i],$height3[$i],$nob3[$i],$act_wt3[$i],$length4[$i],$width4[$i],$height4[$i],$nob4[$i],$act_wt4[$i],$length5[$i],$width5[$i],$height5[$i],$nob5[$i],$act_wt5[$i],'picked',0,$readCount,$created_date[$i],$destination[$i],$id)); } if($result){ $success[]="For AWB-".$ref." No.of Pieces Changed From ".$c_nop." to ".$nob[$i]."inv no : ".$invoice_no[$i]." Successfully"; } $i++; } if($result) { $txt='AWB Number is already taken'; $error='1'; } else { $txt='AWB Number is available'; $error='0'; } } if($type=='awb_no'){ $statement = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE ref_no='$awb'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count = $statement->rowCount(); if($count>0) { $txt='AWB Number is already taken'; $error='1'; } else { $txt='AWB Number is available'; $error='0'; } } if($type=='dpcode'){ $statement = $pdo->prepare("SELECT * FROM `tbl_customer` WHERE cust_code='$awb'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count = $statement->rowCount(); if($count>0) { $txt='DP Code is already taken'; $error='1'; } else { $txt='DP Code is available'; $error='0'; } } if($type=='easyEdit'){ $datas[] = array('txt' => $txt, 'error' => $error,'msg'=>$success); }else{ $datas[] = array('txt' => $txt, 'error' => $error);} echo json_encode($datas); ?>