<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>
    @foreach ($totalcount as $company => $service)
    <tr>
      <td>{{$company}}</td>
      @foreach ($service as $name => $location)
      <td>{{$location['Tokyo']}}</td>
      <td>{{$location['Chiba']}}</td>
      @endforeach
      <td>{{$service['test']['Tokyo'] + $service['test']['Chiba']}}</td>
      <td>{{$summary[$company]['Tokyo'] - $service['test']['Tokyo']}}</td>
      <td>{{$summary[$company]['Chiba'] - $service['test']['Chiba']}}</td>
      <td>{{$summary[$company]['Tokyo'] - $service['test']['Tokyo'] + $summary[$company]['Chiba'] - $service['test']['Chiba']}}</td>
    </tr>
    @endforeach
  </tbody>
  <tfoot>
    <tr>
      <td>총합계</td>
      @foreach ($siteInfo['totalcount_types'] as $type)
      <td>{{$summary[$type]['Tokyo']}}</td>
      <td>{{$summary[$type]['Chiba']}}</td>
      @endforeach
      <td>{{$summary['test']['Tokyo'] + $summary['test']['Chiba']}}</td>
      <td>{{$total['Tokyo'] - $summary['test']['Tokyo']}}</td>
      <td>{{$total['Chiba'] - $summary['test']['Chiba']}}</td>
      <td>{{$total['Tokyo'] - $summary['test']['Tokyo'] + $total['Chiba'] - $summary['test']['Chiba']}}</td>
    </tr>
  </tfoot>
</table>