Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $tabindex=1;
- function checkecomstatus($orderid)
- {
- $data['username']='outthinking781346';
- $data['password']='ouhk78epe34csmed46d';
- $data['awb']=$orderid;
- $url = 'https://plapi.ecomexpress.in/track_me/api/mawbd/?awb=awbnumber&order='.$orderid.'&username=outthinking781346&password=ouhk78epe34csmed46d';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- $output = curl_exec ($ch);
- curl_close($ch);
- $res = explode("\n",$output);
- if ( ! isset($res[13]))
- {
- $res[13] = null;
- }
- $status = str_replace('</field>.','',$res[13]);
- $statusfinal = str_replace('<field type="CharField" name="status">','',$status);
- if($statusfinal!='')
- {
- $sqlecom = "UPDATE do_order set in_transit='".$statusfinal.".',tconformed_by='Ecom' where order_id=".$orderid;
- $db_handleecom = new DBController();
- $resultecom = $db_handleecom->executeUpdate($sqlecom);
- }
- return $statusfinal;
- }
- ?>
- <p><button type= "button" >Show Status</button></p>
- <table class="tbl-qa" border="1">
- <thead>
- <tr>
- <th class="table-header">ID</th>
- <th class="table-header">ORDERID</th>
- <th class="table-header">Status</th>
- </tr>
- </thead>
- <tbody id="table-body">
- <?php
- if(!empty($orderrecords))
- {
- foreach($orderrecords as $k=>$v)
- {?>
- <tr class="table-row" id="table-row-<?php echo $orderrecords[$k]["id"]; ?>" tabindex="<?php echo $tabindex;?>">
- <td><input type="checkbox" onclick="assignorderids('<?php echo $orderrecords[$k]["order_id"]; ?>')" name="assigneeid" id="assigneeid-<?php echo $orderrecords[$k]["order_id"]; ?>" value="<?php echo $orderrecords[$k]["order_id"]; ?>"></td>
- <td><?php echo $orderrecords[$k]["order_id"]; ?></td>
- <td><?php //echo checkecomstatus($orderrecords[$k]["order_id"]);?></td>
- </tr>
- <?php
- $tabindex++;
- }
- }?>
- </tbody>
- </table>
- <input type="hidden" name="ordercheckallIDs" id="ordercheckallIDs" value="<?php echo $ordercheckall;?>"/>
- <script>
- function assignallorderids()
- {
- var checkstatus=$("#checkall").is(":checked");
- if(checkstatus==true)
- {
- var id=document.getElementById("ordercheckallIDs").value;
- document.getElementById("orderids").value=id;
- $("input:checkbox[name='checkassigneeid']").prop('checked',true);
- }
- else
- {
- $("input:checkbox[name='checkassigneeid']").prop('checked',false);
- document.getElementById("orderids").value='';
- }
- }
- function assignorderids(oid)
- {
- var checkstatus=$("#assigneeid-"+oid).is(":checked");
- var morderId =document.getElementById("orderids").value;
- if(checkstatus==false)
- {
- var arrayorder = JSON.parse("[" + morderId + "]");
- document.getElementById("orderids").value='';
- for (var i = 0; i < arrayorder.length; i++) {
- var orderstatusValue=arrayorder[i];
- if(orderstatusValue!=oid){
- if (document.getElementById("orderids").value=='')
- {
- document.getElementById("orderids").value=orderstatusValue;
- }
- else
- {
- var newvalue=document.getElementById("orderids").value;
- document.getElementById("orderids").value=newvalue+","+orderstatusValue;
- }
- }
- }
- }
- else
- {
- if(morderId=='')
- {
- document.getElementById("orderids").value=oid;
- }
- else
- {
- document.getElementById("orderids").value=morderId+","+oid;
- }
- }
- }
- </script>
Add Comment
Please, Sign In to add comment