@extends('layouts.report') @section('title', '請求書') @section('content') @php $RECORDS_PER_PAGE = 18; $pages = []; $page = []; $total = []; $total['件数'] = 0; $total['金額'] = 0; foreach($viewdata['invoice']['details'] as $detail) { $page[] = $detail; $total['件数'] += 1; $total['金額'] += $detail['金額']; if (count($page) >= $RECORDS_PER_PAGE) { $pages[] = $page; $page = []; } } if (count($page) > 0) { $pages[] = $page; $page = []; } @endphp @foreach($pages as $i => $page) @include('invoice/report01-01',[ 'title' => '請求明細書', 'pagenum' => ($i + 1), 'pagetotal' => count($pages), 'record_per_page' => $RECORDS_PER_PAGE, 'pagedata'=>$page, 'total' => (($i == count($pages) - 1) ? $total : null), ]) @endforeach @foreach($pages as $i => $page) @include('invoice/report01-01',[ 'title' => '請求明細書(控)', 'pagenum' => ($i + 1), 'pagetotal' => count($pages), 'record_per_page' => $RECORDS_PER_PAGE, 'pagedata'=>$page, 'total' => (($i == count($pages) - 1) ? $total : null), ]) @endforeach @endsection