ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/delivery_bulk_upload_status-1.php |
<?php include("header_bulk_uploads.php"); //$client_id = $_POST['client_id']; $clientId=$_SESSION['user']['id']; $clientLocation=$_SESSION['user']['location']; if(isset($_POST["Import"])){ echo $filename=$_FILES["file"]["tmp_name"]; $failure_data=array(); $failed_count=0; if($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); $ri=0; $j=0; while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE) { if($emapData==''){ break; } if($ri>0 && $emapData!=''){ /******************** Select Pincode Details **************************/ $ref_no=$emapData[0]; $statement = "SELECT * FROM `pickup_entry` WHERE ref_no='$ref_no'"; $response=mysqli_query($conn,$statement); foreach($response as $res) { $id=$res['id']; } $rowcount=mysqli_num_rows($response); if($rowcount==1){ /******************** Check if service is available or not along with its available services ******************/ if(!empty($emapData[2])){ // $create=date_create($emapData[2]); // $created_at=date_format($create,'Y-m-d'); $given_ct=$emapData[2]; $len_ct=strlen($given_ct); if($len_ct==10){ $date=date_create_from_format("d-m-Y",$given_ct); $created_at= date_format($date,"Y-m-d"); }elseif($len_ct==8) { $date=date_create_from_format("d-m-y",$given_ct); $created_at= date_format($date,"Y-m-d"); }else { $created_at=''; } }else { $created_at=''; } if(!empty($emapData[5])){ // $delivery=date_create($emapData[5]); // $delivery_date=date_format($delivery,'Y-m-d'); $given_dd=$emapData[5]; $len_dd=strlen($given_dd); if($len_dd==10){ $date_dd=date_create_from_format("d-m-Y",$given_dd); $delivery_date= date_format($date_dd,"Y-m-d"); }elseif($len_dd==8) { $date_dd=date_create_from_format("d-m-y",$given_dd); $delivery_date= date_format($date_dd,"Y-m-d"); }else { $delivery_date=''; } }else { $delivery_date=''; } if(!empty($emapData[8])) { $clientLocation=$emapData[8]; } $sql="UPDATE `pickup_entry` SET status='$emapData[1]' WHERE id='$id'"; $result=$conn->query($sql); /*Tracking Module Start*/ $statement ="INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark,receiver_name,receiver_mobile,relation,reason,delivery_date,created_at) VALUES ($id,$clientId,'$clientLocation','$emapData[1]','','$emapData[7]','$emapData[3]','$emapData[4]','','$emapData[6]','$delivery_date','$created_at')"; $result=$conn->query($statement); /*Tracking Module End*/ $j++; } if($ri>0 && ($result==0 ||$rowcount!=1)) { $failure_data[]=$emapData; $failed_count++; } } $ri++; } fclose($file); echo "<script type=\"text/javascript\"> alert(\" $j Records Updated successfully Imported.$failed_count Records Failed to Update...\"); window.location = \"delivery.php\" </script>"; //close of connection mysqli_close($conn); } } ?>