25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

381 lines
20 KiB

  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 张帅
  12. * PhpStorm statistical-from.php
  13. * Create By 2017/1/12 11:39 $
  14. */
  15. use backend\modules\zzcs\assets\ZzcsAsset;
  16. use yii\widgets\Pjax;
  17. ZzcsAsset::addScript($this, '/gathering/js/tool.js');
  18. ZzcsAsset::addCss($this, '/finance/css/bus_cost.css');
  19. ZzcsAsset::addCss($this, '/plug/My97DatePicker/skin/WdatePicker.css');
  20. ZzcsAsset::addScript($this, '/finance/js/bus_cost.js?v=001');
  21. ZzcsAsset::addScript($this, '/plug/date-time/date-manage.js?v=001');
  22. ZzcsAsset::addScript($this, '/plug/My97DatePicker/WdatePicker.js');
  23. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dist/css/bootstrap.css');
  24. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/css/style.css');
  25. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/css/bootstrap-datetimepicker.css');
  26. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/docs/assets/css/docs.min.css');
  27. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/css/home.css');
  28. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/css/prettify.min.css');
  29. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/css/module.css');
  30. ZzcsAsset::addCssHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/css/xcConfirm.css');
  31. ZzcsAsset::addScriptHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/js/bootstrap-datetimepicker.min.js');
  32. ZzcsAsset::addScriptHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/js/module.js');
  33. ZzcsAsset::addScriptHTTP($this,'http://img.zhizhuchuxing.cn/zzframe/dists/js/xcConfirm.js');
  34. ?>
  35. <div class="search_station">
  36. <ul id="search_station">
  37. <li class="search1">
  38. <span>查询维度:</span>
  39. <select class="dimensionality" onchange="showChannel(this)">
  40. <?php foreach ($dimensionality as $key => $vel) { ?>
  41. <option value="<?php echo $key; ?>"><?php echo $vel; ?></option>
  42. <?php } ?>
  43. </select>
  44. </li>
  45. <!--<li class="search1" style="display: none">
  46. <span>口径:</span>
  47. <select class="dimensionality2">
  48. <option value="2">出行日期</option>
  49. <option value="1">预定日期</option>
  50. </select>
  51. </li>-->
  52. <li class="search1">
  53. <span>线路类型:</span>
  54. <select class="dimensionality2">
  55. <option value="0">全部</option>
  56. <option value="1">市内</option>
  57. <option value="2">省际</option>
  58. </select>
  59. </li>
  60. <li class="search2">
  61. <span>出发起止日期:</span>
  62. <input type="text" id="start_date" onclick="WdatePicker({onpicked:changeEndDate})" value="<?php echo $start_date; ?>"/>
  63. <span>&nbsp;&nbsp;-&nbsp;&nbsp;</span>
  64. <input type="text" id="end_date" onclick="WdatePicker({onpicked:changeStartDate})" value="<?php echo $end_date; ?>"/>
  65. </li>
  66. <li class="search6">
  67. <span>线路代码:</span>
  68. <input type="text" id="line_code" size="10" />
  69. </li>
  70. <li class="search6">
  71. <span>发车时间:</span>
  72. <div id="time_id_1_1" class="timepicker_box">
  73. <span class="form-inline timepicker">
  74. <input type="text" class="form-control bus_start_time" readonly>
  75. <span class="glyphicon glyphicon-time"></span>
  76. </span>
  77. <div class="timepicker_select">
  78. <div class="select_hour_box"></div>
  79. <div class="select_minute_box"></div>
  80. </div>
  81. </div>
  82. </li>
  83. <li class="search3">
  84. <span class="btn-primary" id="search_btn" onclick='searchInfo()'>查询</span>
  85. </li>
  86. <li class="search4">
  87. <span class="btn-primary" id="export_btn" onclick='exportInfo()'>导出</span>
  88. </li>
  89. </ul>
  90. </div>
  91. <?php Pjax::begin(['id' => 'main_table', 'timeout' => 30000000]) ?>
  92. 上座率颜色说明:<span class="green_color" style="font-size: 20px;">■</span> ~ 30% <span class="yellow_color"
  93. style="font-size: 20px;">■</span> 30% ~ 70%
  94. <span class="red_color" style="font-size: 20px;">■</span> 70% ~<br/>
  95. <div class="table_list">
  96. <table id="table_list" data-time="<?php echo time();?>">
  97. <thead>
  98. <tr>
  99. <th class="td1">编号</th>
  100. <th class="td2"><?php echo $statistical_type; ?></th>
  101. <th class="td3">订单数</th>
  102. <th class="td4">人次</th>
  103. <th class="td5">上座率</th>
  104. <th class="td6">GMV</th>
  105. <th class="td11">赔入</th>
  106. <th class="td12">赔出</th>
  107. <th class="td7">成本</th>
  108. <th class="td8">GP</th>
  109. <th class="td9">GP率</th>
  110. <th class="td10">订单明细</th>
  111. <!--<th class="td9">人次月环比</th>
  112. <th class="td10">GMV月环比</th>-->
  113. </tr>
  114. </thead>
  115. <tbody>
  116. <!-- 合计 -->
  117. <tr>
  118. <td class="td1" style="color:#0095d9;font-size:larger;">-</td>
  119. <td class="td2" style="color:#0095d9;font-size:larger;">合计</td>
  120. <td class="td3"
  121. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php if (!isset($final_amount['order_num'])) {
  122. $final_amount['order_num'] = 0;
  123. }
  124. echo number_format($final_amount['order_num']); ?></td>
  125. <td class="td4"
  126. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php if (!isset($final_amount['people_num'])) {
  127. $final_amount['people_num'] = 0;
  128. }
  129. echo number_format($final_amount['people_num']); ?></td>
  130. <td class="td5"
  131. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php if ($search_dimensionality == 2 || $search_dimensionality == 3 || $final_amount['total_saled_count'] == 0) {
  132. echo "-";
  133. } else {
  134. $disp_percent = ($final_amount['total_saled_count'] == 0) ? 0 : $final_amount['total_saled_count'] / $final_amount['total_seat_count'] * 100;
  135. echo number_format($disp_percent, 2) . "%";
  136. } ?></td>
  137. <td class="td6"
  138. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['total_price'], 2); ?></td>
  139. <td class="td11"
  140. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['total_peiru'], 2); ?></td>
  141. <td class="td12"
  142. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['total_peichu'], 2); ?></td>
  143. <td class="td7"
  144. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['cost'], 2); ?></td>
  145. <td class="td8"
  146. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['gp'], 2); ?></td>
  147. <td class="td9 <?php
  148. if ($final_amount['gp'] >= 0) {
  149. echo 'red_color';
  150. } else {
  151. echo 'green_color';
  152. } ?>" style="text-align:right;padding-right: 10px;"><?php echo $final_amount['gp_rate']; ?></td>
  153. <td class="td10">-</td>
  154. </tr>
  155. <!-- end 合计 -->
  156. <?php
  157. if (count($rows) > 0) {
  158. foreach ($rows as $key => $vel) { ?>
  159. <tr>
  160. <td class="td1"><?php echo $vel['no']; ?></td>
  161. <td class="td2"><?php echo $vel['type_data']; ?></td>
  162. <th class="td3"
  163. style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['order_num']); ?></th>
  164. <td class="td4"
  165. style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['people_num']); ?></td>
  166. <td class="td5" style="text-align:right;padding-right: 10px;">
  167. <?php if ($search_dimensionality == 2 || $search_dimensionality == 3 || $vel['total_saled_count'] == 0) {
  168. echo "-";
  169. } else {
  170. $disp_percent = ($vel['total_saled_count'] == 0) ? 0 : $vel['total_saled_count'] / $vel['total_seat_count'] * 100;
  171. $disp_color = "red_color";
  172. if ($disp_percent < 30) {
  173. $disp_color = "green_color";
  174. } else if ($disp_percent < 70) {
  175. $disp_color = "yellow_color";
  176. }
  177. echo '<span class="' . $disp_color . '">' . number_format($disp_percent, 2) . "%</span>";
  178. }
  179. ?>
  180. </td>
  181. <td class="td6"
  182. style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['total_price'], 2); ?></td>
  183. <td class="td11"
  184. style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['peiru'], 2); ?> </td>
  185. <td class="td12"
  186. style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['peichu'], 2); ?> </td>
  187. <td class="td7"
  188. style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['cost'], 2); ?> </td>
  189. <td class="td8 <?php if ($vel['gp'] >= 0) {
  190. echo 'red_color';
  191. } else {
  192. echo 'green_color';
  193. } ?>" style="text-align:right;padding-right: 10px;"><?php echo number_format($vel['gp'], 2); ?></td>
  194. <td class="td9 <?php if ($vel['gp_rate'] == '-') {
  195. } else if ($vel['gp_rate'] >= 0) {
  196. echo 'red_color';
  197. } else {
  198. echo 'green_color';
  199. } ?>" style="text-align:right;padding-right: 10px;"><?php echo $vel['gp_rate']; ?></td>
  200. <td class="td10"><a target="_blank" href="<?php echo $vel['url'] ?>">下载</a></td>
  201. </tr>
  202. <?php }
  203. } ?>
  204. <!--空车成本(渠道维度显示)-->
  205. <?php if ($empty_bus_cost) { ?>
  206. <tr>
  207. <td class="td1" style="color:#FF5722;font-size:larger;">-</td>
  208. <td class="td2" style="color:#FF5722;font-size:larger;">空车成本</td>
  209. <td class="td3"
  210. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php if (!isset($empty_bus_cost['order_num'])) {
  211. $empty_bus_cost['order_num'] = 0;
  212. }
  213. echo number_format($empty_bus_cost['order_num']); ?></td>
  214. <td class="td4"
  215. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php if (!isset($empty_bus_cost['people_num'])) {
  216. $empty_bus_cost['people_num'] = 0;
  217. }
  218. echo number_format($empty_bus_cost['people_num']); ?></td>
  219. <td class="td5"
  220. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php echo "0%"; ?></td>
  221. <td class="td6"
  222. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($empty_bus_cost['total_price'], 2); ?></td>
  223. <td class="td11"
  224. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format(0, 2); ?></td>
  225. <td class="td12"
  226. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format(0, 2); ?></td>
  227. <td class="td7"
  228. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($empty_bus_cost['cost'], 2); ?></td>
  229. <td class="td8"
  230. style="color:#FF5722;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($empty_bus_cost['gp'], 2); ?></td>
  231. <td class="td9 <?php
  232. if ($empty_bus_cost['gp'] >= 0) {
  233. echo 'red_color';
  234. } else {
  235. echo 'green_color';
  236. } ?>" style="text-align:right;padding-right: 10px;"><?php echo $empty_bus_cost['gp_rate']; ?></td>
  237. <td class="td10">-</td>
  238. </tr>
  239. <?php } ?>
  240. <!-- end 空车成本(渠道维度显示)-->
  241. <!-- 合计 -->
  242. <tr>
  243. <td class="td1" style="color:#0095d9;font-size:larger;">-</td>
  244. <td class="td2" style="color:#0095d9;font-size:larger;">合计</td>
  245. <td class="td3"
  246. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php if (!isset($final_amount['order_num'])) {
  247. $final_amount['order_num'] = 0;
  248. }
  249. echo number_format($final_amount['order_num']); ?></td>
  250. <td class="td4"
  251. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php if (!isset($final_amount['people_num'])) {
  252. $final_amount['people_num'] = 0;
  253. }
  254. echo number_format($final_amount['people_num']); ?></td>
  255. <td class="td5"
  256. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php if ($search_dimensionality == 2 || $search_dimensionality == 3 || $final_amount['total_saled_count'] == 0) {
  257. echo "-";
  258. } else {
  259. $disp_percent = ($final_amount['total_saled_count'] == 0) ? 0 : $final_amount['total_saled_count'] / $final_amount['total_seat_count'] * 100;
  260. echo number_format($disp_percent, 2) . "%";
  261. } ?></td>
  262. <td class="td6"
  263. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['total_price'], 2); ?></td>
  264. <td class="td11"
  265. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['total_peiru'], 2); ?></td>
  266. <td class="td12"
  267. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['total_peichu'], 2); ?></td>
  268. <td class="td7"
  269. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['cost'], 2); ?></td>
  270. <td class="td8"
  271. style="color:#0095d9;font-size:larger;text-align:right;padding-right: 10px;"><?php echo number_format($final_amount['gp'], 2); ?></td>
  272. <td class="td9 <?php
  273. if ($final_amount['gp'] >= 0) {
  274. echo 'red_color';
  275. } else {
  276. echo 'green_color';
  277. } ?>" style="text-align:right;padding-right: 10px;"><?php echo $final_amount['gp_rate']; ?></td>
  278. <td class="td10">-</td>
  279. </tr>
  280. <!-- end 合计 -->
  281. </tbody>
  282. </table>
  283. </div>
  284. <!--页码信息-->
  285. <div id="page_size_d" total_row="<?php echo $page['total_row']; ?>" total_page="<?php echo $page['total_page']; ?>">
  286. <span class="page_size">每页条数</span>
  287. <select id="page_size" onchange="changePageSize(this)">
  288. <?php foreach ($page_size_arr as $key => $vel) {
  289. if ($vel == $page_size) {
  290. echo '<option value="' . $vel . '" selected=selected>' . $vel . '</option>';
  291. } else {
  292. echo '<option value="' . $vel . '">' . $vel . '</option>';
  293. }
  294. } ?>
  295. </select>
  296. </div>
  297. <div id="page_list">
  298. <?php
  299. if (count($page_arr) > 0) {
  300. foreach ($page_arr as $key => $vel) {
  301. if ($page['current_page'] == 1 && ($vel == '首页' || $vel == '<上一页')) {
  302. $class = 'not_click';
  303. } elseif ($page['current_page'] == $vel) {
  304. $class = 'click';
  305. } elseif ($page['current_page'] == $page['total_page'] && ($vel == '末页' || $vel == '下一页>')) {
  306. $class = 'not_click';
  307. } elseif ($vel == '...') {
  308. $class = 'not_click';
  309. } else {
  310. $class = 'clickable';
  311. }
  312. if ($vel != '首页' && $vel != '<上一页' && $vel != '下一页>' && $vel != '末页') {
  313. $class = 'page_num ' . $class;
  314. }
  315. if ($class == 'clickable' || $class == 'page_num clickable') {
  316. echo '<span class="' . $class . '" onclick="pageSearchInfo(this,' . $page['total_page'] . ')">' . $vel . '</span>';
  317. } else {
  318. echo '<span class="' . $class . '">' . $vel . '</span>';
  319. }
  320. }
  321. }
  322. ?>
  323. <span class="total_row">共<?php echo $page['total_row']; ?>条</span>
  324. </div>
  325. <?php Pjax::end() ?>
  326. <!-- 模态框(Modal) -->
  327. <div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
  328. style="z-index: 1050!important;"
  329. aria-hidden="true">
  330. <div class="modal-dialog">
  331. <div class="modal-content">
  332. <div class="modal-header">
  333. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  334. <h4 class="modal-title" id="myModalLabel">渠道选择</h4>
  335. </div>
  336. <div class="modal-body" style="padding-bottom:70px;">
  337. <span style="font-size: larger">已选择:</span>
  338. <span class="btn btn-primary btn-xs" style="margin: 3px" id="clear">重置</span>
  339. <div id="all" style="min-height: 70px;border-bottom: solid 1px lightgrey;">
  340. </div>
  341. <?php $channel_list = \backend\modules\zzcs\logic\Finance::getChannelList();
  342. if ($channel_list != '') {
  343. foreach ($channel_list as $k => $v) {
  344. echo "<div style='display: inline-block;width: 200px;margin-top: 10px'>
  345. <button class='btn btn-default btn-xs btn-data' id='button{$v['id']}' style='width: 180px;overflow: hidden' onclick='add(this)' data-id='{$v['id']}'>{$v['supplier_name']}</button>
  346. </div>";
  347. }
  348. }
  349. ?>
  350. </div>
  351. <div class="modal-footer navbar-fixed-bottom" >
  352. <button type="button" class="btn btn-default" data-dismiss="modal" id="close">关闭
  353. </button>
  354. <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="save()">保存</button>
  355. </div>
  356. </div><!-- /.modal-content -->
  357. </div><!-- /.modal -->
  358. </div>