index.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. </tr>
  93. </thead>
  94. </table>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <?php $this->beginBlock('footer_script'); ?>
  101. <!-- Mainly scripts -->
  102. <script src="<?= STATIC_URL ?>/ui/js/plugins/dataTables/datatables.min.js"></script>
  103. <script>
  104. var table;
  105. $(document).ready(function() {
  106. table = $('#datatables').DataTable({
  107. <?php if ($isHaveAdmin) : ?>
  108. "aLengthMenu": [[20,50,100,500,999999999], [20,50,100,500,"ALL"]],
  109. <?php else : ?>
  110. "aLengthMenu": [[20,50,100,500], [20,50,100,500]],
  111. <?php endif; ?>
  112. language: {
  113. "sProcessing": "处理中...",
  114. "sLengthMenu": "显示 _MENU_ 项结果",
  115. "sZeroRecords": "没有匹配结果",
  116. "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
  117. "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
  118. "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
  119. "sInfoPostFix": "",
  120. "sSearch": "搜索订单号,账户:",
  121. "sUrl": "",
  122. "sEmptyTable": "表中数据为空",
  123. "sLoadingRecords": "载入中...",
  124. "sInfoThousands": ",",
  125. "oPaginate": {
  126. "sFirst": "首页",
  127. "sPrevious": "上页",
  128. "sNext": "下页",
  129. "sLast": "末页"
  130. },
  131. "oAria": {
  132. "sSortAscending": ": 以升序排列此列",
  133. "sSortDescending": ": 以降序排列此列"
  134. }
  135. },
  136. "processing": true,
  137. "serverSide": true,
  138. "ajax": '/ib/trades?type=<?= $type ?>&sTime=<?= $sTime ?>&eTime=<?= $eTime ?>&name=<?= $name ?>&ibId=<?= $ibId ?>',
  139. "order": [[0, "desc"]],
  140. "columns": [{
  141. "data": "TICKET"
  142. },{
  143. "data": "LOGIN"
  144. },{
  145. "data": "NAME"
  146. },
  147. {
  148. "data": "CMD"
  149. },
  150. {
  151. "data": "SYMBOL"
  152. },
  153. {
  154. "data": "SL"
  155. },
  156. {
  157. "data": "TP"
  158. },
  159. {
  160. "data": "VOLUME"
  161. },
  162. {
  163. "data": "OPEN_PRICE"
  164. },
  165. {
  166. "data": "OPEN_TIME"
  167. },
  168. {
  169. "data": "SWAPS"
  170. },
  171. {
  172. "data": "COMMISSION"
  173. },
  174. {
  175. "data": "PROFIT"
  176. },
  177. {
  178. "data": "MODIFY_TIME"
  179. }],
  180. columnDefs: [{
  181. targets: 2,
  182. "orderable": false
  183. },{
  184. targets: 3,
  185. render: function(data, type, row, meta) {
  186. if(data==0){
  187. return 'BUY';
  188. }else if (data==1){
  189. return 'SELL';
  190. }else if (data==2){
  191. return 'BUY LIMIT';
  192. }else if (data==3){
  193. return 'SELL LIMIT';
  194. }else if (data==4){
  195. return 'BUY STOP';
  196. }else if (data==5){
  197. return 'SELL STOP';
  198. }else if (data==6){
  199. return 'BALANCE';
  200. }else if (data==7){
  201. return 'CREDIT';
  202. }else{
  203. return '';
  204. }
  205. },
  206. "orderable": true
  207. },{
  208. targets: 7,
  209. render: function(data, type, row, meta) {
  210. if(data!=""){
  211. return data/100;
  212. }else{
  213. return "";
  214. }
  215. },
  216. "orderable": true
  217. }],
  218. "sPaginationType": "full_numbers",
  219. dom: '<"html5buttons"B>lTfgitp',
  220. buttons: [{
  221. extend: 'copy'
  222. },
  223. {
  224. extend: 'csv'
  225. },
  226. {
  227. extend: 'excel'
  228. },
  229. {
  230. extend: 'pdf'
  231. },
  232. {
  233. extend: 'print',
  234. customize: function(win) {
  235. $(win.document.body).addClass('white-bg');
  236. $(win.document.body).css('font-size', '10px');
  237. $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit');
  238. }
  239. }]
  240. });
  241. $('#datatables tbody').on('click', 'tr', function() {
  242. if ($(this).hasClass('selected')) {
  243. $(this).removeClass('selected');
  244. } else {
  245. table.$('tr.selected').removeClass('selected');
  246. $(this).addClass('selected');
  247. }
  248. });
  249. });
  250. </script>
  251. <?php $this->endBlock(); ?>