|
- <?php
- /*
- Author:LB
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
- $method=isset($_GET['method'])?$_GET['method']:'';
- $pdo=conn();
- switch ($method){
- case 'getRunReportData':
- $USER_ID=isset($_GET['user_id'])?$_GET['user_id']:'';
- $PAGE=isset($_GET['currpage'])?$_GET['currpage']:'';
- $PAGE_SIZE=isset($_GET['page_size'])?$_GET['page_size']:'';
- $LINE=isset($_GET['line'])?$_GET['line']:'';
- $START_DATE=isset($_GET['start_date'])?$_GET['start_date']:'';
- $END_DATE=isset($_GET['end_date'])?$_GET['end_date']:'';
- $sql="CALL SP_GET_RUN_SELL_TABLE('".$USER_ID."','".$PAGE."','".$PAGE_SIZE."','".$LINE."','".$START_DATE."','".$END_DATE."')";
- if(is_object($pdo)){
- $stmt=$pdo->query($sql);
- if($stmt){
- $data['code']='0';
- $data['info']='';
- $i = 1;
- do{
- $rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if($i==1){
- $data['currpage']=$rowset[0]['currpage'];
- $data['total_page']=$rowset[0]['total_page'];
- $data['total']=$rowset[0]['total'];
- $data['page_size']=$rowset[0]['page_size'];
- }else if ($i==2){
- $grandfather=$rowset;
- }else if ($i==3){
- $father=$rowset;
- }
- else if ($i==4){
- $son=$rowset;
- }else{
- }
- $i++;
- }while ($stmt->nextRowset());
- $grandfather=isset($grandfather)?$grandfather:array();
- $father=isset($father)?$father:array();
- $son=isset($son)?$son:array();
- if(count($grandfather)>0 && count($father)>0 && count($son)>0){
- $gfArr = array();
- $i = 0;
- foreach($grandfather as $gf){
- $gfArr[$i] = $gf;
- $fArr = array();
- $j = 0;
- foreach($father as $f){
- if($f['parent_id']==$gf['id']){
- $fArr[$j] = $f;
- $sArr = array();
- $k = 0;
- foreach($son as $s){
- if($s['parent_id']==$f['id']){
- $sArr[$k] = $s;
- $k++;
- }
- }
- $fArr[$j]['everyTime']=$sArr;
- $k = 0;
- $j++;
- }
- }
- $gfArr[$i]['everyDate']=$fArr;
- $j = 0;
- $i++;
- }
- $data['chartInfo']=$gfArr;
- $i = 0;
- }else{
- }
- }else{
- $data['code']='1';
- $data['info']='获取班次销售报表失败';
- }
- }
- $stmt->closeCursor();
- break;
- default:
- break;
-
- }
- if(is_array($data)){
- echo json_encode($data);
- }
- exit;
|