<?php
include_once "../inc/getBasic.inc.php";
include_once "../inc/getData.inc.php";
include_once "../inc/postJson.inc.php";
include_once "../inc/getFinanceData.class.php";

$_REQUEST['ts_code']=$_REQUEST['ts_code']?$_REQUEST['ts_code']:'000002';
$_REQUEST['yst']=$_REQUEST['yst']?$_REQUEST['yst']:'2015';
$_REQUEST['yed']=$_REQUEST['yed']?$_REQUEST['yed']:date('Y');
$ts_name = tscodeToName(ts_code_conv($_REQUEST['ts_code']));
$title="六段式表格:".$ts_name.'('.$_REQUEST['ts_code'].')';
$years=yearList($_REQUEST['yst'],$_REQUEST['yed']);
$thWidth = round(1/(count($years)+1)*100,1);
$thWidth .='%';
$urlAppend="ts_code={$_REQUEST['ts_code']}&yst={$_REQUEST['yst']}&yed={$_REQUEST['yed']}";

include_once "../html/head.php";
?>


<form name="main" id="main" method="get"> <div style="width:100%;text-align:center">

股票代码: <input type='text' name='ts_code' id='ts_code' width="30px" value='<?=$_REQUEST['ts_code']?>' >
开始时间: <input type='input' name='yst' id='yst' width='20px' list='yearlist' autocomplete="off" >
<datalist id="yearlist">
    <option value="2022"></option>
    <option value="2021"></option>
    <option value="2020"></option>
    <option value="2019"></option>
    <option value="2018"></option>
    <option value="2017"></option>
    <option value="2016"></option>
    <option value="2015"></option>
</datalist>

结束时间: <input type='input' name='yed' id='yed' width='20px'list='yearlist'  autocomplete="off" >

        <script>
            $("#yst").val('<?=$_REQUEST['yst']?>');
            $("#yed").val('<?=$_REQUEST['yed']?>');
        </script>
<input type='submit' value="给我查!">

<div >&nbsp;</div>

</div> </form>

<div id="container" style="margin:0 auto;height:auto;width: 90%">
  <table id="fina" class="display" style="width: 100%">
      <thead>
      <tr>
          <th> </th>
          <?php
          for($i=0;$i<count($years);$i++) echo "<th style='width:{$thWidth};text-align: left;'> ".yearToname($years[$i])."</th>\n";
          ?>

      </tr>
      </thead>
      <tfoot>
      <tr>
          <th> </th>
          <?php
          for($i=0;$i<count($years);$i++) echo "<th style='width:{$thWidth};text-align: left;'> ".yearToname($years[$i])."</th>\n";
          ?>

      </tr>
      </tfoot>
  </table>

</div>

<?php include_once "../html/footer.php"; ?>
<script>
    $(document).ready(function() {
        $('#fina').DataTable( {
            paging:false,
            scrollY:950,
            ordering:false,
            "ajax": 'https://echart.doorcome.cn/inc/ajax.inc.php?t=financeData&<?=$urlAppend?>'

        } );
    } );
</script>

