Guest User

fr

a guest
Feb 23rd, 2018
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. <?php
  2.  
  3. $tabindex=1;
  4. function checkecomstatus($orderid)
  5. {
  6. $data['username']='outthinking781346';
  7. $data['password']='ouhk78epe34csmed46d';
  8. $data['awb']=$orderid;
  9.  
  10. $url = 'https://plapi.ecomexpress.in/track_me/api/mawbd/?awb=awbnumber&order='.$orderid.'&username=outthinking781346&password=ouhk78epe34csmed46d';
  11. $ch = curl_init();
  12. curl_setopt($ch, CURLOPT_URL,$url);
  13. curl_setopt($ch, CURLOPT_POST, true);
  14. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  16.  
  17. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  18. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  19.  
  20.  
  21. $output = curl_exec ($ch);
  22. curl_close($ch);
  23. $res = explode("\n",$output);
  24.  
  25. if ( ! isset($res[13]))
  26. {
  27. $res[13] = null;
  28. }
  29. $status = str_replace('</field>.','',$res[13]);
  30. $statusfinal = str_replace('<field type="CharField" name="status">','',$status);
  31. if($statusfinal!='')
  32. {
  33. $sqlecom = "UPDATE do_order set in_transit='".$statusfinal.".',tconformed_by='Ecom' where order_id=".$orderid;
  34. $db_handleecom = new DBController();
  35. $resultecom = $db_handleecom->executeUpdate($sqlecom);
  36. }
  37.  
  38. return $statusfinal;
  39. }
  40.  
  41. ?>
  42.  
  43.  
  44.  
  45. <p><button type= "button" >Show Status</button></p>
  46. <table class="tbl-qa" border="1">
  47. <thead>
  48. <tr>
  49. <th class="table-header">ID</th>
  50. <th class="table-header">ORDERID</th>
  51. <th class="table-header">Status</th>
  52. </tr>
  53. </thead>
  54. <tbody id="table-body">
  55. <?php
  56.  
  57. if(!empty($orderrecords))
  58. {
  59. foreach($orderrecords as $k=>$v)
  60. {?>
  61. <tr class="table-row" id="table-row-<?php echo $orderrecords[$k]["id"]; ?>" tabindex="<?php echo $tabindex;?>">
  62. <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>
  63.  
  64. <td><?php echo $orderrecords[$k]["order_id"]; ?></td>
  65.  
  66. <td><?php //echo checkecomstatus($orderrecords[$k]["order_id"]);?></td>
  67.  
  68. </tr>
  69. <?php
  70. $tabindex++;
  71. }
  72. }?>
  73. </tbody>
  74. </table>
  75. <input type="hidden" name="ordercheckallIDs" id="ordercheckallIDs" value="<?php echo $ordercheckall;?>"/>
  76.  
  77.  
  78. <script>
  79.  
  80. function assignallorderids()
  81. {
  82. var checkstatus=$("#checkall").is(":checked");
  83.  
  84. if(checkstatus==true)
  85. {
  86. var id=document.getElementById("ordercheckallIDs").value;
  87. document.getElementById("orderids").value=id;
  88. $("input:checkbox[name='checkassigneeid']").prop('checked',true);
  89. }
  90. else
  91. {
  92. $("input:checkbox[name='checkassigneeid']").prop('checked',false);
  93. document.getElementById("orderids").value='';
  94. }
  95. }
  96.  
  97. function assignorderids(oid)
  98. {
  99. var checkstatus=$("#assigneeid-"+oid).is(":checked");
  100. var morderId =document.getElementById("orderids").value;
  101. if(checkstatus==false)
  102. {
  103. var arrayorder = JSON.parse("[" + morderId + "]");
  104. document.getElementById("orderids").value='';
  105. for (var i = 0; i < arrayorder.length; i++) {
  106. var orderstatusValue=arrayorder[i];
  107. if(orderstatusValue!=oid){
  108. if (document.getElementById("orderids").value=='')
  109. {
  110. document.getElementById("orderids").value=orderstatusValue;
  111. }
  112. else
  113. {
  114. var newvalue=document.getElementById("orderids").value;
  115. document.getElementById("orderids").value=newvalue+","+orderstatusValue;
  116. }
  117. }
  118. }
  119. }
  120. else
  121. {
  122. if(morderId=='')
  123. {
  124. document.getElementById("orderids").value=oid;
  125. }
  126. else
  127. {
  128. document.getElementById("orderids").value=morderId+","+oid;
  129. }
  130. }
  131. }
  132.  
  133. </script>
Add Comment
Please, Sign In to add comment