<div class="search_order_box well" style="margin: -10px 0 0 0;">
  <form class="form-inline order_search_group" method="post" action="<?php echo site_url('statistics/product/'.$source); ?>">
    <div class="form-group">
      <label for="exampleInputEmail2">统计日期</label>
      <input type="text" name="startdate" class="form-control input-sm datepicker lyydatepicker" value="<?php echo $startdate; ?>" autocomplete="off">
      <label for="exampleInputName2" style="width:auto">到</label>
      <input type="text" name="enddate" class="form-control input-sm datepicker lyydatepicker" value="<?php echo $enddate; ?>" autocomplete="off">
    </div>
    <button type="submit" class="btn btn-sm btn-primary" style="margin-top:-5px;">统　计</button>
  </form>
</div>

<div class="col-xs-24 content">
  <table class="table table-bordered table-product">
      <thead>
        <tr>
          <th width="80">产品代号</th>
          <th>统计项目</th>
          <th><?php echo $startdate.'<br>'.$enddate; ?></th>
          <th>同比</th>
          <th>同比增长</th>
          <th>环比</th>
          <th>环比增长</th>
        </tr>
      </thead>
      <tbody>
      <?php foreach ($total_order_count as $key => $value) { ?>
        <tr>
          <td rowspan="9"><?php echo empty($key)?'未知':$key; ?></td>
          <td>订单数</td>
          <td><?php echo $order_count=empty($value)?0:$value; ?></td>
          <td><?php echo $year_order_count=isset($last_year_order_count[$key])?$last_year_order_count[$key]:0; ?></td>
          <td><?php echo set_rate($year_order_count,($order_count-$year_order_count)); ?></td>
          <td><?php echo $month_order_count=isset($last_month_order_count[$key])?$last_month_order_count[$key]:0; ?></td>
          <td><?php echo set_rate($month_order_count,($order_count-$month_order_count)); ?></td>
        </tr>
        <tr>
          <td>成行数</td>
          <td><?php echo $order_success_count=isset($total_success_count[$key])?$total_success_count[$key]:0; ?></td>
          <td><?php echo $year_success_order_count=isset($last_year_success_count[$key])?$last_year_success_count[$key]:0; ?></td>
          <td><?php echo set_rate($year_success_order_count,($order_success_count-$year_success_order_count)); ?></td>
          <td><?php echo $month_success_count=isset($last_month_success_count[$key])?$last_month_success_count[$key]:0; ?></td>
          <td><?php echo set_rate($month_success_count,($order_success_count-$month_success_count)); ?></td>
        </tr>
        <tr>
          <td>成行率</td>
          <td><?php echo $c_order_rate=set_rate($order_count,$order_success_count); ?></td>
          <td><?php echo $y_order_rate=set_rate($year_order_count,$year_success_order_count); ?></td>
          <td><?php echo set_rate($y_order_rate,($c_order_rate-$y_order_rate)); ?></td>
          <td><?php echo $m_order_rate=set_rate($month_order_count,$month_success_count); ?></td>
          <td><?php echo set_rate($m_order_rate,($c_order_rate-$m_order_rate)); ?></td>
        </tr>
        <tr>
          <td>总人数</td>
          <td><?php echo $guest_count=isset($total_guest_count[$key])?$total_guest_count[$key]:0; ?></td>
          <td><?php echo $year_guest_count=isset($last_year_guest_count[$key])?$last_year_guest_count[$key]:0; ?></td>
          <td><?php echo set_rate($year_guest_count,($guest_count-$year_guest_count)); ?></td>
          <td><?php echo $month_guest_count=isset($last_month_guest_count[$key])?$last_month_guest_count[$key]:0; ?></td>
          <td><?php echo set_rate($month_guest_count,($guest_count-$month_guest_count)); ?></td>
        </tr>
        <tr>
          <td>成行人数</td>
          <td><?php echo $success_count=isset($guest_success_count[$key])?$guest_success_count[$key]:0; ?></td>
          <td><?php echo $year_success_guest=isset($last_year_success_guest[$key])?$last_year_success_guest[$key]:0; ?></td>
          <td><?php echo set_rate($year_success_guest,($success_count-$year_success_guest)); ?></td>
          <td><?php echo $month_success_guest=isset($last_month_success_guest[$key])?$last_month_success_guest[$key]:0; ?></td>
          <td><?php echo set_rate($month_success_guest,($success_count-$month_success_guest)); ?></td>
        </tr>
        <tr>
          <td>(人数)成行率</td>
          <td><?php echo $c_guest_rate=set_rate($guest_count,$success_count); ?></td>
          <td><?php echo $y_guest_rate=set_rate($year_guest_count,$year_success_guest); ?></td>
          <td><?php echo set_rate($y_guest_rate,($c_guest_rate-$y_guest_rate)); ?></td>
          <td><?php echo $m_guest_rate=set_rate($month_guest_count,$month_success_guest); ?></td>
          <td><?php echo set_rate($m_guest_rate,($c_guest_rate-$m_guest_rate)); ?></td>
        </tr>
        <tr>
          <td>总销售额</td>
          <td><?php echo $sale_money=isset($total_money[$key])?$total_money[$key]:0;; ?></td>
          <td><?php echo $year_money=isset($last_year_money[$key])?$last_year_money[$key]:0; ?></td>
          <td><?php echo set_rate($year_money,($sale_money-$year_money)); ?></td>
          <td><?php echo $month_money=isset($last_month_money[$key])?$last_month_money[$key]:0; ?></td>
          <td><?php echo set_rate($month_money,($sale_money-$month_money)); ?></td>
        </tr>
        <tr>
          <td>成功销售额</td>
          <td><?php echo $success_money=isset($total_success_money[$key])?$total_success_money[$key]:0; ?></td>
          <td><?php echo $year_success_money=isset($last_year_success_money[$key])?$last_year_success_money[$key]:0; ?></td>
          <td><?php echo set_rate($year_success_money,($success_money-$year_success_money)); ?></td>
          <td><?php echo $month_success_money=isset($last_month_success_money[$key])?$last_month_success_money[$key]:0; ?></td>
          <td><?php echo set_rate($month_success_money,($success_money-$month_success_money)); ?></td>
        </tr>
        <tr>
          <td>销售成功率</td>
          <td><?php echo $c_rate=set_rate($sale_money,$success_money); ?></td>
          <td><?php echo $y_rate=set_rate($year_money,$year_success_money); ?></td>
          <td><?php echo set_rate($y_rate,($c_rate-$y_rate)); ?></td>
          <td><?php echo $m_rate=set_rate($month_money,$month_success_money); ?></td>
          <td><?php echo set_rate($m_rate,($c_rate-$m_rate)); ?></td>
        </tr>
      <?php } ?>
      </tbody>
    </table>
</div>