|
- <?php
- /*
- Author:XM
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
- $userid=getUserId();
- if ($userid ===false){
- echo json_encode(array("code"=>1,"info"=>"用户未登录"));
- exit;
- }
- $myrunid=$_GET['runid'];
- $pdo=conn();
- $sql1="call sp_get_run_sale_ticket(".$userid.",".$myrunid.")";
- $date_month = date('Y-m', strtotime("-1 month "));
- //$sql2="SELECT ORG_ID AS org_id ,ORG_NAME as soure FROM base_organization where cancel_flag=0;";
- $sql2 = "SELECT
- a.supplier_id as org_id,b.supplier_name as soure
- FROM
- base_supplier_sale AS a
- INNER JOIN base_supplier AS b ON a.supplier_id = b.id
- LEFT JOIN base_supplier_sequence AS s ON b.id = s.supplier_id and s.date_month = '" . $date_month . "'
- WHERE
- a.parent_type = 310
- AND a.cancel_flag = 0
- AND b.cancel_flag = 0
- AND b.is_disabled = 0
- GROUP BY
- a.supplier_id
- ORDER BY
- s.order_num DESC,s.person_trip DESC,s.sales DESC";
-
- writeLog("sp_get_run_sale_ticket: ".$sql1);
- writeLog("sp_get_run_sale_ticket: ".$sql2);
- if (is_object($pdo)){
- $result1=$pdo->query($sql1);
- $json1=$result1->fetchAll(PDO::FETCH_ASSOC);
- $result1->closeCursor();
- $json['ticket_list']=$json1;
-
- $result2=$pdo->query($sql2);
- $json2=$result2->fetchAll(PDO::FETCH_ASSOC);
- $result2->closeCursor();
- $json['sale_org']=$json2;
-
- echo json_encode($json);
- /*
- $result=$pdo->query($sql);
- $data=array();
-
- do{
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- if($rowset){
- $data[]=$rowset;
- }
- }while ($result->nextRowset());
-
- foreach ( $data as $key => $value ) {
- $newData[$key] = $value;
- //$newData [$key] ['circuitry_name'] = urlencode ( $value ['circuitry_name'] );
- }
- echo urldecode ( json_encode ( $newData ) );
- // $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- // echo json_encode($rowset[0]);
- */
- }
-
-
-
-
-
-
|