You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

75 lines
1.9 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. $userid=getUserId();
  10. if ($userid ===false){
  11. echo json_encode(array("code"=>1,"info"=>"用户未登录"));
  12. exit;
  13. }
  14. $myrunid=$_GET['runid'];
  15. $pdo=conn();
  16. $sql1="call sp_get_run_sale_ticket(".$userid.",".$myrunid.")";
  17. $date_month = date('Y-m', strtotime("-1 month "));
  18. //$sql2="SELECT ORG_ID AS org_id ,ORG_NAME as soure FROM base_organization where cancel_flag=0;";
  19. $sql2 = "SELECT
  20. a.supplier_id as org_id,b.supplier_name as soure
  21. FROM
  22. base_supplier_sale AS a
  23. INNER JOIN base_supplier AS b ON a.supplier_id = b.id
  24. LEFT JOIN base_supplier_sequence AS s ON b.id = s.supplier_id and s.date_month = '" . $date_month . "'
  25. WHERE
  26. a.parent_type = 310
  27. AND a.cancel_flag = 0
  28. AND b.cancel_flag = 0
  29. AND b.is_disabled = 0
  30. GROUP BY
  31. a.supplier_id
  32. ORDER BY
  33. s.order_num DESC,s.person_trip DESC,s.sales DESC";
  34. writeLog("sp_get_run_sale_ticket: ".$sql1);
  35. writeLog("sp_get_run_sale_ticket: ".$sql2);
  36. if (is_object($pdo)){
  37. $result1=$pdo->query($sql1);
  38. $json1=$result1->fetchAll(PDO::FETCH_ASSOC);
  39. $result1->closeCursor();
  40. $json['ticket_list']=$json1;
  41. $result2=$pdo->query($sql2);
  42. $json2=$result2->fetchAll(PDO::FETCH_ASSOC);
  43. $result2->closeCursor();
  44. $json['sale_org']=$json2;
  45. echo json_encode($json);
  46. /*
  47. $result=$pdo->query($sql);
  48. $data=array();
  49. do{
  50. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  51. if($rowset){
  52. $data[]=$rowset;
  53. }
  54. }while ($result->nextRowset());
  55. foreach ( $data as $key => $value ) {
  56. $newData[$key] = $value;
  57. //$newData [$key] ['circuitry_name'] = urlencode ( $value ['circuitry_name'] );
  58. }
  59. echo urldecode ( json_encode ( $newData ) );
  60. // $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  61. // echo json_encode($rowset[0]);
  62. */
  63. }