index.php 7.3 KB

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