index.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <?php
  2. $this->title = '历史报表';
  3. ?>
  4. <?php $this->beginBlock('header_script'); ?>
  5. <link href="<?= STATIC_URL ?>/ui/css/plugins/dataTables/datatables.min.css" rel="stylesheet">
  6. <?php $this->endBlock(); ?>
  7. <style>
  8. table.table-bordered.dataTable th, table.table-bordered.dataTable td {
  9. white-space: nowrap;
  10. }
  11. @media (min-width: 1600px){
  12. .container {
  13. width: 1550px;
  14. }
  15. }
  16. @media (min-width: 1920px){
  17. .container {
  18. width: 1550px;
  19. }
  20. }
  21. </style>
  22. <div class="row">
  23. <div class="col-md-2">
  24. <?= $this->render('/common/_left_menu.php') ?>
  25. </div>
  26. <div class="col-md-10">
  27. <div class="ibox">
  28. <div class="ibox-title">
  29. <h2>历史报表</h2>
  30. </div>
  31. <form>
  32. <input type="hidden" name="type" value="<?= $type ?>">
  33. <div class="ibox-content m-b-sm border-bottom">
  34. <div class="row">
  35. <div class="col-sm-3">
  36. <div class="form-group">
  37. <label class="control-label" for="price">上级代理商</label>
  38. <select name="ibId" class="form-control select22">
  39. <option value="">请选择</option>
  40. <?php foreach ($ibs as $k => $v) : ?>
  41. <option value="<?= $v['id'] ?>" <?= $ibId == $v['id'] ? 'selected="selected"' : '' ?> ><?= $v['name'] ?></option>
  42. <?php endforeach; ?>
  43. </select>
  44. </div>
  45. </div>
  46. <div class="col-sm-2">
  47. <div class="form-group">
  48. <label class="control-label" for="price">客户姓名</label>
  49. <input type="text" id="name" name="name" value="<?= $name ?>" placeholder="客户姓名" class="form-control">
  50. </div>
  51. </div>
  52. <div class="col-sm-2">
  53. <div class="form-group">
  54. <label class="control-label" for="price">开始时间</label>
  55. <input readonly="readonly" type="text" id="sTime" name="sTime" value="<?= $sTime ?>" placeholder="开始时间" class="data form-control">
  56. </div>
  57. </div>
  58. <div class="col-sm-2">
  59. <div class="form-group">
  60. <label class="control-label" for="quantity">结束时间</label>
  61. <input readonly="readonly" type="text" id="eTime" name="eTime" value="<?= $eTime ?>" placeholder="结束时间" class="data form-control">
  62. </div>
  63. </div>
  64. <div class="col-sm-3">
  65. <div class="form-group">
  66. <label class="control-label" for="quantity">操作</label>
  67. <input type="submit" class="btn btn-primary form-control" value="搜索">
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </form>
  73. <div class="ibox-content">
  74. <div class="table-responsive">
  75. <table id="datatables" class="table table-striped table-bordered table-hover dataTables-example">
  76. <thead>
  77. <tr>
  78. <th>订单号</th>
  79. <th>账户</th>
  80. <th>姓名</th>
  81. <th>类型</th>
  82. <th>品种</th>
  83. <th>SL</th>
  84. <th>TP</th>
  85. <th>手数</th>
  86. <th>开仓价格</th>
  87. <th>开仓时间</th>
  88. <th>平仓价格</th>
  89. <th>平仓时间</th>
  90. <th>利息</th>
  91. <th>佣金</th>
  92. <th>获利</th>
  93. </tr>
  94. </thead>
  95. </table>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <?php $this->beginBlock('footer_script'); ?>
  102. <!-- Mainly scripts -->
  103. <script src="<?= STATIC_URL ?>/ui/js/plugins/dataTables/datatables.min.js"></script>
  104. <script>
  105. var table;
  106. $(document).ready(function() {
  107. table = $('#datatables').DataTable({
  108. <?php if ($isHaveAdmin) : ?>
  109. "aLengthMenu": [[20,50,100,500,999999999], [20,50,100,500,"ALL"]],
  110. <?php else : ?>
  111. "aLengthMenu": [[20,50,100,500], [20,50,100,500]],
  112. <?php endif; ?>
  113. language: {
  114. "sProcessing": "处理中...",
  115. "sLengthMenu": "显示 _MENU_ 项结果",
  116. "sZeroRecords": "没有匹配结果",
  117. "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
  118. "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
  119. "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
  120. "sInfoPostFix": "",
  121. "sSearch": "搜索订单号,账户:",
  122. "sUrl": "",
  123. "sEmptyTable": "表中数据为空",
  124. "sLoadingRecords": "载入中...",
  125. "sInfoThousands": ",",
  126. "oPaginate": {
  127. "sFirst": "首页",
  128. "sPrevious": "上页",
  129. "sNext": "下页",
  130. "sLast": "末页"
  131. },
  132. "oAria": {
  133. "sSortAscending": ": 以升序排列此列",
  134. "sSortDescending": ": 以降序排列此列"
  135. }
  136. },
  137. "processing": true,
  138. "serverSide": true,
  139. "ajax": '/ib/trades?type=<?= $type ?>&sTime=<?= $sTime ?>&eTime=<?= $eTime ?>&name=<?= $name ?>&ibId=<?= $ibId ?>',
  140. "order": [[0, "desc"]],
  141. "columns": [{
  142. "data": "TICKET"
  143. },{
  144. "data": "LOGIN"
  145. },{
  146. "data": "NAME"
  147. },
  148. {
  149. "data": "CMD"
  150. },
  151. {
  152. "data": "SYMBOL"
  153. },
  154. {
  155. "data": "SL"
  156. },
  157. {
  158. "data": "TP"
  159. },
  160. {
  161. "data": "VOLUME"
  162. },
  163. {
  164. "data": "OPEN_PRICE"
  165. },
  166. {
  167. "data": "OPEN_TIME"
  168. },
  169. {
  170. "data": "CLOSE_PRICE"
  171. },
  172. {
  173. "data": "CLOSE_TIME"
  174. },
  175. {
  176. "data": "SWAPS"
  177. },
  178. {
  179. "data": "COMMISSION"
  180. },
  181. {
  182. "data": "PROFIT"
  183. }],
  184. columnDefs: [{
  185. targets: 2,
  186. "orderable": false
  187. },{
  188. targets: 3,
  189. render: function(data, type, row, meta) {
  190. if(data==0){
  191. return 'BUY';
  192. }else if (data==1){
  193. return 'SELL';
  194. }else if (data==2){
  195. return 'BUY LIMIT';
  196. }else if (data==3){
  197. return 'SELL LIMIT';
  198. }else if (data==4){
  199. return 'BUY STOP';
  200. }else if (data==5){
  201. return 'SELL STOP';
  202. }else if (data==6){
  203. return 'BALANCE';
  204. }else if (data==7){
  205. return 'CREDIT';
  206. }else{
  207. return '';
  208. }
  209. },
  210. "orderable": true
  211. },{
  212. targets: 7,
  213. render: function(data, type, row, meta) {
  214. if(data!=""){
  215. return data/100;
  216. }else{
  217. return "";
  218. }
  219. },
  220. "orderable": true
  221. }],
  222. "sPaginationType": "full_numbers",
  223. dom: '<"html5buttons"B>lTfgitp',
  224. buttons: [{
  225. extend: 'copy'
  226. },
  227. {
  228. extend: 'csv'
  229. },
  230. {
  231. extend: 'excel'
  232. },
  233. {
  234. extend: 'pdf'
  235. },
  236. {
  237. extend: 'print',
  238. customize: function(win) {
  239. $(win.document.body).addClass('white-bg');
  240. $(win.document.body).css('font-size', '10px');
  241. $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit');
  242. }
  243. }]
  244. });
  245. $('#datatables tbody').on('click', 'tr', function() {
  246. if ($(this).hasClass('selected')) {
  247. $(this).removeClass('selected');
  248. } else {
  249. table.$('tr.selected').removeClass('selected');
  250. $(this).addClass('selected');
  251. }
  252. });
  253. });
  254. </script>
  255. <?php $this->endBlock(); ?>