Guest User

grgr

a guest
Nov 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('display_startup_errors', 1);
  4. error_reporting(E_ALL);
  5. mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX);
  6.  
  7. require_once("dbcontroller.php");
  8. $db_handle = new DBController();
  9.  
  10. /** code **/
  11.  
  12. $sqlb="SELECT * FROM ecomexpress_awb";
  13. $resultb = $db_handle->runSelectQuery($sqlb);
  14.  
  15. $order_id='';
  16. if(isset($_POST['order_id']) && $_POST['order_id']!=''){
  17. $order_id = $_POST['order_id'];
  18.  
  19. $sqlc = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='COD' limit 1";
  20. $resultc = $db_handle->runSelectQuery($sqlc);
  21.  
  22. $sqld = "select * from ecomexpress_awb WHERE status='unused' AND awb_type='PPD' limit 1";
  23. $resultd = $db_handle->runSelectQuery($sqld);
  24.  
  25. $payment_type='';
  26. $sqlg="SELECT * FROM do_order where payment_type='".$payment_type."'";
  27. $resultg = $db_handle->runSelectQuery($sqlg);
  28.  
  29. if($payment_type=="Cash on delivery")
  30. {
  31. $awb = $resultc[0]['awb'];
  32. $sqle = "update ecomexpress_awb set orderid = '".$order_id."',status='used' WHERE awb ='".$awb."' limit 1";
  33. $resulte = $db_handle->runSelectQuery($sqle);
  34. }
  35. else
  36. {
  37. $awba = $resultd[0]['awb'];
  38. $sqlf = "update ecomexpress_awb set orderid = '".$order_id."',status='used' WHERE awb ='".$awba."' limit 1";
  39. $resultf = $db_handle->runSelectQuery($sqlf);
  40. }
  41.  
  42.  
  43. /** code end**/
  44.  
  45. $sqlh="SELECT * FROM do_order where order_id='".$order_id."'";
  46. $resulth = $db_handle->runSelectQuery($sqlh);
  47.  
  48. $data =
  49. array (
  50. 'XBkey' => 'QGfMthH1',
  51. 'VersionNumber' => 'V5',
  52. 'ManifestDetails' =>
  53. array (
  54. 'ManifestID' => '12320160729',
  55. 'OrderType' => ($resulth[0]['payment_type'] == "Cash on delivery" ? "COD" : "Prepaid"),
  56. 'OrderNo' => $order_id,
  57. 'PaymentStatus' => ($resulth[0]['payment_type'] == "Cash on delivery" ? "COD" : "Prepaid"),
  58. 'PickupVendor' => 'Outthinking',
  59. 'PickVendorPinCode' => '560043',
  60. 'CustomerName' => $resulth[0]['customer_name'],
  61. 'ZipCode' => '500030',
  62. 'CustomerAddressDetails' =>
  63. array (
  64. 0 =>
  65. array (
  66. 'Type' => 'Primary',
  67. 'Address' => $resulth[0]['customer_name'],
  68. ),
  69. ),
  70. 'CustomerMobileNumberDetails' =>
  71. array (
  72. 0 =>
  73. array (
  74. 'Type' => 'Primary',
  75. 'MobileNo' => $resulth[0]['phone_number'],
  76. ),
  77. ),
  78. 'RTOPinCode' => '400061',
  79. 'AirWayBillNO' => $resultb[0]['awb'],
  80. 'Quantity' => 1,
  81. 'PickupVendorCode' => 'M34',
  82. 'CollectibleAmount' => $resulth[0]['price'],
  83. 'DeclaredValue' => $resulth[0]['price'],
  84. 'GSTMultiSellerInfo' =>
  85. array (
  86. 0 =>
  87. array (
  88. 'ProductDesc' => 'Custom product',
  89. 'SellerName' => 'OUTTHINKING ELECTRONICS PVT LTD',
  90. 'SellerAddress' => 'No 28 2nd Floor,5th Main road, OMBR Layout Kasturinagar',
  91. 'SellerPincode' => 560043,
  92. 'InvoiceDate' => '13-10-2016',
  93. ),
  94. ),
  95. ),
  96. );
  97.  
  98. $url = "http://114.143.206.69:803/StandardForwardStagingService.svc/AddManifestDetails";
  99.  
  100. $data = json_encode($data);
  101.  
  102. $headers = array("Content-Type: application/json");
  103. $curl = curl_init($url);
  104.  
  105. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  106. curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  107. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  108. curl_setopt($curl, CURLOPT_POST, true);
  109. curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
  110. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  111. curl_setopt($curl, CURLOPT_VERBOSE, true);
  112.  
  113. $curl_response = curl_exec($curl);
  114. curl_close($curl);
  115. echo $curl_response ."\n";
  116. print_r($data);
  117. }
  118.  
  119. //$sqla = "update ecomexpress_awb status='assigned' WHERE awb=".$selectawb." AND order_id=". $postorderid;
  120. //$sqld = $db_handle->runSelectQuery($sqla);
  121.  
  122.  
  123.  
  124. ?>
Add Comment
Please, Sign In to add comment