@extends('layouts.report') @section('title', '請求明細一覧表') @section('content') @php $RECORDS_PER_PAGE = 40; $pages = []; $page = []; $total = []; $total['件数'] = 0; $total['前回御請求額'] = 0; $total['入金額'] = 0; $total['値引額'] = 0; $total['差引繰越高'] = 0; $total['当月売上高'] = 0; $total['当月返品値引'] = 0; $total['当月純売上高'] = 0; $total['消費税額'] = 0; $total['当月御請求高'] = 0; foreach($viewdata['invoices'] as $invoice) { $page[] = $invoice; $total['件数'] += 1; $total['前回御請求額'] += $invoice['attributes']['前回請求']['請求額']; $total['入金額'] += $invoice['attributes']['前回請求']['入金額']; $total['値引額'] += 0; $total['差引繰越高'] += $invoice['attributes']['前回請求']['残額']; $total['当月売上高'] += $invoice['attributes']['当月請求']['買上額']; $total['当月返品値引'] += $invoice['attributes']['当月請求']['返品値引額']; $total['当月純売上高'] += $invoice['attributes']['当月請求']['買上額'] - $invoice['attributes']['当月請求']['返品値引額']; $total['消費税額'] += $invoice['attributes']['当月請求']['消費税額']; $total['当月御請求高'] += $invoice['attributes']['当月請求']['請求額']; if (count($page) >= $RECORDS_PER_PAGE) { $pages[] = $page; $page = []; } } if (count($page) > 0) { $pages[] = $page; $page = []; } @endphp @foreach($pages as $i => $page) @include('invoice/report02-01',[ 'pagenum' => ($i + 1), 'pagetotal' => count($pages), 'pagedata'=>$page, 'total' => (($i == count($pages) - 1) ? $total : null), ]) @endforeach @endsection