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.
 
 
 
 

93 lines
2.3 KiB

  1. <?php
  2. /*
  3. Author:LB
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. $method=isset($_GET['method'])?$_GET['method']:'';
  10. $pdo=conn();
  11. switch ($method){
  12. case 'getRunReportData':
  13. $USER_ID=isset($_GET['user_id'])?$_GET['user_id']:'';
  14. $PAGE=isset($_GET['currpage'])?$_GET['currpage']:'';
  15. $PAGE_SIZE=isset($_GET['page_size'])?$_GET['page_size']:'';
  16. $LINE=isset($_GET['line'])?$_GET['line']:'';
  17. $START_DATE=isset($_GET['start_date'])?$_GET['start_date']:'';
  18. $END_DATE=isset($_GET['end_date'])?$_GET['end_date']:'';
  19. $sql="CALL SP_GET_RUN_SELL_TABLE('".$USER_ID."','".$PAGE."','".$PAGE_SIZE."','".$LINE."','".$START_DATE."','".$END_DATE."')";
  20. if(is_object($pdo)){
  21. $stmt=$pdo->query($sql);
  22. if($stmt){
  23. $data['code']='0';
  24. $data['info']='';
  25. $i = 1;
  26. do{
  27. $rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
  28. if($i==1){
  29. $data['currpage']=$rowset[0]['currpage'];
  30. $data['total_page']=$rowset[0]['total_page'];
  31. $data['total']=$rowset[0]['total'];
  32. $data['page_size']=$rowset[0]['page_size'];
  33. }else if ($i==2){
  34. $grandfather=$rowset;
  35. }else if ($i==3){
  36. $father=$rowset;
  37. }
  38. else if ($i==4){
  39. $son=$rowset;
  40. }else{
  41. }
  42. $i++;
  43. }while ($stmt->nextRowset());
  44. $grandfather=isset($grandfather)?$grandfather:array();
  45. $father=isset($father)?$father:array();
  46. $son=isset($son)?$son:array();
  47. if(count($grandfather)>0 && count($father)>0 && count($son)>0){
  48. $gfArr = array();
  49. $i = 0;
  50. foreach($grandfather as $gf){
  51. $gfArr[$i] = $gf;
  52. $fArr = array();
  53. $j = 0;
  54. foreach($father as $f){
  55. if($f['parent_id']==$gf['id']){
  56. $fArr[$j] = $f;
  57. $sArr = array();
  58. $k = 0;
  59. foreach($son as $s){
  60. if($s['parent_id']==$f['id']){
  61. $sArr[$k] = $s;
  62. $k++;
  63. }
  64. }
  65. $fArr[$j]['everyTime']=$sArr;
  66. $k = 0;
  67. $j++;
  68. }
  69. }
  70. $gfArr[$i]['everyDate']=$fArr;
  71. $j = 0;
  72. $i++;
  73. }
  74. $data['chartInfo']=$gfArr;
  75. $i = 0;
  76. }else{
  77. }
  78. }else{
  79. $data['code']='1';
  80. $data['info']='获取班次销售报表失败';
  81. }
  82. }
  83. $stmt->closeCursor();
  84. break;
  85. default:
  86. break;
  87. }
  88. if(is_array($data)){
  89. echo json_encode($data);
  90. }
  91. exit;