
<style>
  table {
    border-collapse: collapse;
  }

  table,
  td,
  th {
    border: 1px solid black;
    text-align: center;
  }
</style>
<table class="table table-bordered table-hover table-striped">
  <thead>
    <tr>
      <td rowspan="2">고객명</td>
      <td colspan="2">일반</td>
      <td colspan="2">방어</td>
      <td colspan="2">전용</td>
      <td colspan="2">대체</td>
      <td colspan="3">테스트</td>
      <td colspan="3">합계</td>
    </tr>
    <tr>
      <td>도쿄</td>
      <td>치바</td>
      <td>도쿄</td>
      <td>치바</td>
      <td>도쿄</td>
      <td>치바</td>
      <td>도쿄</td>
      <td>치바</td>
      <td>도쿄</td>
      <td>치바</td>
      <td>합계</td>
      <td>도쿄</td>
      <td>치바</td>
      <td>합계</td>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($this->results as $company => $service) {?>
      <tr>
        <td><?php echo $company ?></td>
        <?php foreach ($service as $name => $location) {?>
          <td><?php echo $location['Tokyo']; ?></td>
          <td><?php echo $location['Chiba']; ?></td>
        <?php }?>
        <td><?php echo $service['test']['Tokyo'] + $service['test']['Chiba']; ?></td>
        <td><?php echo $this->summary[$company]['Tokyo'] - $service['test']['Tokyo']; ?></td>
        <td><?php echo $this->summary[$company]['Chiba'] - $service['test']['Chiba']; ?></td>
        <td><?php echo $this->summary[$company]['Tokyo'] - $service['test']['Tokyo'] + $this->summary[$company]['Chiba'] - $service['test']['Chiba']; ?></td>
      </tr>
    <?php }?>
  </tbody>
  <tfoot>
    <tr>
      <td>총합계</td>
      <?php foreach ($this->_values['types'] as $type) {?>
        <td><?php echo $this->summary[$type]['Tokyo']; ?></td>
        <td><?php echo $this->summary[$type]['Chiba']; ?></td>
      <?php }?>
      <td><?php echo $this->summary['test']['Tokyo'] + $this->summary['test']['Chiba']; ?></td>
      <td><?php echo $this->total['Tokyo'] - $this->summary['test']['Tokyo']; ?></td>
      <td><?php echo $this->total['Chiba'] - $this->summary['test']['Chiba']; ?></td>
      <td><?php echo $this->total['Tokyo'] - $this->summary['test']['Tokyo'] + $this->total['Chiba'] - $this->summary['test']['Chiba']; ?></td>
    </tr>
  </tfoot>
</table>