ok
Direktori : /home2/selectio/www/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/www/lilyexpresslive/software/admin/cargo-entry-bulk-upload-status1.php |
<?php require_once ('header.php'); $client_id = $_POST['client_id']; ini_set('memory_limit', '10048M'); /*Pickup Entry Initially Array Variable Start*/ date_default_timezone_set('Asia/Kolkata'); $date = date('Y/m/d h:i:s', time()); $c_type = array(); $ref_no = array(); $reference = array(); $c_pincode = array(); $c_address = array(); $c_city = array(); $c_state = array(); $c_phone = array(); $a_weight = array(); $c_weight = array(); $cs_weight = array(); $description = array(); $errData = array(); $nop = array(); $e_way_bill_no = array(); $invoice_no = array(); $invoice_value = array(); $shipping_mode = array(); $length1=array(); $width1=array(); $height1=array(); $nob1=array(); $act_wt1=array(); $charged_wt1=array(); $length2=array(); $width2=array(); $height2=array(); $nob2=array(); $act_wt2=array(); $charged_wt2=array(); $length3=array(); $width3=array(); $height3=array(); $nob3=array(); $act_wt3=array(); $charged_wt3=array(); $length4=array(); $width4=array(); $height4=array(); $nob4=array(); $act_wt4=array(); $charged_wt4=array(); $length5=array(); $width5=array(); $height5=array(); $nob5=array(); $act_wt5=array(); $charged_wt5=array(); $tat_days=array(); $total_no_of_pieces=array(); $cust_id=''; $error_msg = array(); $error_msg_status = array(); $c_destination = array(); $c_pickup_date = array(); $isErrorSpotted=0; $errorFound=0; $installedData=0; /*Pickup Entry Initially Array Variable Start*/ if (isset($_POST["Import"])) { try { $ri = 0; $filename = $_FILES["file"]["tmp_name"]; if ($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); $ri = 0; $j = 0; $failed_count = 0; $clientLocation = ''; if ($client_id != '') { $statement = $pdo->prepare("SELECT * FROM tbl_user where id='$client_id'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { $gst_no = $row['gst_no']; $clientLocation = $row['location']; } } else { $error_msg[$ri] = "Pls Select Client Name"; } while (($emapData = fgetcsv($file, 10000, ",")) !== false) { $error_msg_status[$ri]=0; if ($emapData == '') { break; } if ($ri > 0 && $emapData != '') { /*Customer Type(0)*/ $c_type[]=$emapData[0]; if ($emapData[0] == '' || empty($emapData[0])) { $error_msg[$ri] .= "Row Number " . $ri . " Customer type Can't be empty..."; $error_msg_status[$ri]=1; } else { if($emapData[0]==2) { $cust_code1 = $emapData[1]; $statement = $pdo->prepare("SELECT * FROM tbl_customer where cust_code='$cust_code1'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count = $statement->rowCount(); if($count>0) { $error_msg[$ri] .= "Row Number " . $ri . " DB Code Already Exists..."; $error_msg_status[$ri]=1; } } } /*DB Code(1)*/ if ($emapData[1] == '' || empty($emapData[1])) { $db_code[] = ""; $error_msg[$ri] .= "Row Number " . $ri . " DB Code Can't be empty..."; } elseif ($emapData[0] == 1) { $db_code[] = $emapData[1]; $cust_code = $emapData[1]; $statement = $pdo->prepare("SELECT * FROM tbl_customer where cust_code='$cust_code'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count = $statement->rowCount(); if($count>0){ foreach ($result as $row) { $address = $row['cust_address']; $customer_id = $row['cust_id']; $cust_name = $row['cust_name']; $cust_phone = $row['cust_phone']; $city = $row['cust_city']; $state = $row['cust_state']; $pincode = $row['cust_zip']; $destination = $row['destination_city']; } } else { $error_msg[$ri] .= "Row Number " . $ri . " Invalid DB Code..."; $error_msg_status[$ri]=1; } } else { $db_code[] = $emapData[1]; } /*AWB No(2)*/ $ref_no[] = $emapData[2]; if ($emapData[2] == '' || empty($emapData[2])) { $error_msg[$ri] .= "Row Number " . $ri . " AWB Number Can't be empty..."; $error_msg_status[$ri]=1; } else { $statement = $pdo->prepare("SELECT * FROM `pickup_entry` WHERE ref_no=?"); $statement->execute(array( $emapData[2] )); $result = $statement->fetchAll(PDO::FETCH_ASSOC); $count = $statement->rowCount(); if ($count > 0) { $error_msg[$ri] .= "Row Number " . $ri . " AWB No Already Exist..."; $error_msg_status[$ri]=1; } } if (count($ref_no) > 0) { foreach (array_count_values($ref_no) as $num => $value) { if ($value > 1) { $error_msg[$ri] .= $num . " Row Number " . $ri . " AWB Number is having duplicate value of " . $value . " times in our csv file"; $error_msg_status[$ri]=1; } } } /*Customer Name(3)*/ if (($emapData[3] == '' || empty($emapData[3])) && $emapData[0] == 2) { $c_name[] = ''; $error_msg[$ri] .= "Row Number " . $ri . " Customer Name Can't Be Empty..."; $error_msg_status[$ri]=1; } elseif (($emapData[3] == '' || empty($emapData[3])) && $emapData[0] == 1) { $c_name[] = $cust_name; } else { $c_name[] = $emapData[3]; } /*Address(4)*/ if (($emapData[4] == '' || empty($emapData[4])) && $emapData[0] == 2) { $c_address[] = ''; /*$error_msg[$ri] .= "Row Number " . $ri . " Address Can't Be Empty..."; $error_msg_status[$ri]=1;*/ } elseif (($emapData[3] == '' || empty($emapData[4])) && $emapData[0] == 1) { $c_address[] = $address; } else { $temp_addr = $emapData[4]; if(strlen($temp_addr)>110) { $ad_count=strlen($temp_addr); $error_msg[$ri] .= "Row Number " . $ri . " Address character should less than 110, but it has $ad_count..."; $error_msg_status[$ri]=1; } else { $c_address[]=$temp_addr; } } /*City(5)*/ if (($emapData[5] == '' || empty($emapData[5])) && $emapData[0] == 2) { $c_city[] = ''; /*$error_msg[$ri] .= "Row Number " . $ri . " City Can't Be Empty..."; $error_msg_status[$ri]=1;*/ } elseif (($emapData[5] == '' || empty($emapData[5])) && $emapData[0] == 1) { $c_city[] = $city; } else { $c_city[] = $emapData[5]; } /*State(6)*/ if (($emapData[6] == '' || empty($emapData[6])) && $emapData[0] == 2) { $c_state[] = ''; /*$error_msg[$ri] .= "Row Number " . $ri . " State Can't Be Empty..."; $error_msg_status[$ri]=1;*/ } elseif (($emapData[6] == '' || empty($emapData[6])) && $emapData[0] == 1) { $c_state[] = $state; } else { $c_state[] = $emapData[6]; } /*Destination City(7)*/ if (($emapData[7] == '' || empty($emapData[7])) && $emapData[0] == 2) { $c_destination[] = ''; /* $error_msg[$ri] .= "Row Number " . $ri . " Destination City Can't Be Empty..."; $error_msg_status[$ri]=1;*/ } elseif (($emapData[7] == '' || empty($emapData[7])) && $emapData[0] == 1) { $c_destination[] = $destination; } else { $c_destination[] = $emapData[7]; } /*Pincode(8)*/ if (($emapData[8] == '' || empty($emapData[8])) && $emapData[0] == 2) { $c_pincode[] = ''; /*$error_msg[$ri] .= "Row Number " . $ri . " Pincode Can't Be Empty..."; $error_msg_status[$ri]=1;*/ } elseif (($emapData[8] == '' || empty($emapData[8])) && $emapData[0] == 1) { $c_pincode[] = $pincode; } else { $c_pincode[] = $emapData[8]; } /*Phone(9)*/ if (($emapData[9] == '' || empty($emapData[9])) && $emapData[0] == 2) { $c_phone[] = ''; /* $error_msg[$ri] .= "Row Number " . $ri . " Phone Can't Be Empty..."; $error_msg_status[$ri]=1;*/ } elseif (($emapData[9] == '' || empty($emapData[9])) && $emapData[0] == 1) { $c_phone[] = $cust_phone; } else { $c_phone[] = $emapData[9]; } /*Pickup Date(10)*/ if ($emapData[10] == '' || empty($emapData[10])) { $c_pickup_date[] = $date; } else { $given=$emapData[10]; $len=strlen($given); if($len==10){ $date=date_create_from_format("d-m-Y",$given); $created= date_format($date,"Y-m-d"); $c_pickup_date[] = $created; }elseif($len==8) { $date=date_create_from_format("d-m-y",$given); $created= date_format($date,"Y-m-d"); $c_pickup_date[] = $created; } else { $error_msg[$ri] .= "Row Number " . $ri . " Invalid Date Format (Format should be 23-02-2055 OR 23-02-55)..."; $error_msg_status[$ri]=1; } } if ($emapData[11] == '' || empty($emapData[11])) { $a_weight[] = ''; } else { $a_weight[] = $emapData[11]; } if ($emapData[12] == '' || empty($emapData[12])) { $c_weight[] = ''; } else { $c_weight[] = $emapData[12]; } if ($emapData[13] == '' || empty($emapData[13])) { $nop[] = ''; } else { $nop[] = $emapData[13]; } if ($emapData[14] == '' || empty($emapData[14])) { $description[] = '1'; } else { $description[] = $emapData[14]; } if ($emapData[15] == '' || empty($emapData[15])) { $e_way_bill_no[] = ' '; } else { $e_way_bill_no[] = $emapData[15]; } if ($emapData[16] == '' || empty($emapData[16])) { $invoice_no[] = ' '; } else { $invoice_no[] = $emapData[16]; } if ($emapData[17] == '' || empty($emapData[17])) { $invoice_value[] = '1'; } else { $invoice_value[] = $emapData[17]; } $ds=17; $shipping_mode=$emapData[18]; $length1[]=$emapData[19]; $width1[]=$emapData[20]; $height1[]=$emapData[22]; $nob1[]=$emapData[22]; $act_wt1[]=$emapData[23]; $charged_wt1[]=''; $length2[]=$emapData[24]; $width2[]=$emapData[25]; $height2[]=$emapData[26]; $nob2[]=$emapData[27]; $act_wt2[]=$emapData[28]; $charged_wt2[]=""; $length3[]=$emapData[29]; $width3=$emapData[30]; $height3[]=$emapData[31]; $nob3[]=$emapData[32]; $act_wt3[]=$emapData[33]; $charged_wt3[]=''; $length4[]=$emapData[34]; $width4=$emapData[35]; $height4[]=$emapData[36]; $nob4[]=$emapData[37]; $act_wt4[]=$emapData[38]; $charged_wt4[]=''; $length5[]=$emapData[39]; $width5=$emapData[40]; $height5[]=$emapData[41]; $nob5[]=$emapData[42]; $act_wt5[]=$emapData[43]; if($emapData[44]==''){ $tat_days[]=0; }else{ $tat_days[]=$emapData[44]; } if($emapData[45]==''){ $total_no_of_pieces[]=0; }else{ $total_no_of_pieces[]=$emapData[45]; } $charged_wt5[]=''; $overall_charget_weight=0;$cal=1; if($shipping_mode=='AIR'){ $cal=5000; }else if($shipping_mode=='SURFACE'){ $cal=4000; }else{ $cal=4000; } if($emapData[19]!='' && $emapData[20]!='' && $emapData[21]!='' && $emapData[22]!=''){ $vd=$emapData[19]*$emapData[20]*$emapData[21]*$emapData[22]/$cal; $overall_charget_weight=$overall_charget_weight+$vd; } if($emapData[24]!='' && $emapData[25]!='' && $emapData[26]!='' && $emapData[27]!=''){ $vd=$emapData[24]*$emapData[25]*$emapData[26]*$emapData[27]/$cal; $overall_charget_weight=$overall_charget_weight+$vd; } if($emapData[29]!='' && $emapData[30]!='' && $emapData[31]!='' && $emapData[32]!=''){ $vd=$emapData[31]*$emapData[30]*$emapData[31]*$emapData[32]/$cal; $overall_charget_weight=$overall_charget_weight+$vd; } if($emapData[34]!='' && $emapData[35]!='' && $emapData[36]!='' && $emapData[37]!=''){ $vd=$emapData[34]*$emapData[35]*$emapData[36]*$emapData[37]/$cal; $overall_charget_weight=$overall_charget_weight+$vd; } if($emapData[39]!='' && $emapData[40]!='' && $emapData[41]!='' && $emapData[42]!=''){ $vd=$emapData[39]*$emapData[40]*$emapData[41]*$emapData[42]/$cal; $overall_charget_weight=$overall_charget_weight+$vd; } $cs_weight[]=$overall_charget_weight; // $shipping_mode[] = $emapData[43]; // if (is_numeric($emapData[14]) && $emapData[14]>0){ // $description[] = $emapData[14]; // }else{ // /*$error_msg[$ri] .= "Row Number " . $ri . " Invalid Content description Id"; // $error_msg_status[$ri]=1;*/ // $description[] = '1'; // } } $ri++; } fclose($file); { ?> <center><h3>Back to Cargo Entry   <a href="cargo-pickup-entry-list.php" class="btn btn-success btn-md">Back</a></h3></center> <a href="#" id="xx" class="btn btn-md btn-danger">Download Error Report</a> <div style='overflow:scroll;'> <!-- <a href="#" class="close" data-dismiss="alert" onclick='location.reload();' aria-label="close">Close ×</a>--> <table id="projectSpreadsheet" style="font-size: 12px;"> <tr class="table-success"> <th style="width: 3%;text-align: center;">S.No</th> <th style="width: 10%;text-align: center;">Error Details</th> <th style="width: 7%;text-align: center;">Customer Type</th> <th style="width: 7%;text-align: center;">DB Code</th> <th style="width: 7%;text-align: center;">AWB Number</th> <th style="width: 10%;text-align: center;">Customer Name</th> <th style="width: 20%;text-align: center;">Address</th> <th style="width: 7%;text-align: center;">City</th> <th style="width: 7%;text-align: center;">State</th> <th style="width: 7%;text-align: center;">Destination City</th> <th style="width: 7%;text-align: center;">Pincode</th> <th style="width: 7%;text-align: center;">Mobile</th> <th style="width: 7%;text-align: center;">Pickup Entry Date</th> <th style="width: 7%;text-align: center;">Actual Weight</th> <th style="width: 7%;text-align: center;">Charged Weight</th> <th style="width: 7%;text-align: center;">No.Of Pics</th> <th style="width: 7%;text-align: center;">Content Description</th> <th style="width: 7%;text-align: center;">E-Way Bill No</th> <th style="width: 7%;text-align: center;">Invoice Number</th> <th style="width: 7%;text-align: center;">Invoice Value</th> <th style="width: 7%;text-align: center;">Length1</th> <th style="width: 7%;text-align: center;">Width1</th> <th style="width: 7%;text-align: center;">Height1</th> <th style="width: 7%;text-align: center;">No of Box1</th> <th style="width: 7%;text-align: center;">Act WT1</th> <th style="width: 7%;text-align: center;">Length2</th> <th style="width: 7%;text-align: center;">Width2</th> <th style="width: 7%;text-align: center;">Height2</th> <th style="width: 7%;text-align: center;">No of Box2</th> <th style="width: 7%;text-align: center;">Act WT2</th> <th style="width: 7%;text-align: center;">Length3</th> <th style="width: 7%;text-align: center;">Width3</th> <th style="width: 7%;text-align: center;">Height3</th> <th style="width: 7%;text-align: center;">No of Box3</th> <th style="width: 7%;text-align: center;">Act WT3</th> <th style="width: 7%;text-align: center;">Length4</th> <th style="width: 7%;text-align: center;">Width4</th> <th style="width: 7%;text-align: center;">Height4</th> <th style="width: 7%;text-align: center;">No of Box4</th> <th style="width: 7%;text-align: center;">Act WT4</th> <th style="width: 7%;text-align: center;">Length5</th> <th style="width: 7%;text-align: center;">Width5</th> <th style="width: 7%;text-align: center;">Height5</th> <th style="width: 7%;text-align: center;">No of Box5</th> <th style="width: 7%;text-align: center;">Act WT5</th> <th style="width: 7%;text-align: center;">Mode</th> <th style="width: 7%;text-align: center;">TAT DAYS</th> <th style="width: 7%;text-align: center;">Total No of Pieces</th> </tr> <tbody id="tbodyid"> <?php $iiiiiii=count($ref_no); $k = 0; $kj = 0; for($g=1;$g<$ri;$g++) //foreach ($ref_no as $ref) { $ggggg=$error_msg_status[$g]; // echo "<script>alert($ggggg);</script>"; $status = '<button class="btn btn-md btn-danger">Failed</button>'; if($ggggg==0) { /******************** Check if service is available or not along with its available services ******************/ $statement = $pdo->prepare("SHOW TABLE STATUS LIKE 'pickup_entry'"); $statement->execute(); $result = $statement->fetchAll(); foreach ($result as $row) { $ai_id = $row[10]; } date_default_timezone_set('Asia/Kolkata'); $date = date('Y/m/d h:i:s a', time()); // ********************************** Generate AWB No Start ******************************************** $statement = $pdo->prepare("SELECT MAX(id) as big_id FROM pickup_entry"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { $bid = $row['big_id']; if ($bid != '') { $awb_n = $row['big_id'] + 1; $awb_no = 1000001 + $awb_n; } else { $awb_no = 1000001; } } $pic_status = 'In Transit'; $pic_desc='Shipment soft data uploaded successfully'; if ($c_type[$k] == 2) { $statement = $pdo->prepare("SHOW TABLE STATUS LIKE 'tbl_customer'"); $statement->execute(); $result = $statement->fetchAll(); foreach ($result as $row) { $cust_id = $row[10]; } $statement = $pdo->prepare("INSERT INTO tbl_customer (client_id,cust_code,cust_type,cust_name,cust_address,cust_zip,cust_phone,cust_city,cust_state,destination_city) VALUES (?,?,?,?,?,?,?,?,?,?)"); $statement->execute(array( $_POST['client_id'], $db_code[$k], 'one_time', $c_name[$k], $c_address[$k], $c_pincode[$k], $c_phone[$k], $c_city[$k], $c_state[$k], $c_destination[$k] )); } else { $statement = $pdo->prepare("SELECT * FROM tbl_customer where cust_code='$db_code[$k]'"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { $cust_id = $row['cust_id']; } } // ********************************** Generate AWB No End ******************************************** $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,e_way_bill_no,invoice_no,invoice_value,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,tat_days,total_no_pieces) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $result = $statement->execute(array( $awb_no, $ref_no[$k], $_POST['client_id'], $pic_status, $c_pincode[$k], $shipping_mode[$k], $cust_id, $c_address[$k], $c_city[$k], $c_state[$k], $c_phone[$k], $a_weight[$k], $cs_weight[$k], $description[$k], 0, 0, 'credit', $nop[$k], $gst_no, $c_destination[$k], $c_pickup_date[$k], $e_way_bill_no[$k], $invoice_no[$k], $invoice_value[$k], $length1[$k],$width1[$k],$height1[$k],$nob1[$k],$act_wt1[$k],$length2[$k],$width2[$k],$height2[$k],$nob2[$k],$act_wt2[$k],$length3[$k],$width3[$k],$height3[$k],$nob3[$k],$act_wt3[$k],$length4[$k],$width4[$k],$height4[$k],$nob4[$k],$act_wt4[$k],$length5[$k],$width5[$k],$height5[$k],$nob5[$k],$act_wt5[$k],$tat_days[$k],$total_no_of_pieces[$k] )); if ($result) { $statement_update = $pdo->prepare("UPDATE tbl_awb set status=0 WHERE awb_code='".$ref_no[$k]."'"); $resu=$statement_update->execute(); if(!$resu){ error_log('awb_code Number Update Failed :'.$ref_no[$k]);} $installedData++; $status = '<button class="btn btn-md btn-primary">Success</button>'; /*Tracking Module Start*/ $statement = $pdo->prepare("INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark,created_at) VALUES (?,?,?,?,?,?,?)"); $result1 = $statement->execute(array( $ai_id, $client_id, $clientLocation, $pic_status, $pic_desc, 'Material Safe...', $c_pickup_date[$k] )); $j++; } ?> <?php $k++; } else{ $errorFound++; $isErrorSpotted=1; $errData['sno'][]=$k+1; $errData['dbCode'][]=$db_code[$k]; $errData['awbno'][]=$ref_no[$k]; $errData['cust_name'][]=$c_name[$k]; $errData['cust_address'][]=$c_address[$k]; $errData['cust_city'][]=$c_city[$k]; $errData['cust_state'][]=$c_state[$k]; $errData['cust_destination'][]=$c_destination[$k]; $errData['cust_pincode'][]=$c_pincode[$k]; $errData['cust_phone'][]=$c_phone[$k]; $errData['cust_pickupDate'][]=$c_pickup_date[$k]; $errData['cust_aWeight'][]=$a_weight[$k]; $errData['cust_cWeight'][]=$cs_weight[$k]; $errData['cust_nop'][]=$nop[$k]; $errData['cust_content'][]=$description[$k]; $errData['reason'][]=$error_msg[$k+1]; $errData['cust_type'][]=$c_type[$k]; $errData['e_way_bill_no'][]=$e_way_bill_no[$k]; $errData['invoice_no'][]=$invoice_no[$k]; $errData['invoice_value'][]=$invoice_value[$k]; $errData['length1'][]=$length1[$k]; $errData['width1'][]=$width1[$k]; $errData['height1'][]=$height1[$k]; $errData['nob1'][]=$nob1[$k]; $errData['act_wt1'][]=$act_wt1[$k]; $errData['length2'][]=$length2[$k]; $errData['width2'][]=$width2[$k]; $errData['height2'][]=$height2[$k]; $errData['nob2'][]=$nob2[$k]; $errData['act_wt2'][]=$act_wt2[$k]; $errData['length3'][]=$length3[$k]; $errData['width3'][]=$width3[$k]; $errData['height3'][]=$height3[$k]; $errData['nob3'][]=$nob3[$k]; $errData['act_wt3'][]=$act_wt3[$k]; $errData['length4'][]=$length4[$k]; $errData['width4'][]=$width4[$k]; $errData['height4'][]=$height4[$k]; $errData['nob4'][]=$nob4[$k]; $errData['act_wt4'][]=$act_wt4[$k]; $errData['length5'][]=$length5[$k]; $errData['width5'][]=$width5[$k]; $errData['height5'][]=$height5[$k]; $errData['nob5'][]=$nob5[$k]; $errData['act_wt5'][]=$act_wt5[$k]; $errData['shipping_mode'][]=$shipping_mode[$k]; $errData['tat_days'][]=$tat_days[$k]; $errData['total_no_of_pieces']=$total_no_of_pieces[$k]; $kj++; ?> <tr class="table-active"> <td style="width: 3%;text-align: center;"><?php echo $k + 1 ?></td> <td style="width: 10%;text-align: left;"><?php echo $error_msg[$k+1]; ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_type[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $db_code[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $ref_no[$k] ?></td> <td style="width: 10%;text-align: left;"><?php echo $c_name[$k] ?></td> <td style="width: 20%;text-align: left;"><?php echo $c_address[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_city[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_state[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_destination[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_pincode[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_phone[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $c_pickup_date[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $a_weight[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $cs_weight[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $nop[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $description[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $e_way_bill_no[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $invoice_no[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $invoice_value[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $length1[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $width1[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $height1[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $nob1[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $act_wt1[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $charged_wt1[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $length2[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $width2[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $height2[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $nob2[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $act_wt2[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $charged_wt2[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $length3[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $width3[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $height3[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $nob3[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $act_wt3[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $charged_wt3[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $length4[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $width4[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $height4[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $nob4[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $act_wt4[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $charged_wt4[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $length5[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $width5[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $height5[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $nob5[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $act_wt5[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $charged_wt5[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $shipping_mode[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $tat_days[$k] ?></td> <td style="width: 7%;text-align: center;"><?php echo $total_no_of_pieces[$k] ?></td> </tr> <?php $k++; } } ?> </tbody> </table> <?php if($isErrorSpotted==1 || 1==1){ $errData= http_build_query($errData); ?> <h4> <?=$errorFound?> Errors found in this report. You can download error report <a href="#" id="xx" class="btn btn-md btn-danger">Download Error Report</a> </h4> <?php } ?> <?php if($installedData>0){?><br><h4><?=$installedData?> Pickup entries inserted successfully</h4><?php } ?> </div> <?php } } } catch(Exception $e) { echo "<center><h3>Back to Pickup Entry Bulk Upload   <a href='pickup-entry-bulk-upload.php' class='btn btn-danger btn-md'>Back</a></h3></center>"; echo "<div class='alert alert-danger alert-dismissible' style='margin-left: 2%;margin-right: 2%;margin-top: 22%;'>"; echo '<center>Message: ' . $e->getMessage(); echo '<br>Error found in uploaded CSV file.Please follow the bulk upload terms and conditions</center>'; echo '</div>'; } } ?> <style> table,td,th{ border:1px solid gray; } </style> <script type="text/javascript"> $(document).ready(function () { function exportTableToCSV($table, filename) { var $rows = $table.find('tr:has(td),tr:has(th)'), // Temporary delimiter characters unlikely to be typed by keyboard // This is to avoid accidentally splitting the actual contents tmpColDelim = String.fromCharCode(11), // vertical tab character tmpRowDelim = String.fromCharCode(0), // null character // actual delimiter characters for CSV format colDelim = '","', rowDelim = '"\r\n"', // Grab text from table into CSV formatted string csv = '"' + $rows.map(function (i, row) { var $row = $(row), $cols = $row.find('td,th'); return $cols.map(function (j, col) { var $col = $(col), text = $col.text(); return text.replace(/"/g, '""'); // escape double quotes }).get().join(tmpColDelim); }).get().join(tmpRowDelim) .split(tmpRowDelim).join(rowDelim) .split(tmpColDelim).join(colDelim) + '"', // Data URI csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csv); console.log(csv); if (window.navigator.msSaveBlob) { // IE 10+ //alert('IE' + csv); window.navigator.msSaveOrOpenBlob(new Blob([csv], {type: "text/plain;charset=utf-8;"}), "csvname.csv") } else { $(this).attr({ 'download': filename, 'href': csvData, 'target': '_blank' }); } } // This must be a hyperlink $("#xx").on('click', function (event) { exportTableToCSV.apply(this, [$('#projectSpreadsheet'), 'export.csv']); // IF CSV, don't do event.preventDefault() or return false // We actually need this to be a typical hyperlink }); }); </script> <?php require_once ('footer.php'); ?>