{{-- x-app-layoutの標準エラー表示を非表示 --}} @php($breadcrumbs = ['営業予算一覧'=>null]) {{-- まとめエラーメッセージ表示(検索条件セクションの上、x-app-layoutと同じ位置) --}} @if(session('budget_validation_summary'))
入力にエラーがあります。
    @foreach(session('budget_validation_summary') as $error)
  • ・{{ $error }}
  • @endforeach
@endif {{-- 検索条件 --}}
@csrf
{{-- 成功メッセージ表示 --}} @if(session('success'))
{{ session('success') }}
@endif {{-- メインコンテンツ --}}
{{-- 編集権限チェック --}} @php($visible = ($permissions && $permissions->canUpdate) ? '' : 'hidden')
{{-- Excel出力ボタン --}}
{{-- 登録ボタン --}}
{{-- データ表示・保存Form --}}
@csrf {{-- 検索条件をhidden fieldとして保持 --}} @if(count($matrix_data) > 0) @php($currentSalesperson = null) @php($currentParentCategory = null) @php($tableStarted = false) @foreach($matrix_data as $categoryIndex => $category) {{-- 営業担当者が変わったら新しいセクション --}} @if($currentSalesperson !== $category['salesperson_id']) @php($currentSalesperson = $category['salesperson_id']) {{-- 前のセクションを閉じる --}} @if($tableStarted)
@endif {{-- 新しい営業担当者セクション --}}

{{ $category['salesperson_name'] }}

@foreach($months as $monthIndex => $monthData) @php($headerYear = $monthData['year']) @endforeach @php($tableStarted = true) @php($currentParentCategory = null) @elseif(!$tableStarted) {{-- 営業担当者別表示でない場合の初回テーブル開始 --}}
中分類 項目
@if($monthIndex == 0 || ($monthIndex > 0 && $months[$monthIndex-1]['year'] != $monthData['year']))
{{ $headerYear }}年
@endif
{{ $monthData['month'] }}月
年間合計
@foreach($months as $monthIndex => $monthData) @php($headerYear = $monthData['year']) @endforeach @php($tableStarted = true) @endif {{-- 大分類が変わったらheader行を表示 --}} @if($currentParentCategory !== $category['parent_category_id']) @php($currentParentCategory = $category['parent_category_id']) @endif {{-- 売上目標行 --}} @foreach($months as $monthData) @php($monthValue = $category['sales_targets'][$monthData['month']] ?? 0) @php($currentDate = new DateTime()) @php($actualYear = $monthData['year']) @php($targetDate = new DateTime($actualYear . '-' . str_pad($monthData['month'], 2, '0', STR_PAD_LEFT) . '-01')) @php($isPastMonth = $targetDate < $currentDate) @endforeach {{-- 粗利目標行 --}} @foreach($months as $monthData) @php($profitValue = $category['profit_targets'][$monthData['month']] ?? 0) @php($currentDate = new DateTime()) @php($actualYear = $monthData['year']) @php($targetDate = new DateTime($actualYear . '-' . str_pad($monthData['month'], 2, '0', STR_PAD_LEFT) . '-01')) @php($isPastMonth = $targetDate < $currentDate) @endforeach @endforeach {{-- 最後のテーブルを閉じる --}} @if($tableStarted)
中分類 項目
@if($monthIndex == 0 || ($monthIndex > 0 && $months[$monthIndex-1]['year'] != $monthData['year']))
{{ $headerYear }}年
@endif
{{ $monthData['month'] }}月
年間合計
{{ $category['parent_category_name'] }}
{{ $category['category_name'] }} 売上目標 @if($permissions && $permissions->canUpdate) @if($isPastMonth) @else @endif @else {{ number_format($monthValue) }} @endif {{ number_format(array_sum($category['sales_targets'])) }}
粗利目標 @if($permissions && $permissions->canUpdate) @if($isPastMonth) @else @endif @else {{ number_format($profitValue) }} @endif {{ number_format(array_sum($category['profit_targets'])) }}
@endif @else
データがありません
@endif {{-- budgetForm 終了 --}}
{{-- script --}}