<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->totalcount as $company => $service) { ?>
      <tr>
        <td><?= $company ?></td>
        <?php foreach ($service as $name => $location) { ?>
          <td><?= $location['Tokyo']; ?></td>
          <td><?= $location['Chiba']; ?></td>
        <?php } ?>
        <td><?= $service['test']['Tokyo'] + $service['test']['Chiba']; ?></td>
        <td><?= $this->summary[$company]['Tokyo'] - $service['test']['Tokyo']; ?></td>
        <td><?= $this->summary[$company]['Chiba'] - $service['test']['Chiba']; ?></td>
        <td><?= $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->siteInfo['totalcount_types']  as $type) { ?>
        <td><?= $this->summary[$type]['Tokyo']; ?></td>
        <td><?= $this->summary[$type]['Chiba']; ?></td>
      <?php } ?>
      <td><?= $this->summary['test']['Tokyo'] + $this->summary['test']['Chiba']; ?></td>
      <td><?= $this->total['Tokyo'] - $this->summary['test']['Tokyo']; ?></td>
      <td><?= $this->total['Chiba'] - $this->summary['test']['Chiba']; ?></td>
      <td><?= $this->total['Tokyo'] - $this->summary['test']['Tokyo'] + $this->total['Chiba'] - $this->summary['test']['Chiba']; ?></td>
    </tr>
  </tfoot>
</table>