diff --git a/resources/views/approvals/partials/_purchase-request-form.blade.php b/resources/views/approvals/partials/_purchase-request-form.blade.php index 717131ce..ebd6adab 100644 --- a/resources/views/approvals/partials/_purchase-request-form.blade.php +++ b/resources/views/approvals/partials/_purchase-request-form.blade.php @@ -449,7 +449,8 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline- 사용일자 항목 금액 - 비고 + 지급방법 + 비고 @@ -472,6 +473,14 @@ class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-n @blur="if($event.target.value.trim() === '') { item.amount = 0; $event.target.value = '0'; }" class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs text-right focus:outline-none focus:ring-1 focus:ring-blue-500"> + + + @@ -488,31 +497,24 @@ class="w-full px-2 py-1.5 border border-gray-200 rounded text-xs focus:outline-n 합계 - + + + 법인카드 + + + + + 개인선지출 + + + - - {{-- 지급방법 --}} -
- -
- - -
-
@@ -583,6 +585,7 @@ function makeItem(data) { unit_price: parseInt(data?.unit_price) || 0, amount: parseInt(data?.amount) || 0, remark: data?.remark || '', + payment_method: data?.payment_method || '', }; } @@ -660,9 +663,6 @@ function makeSchedule(data) { other: parseInt(initialData?.trip_expenses?.other) || 0, }, - // pr_settlement - payment_method: initialData?.payment_method || '', - // shared items items: items, }, @@ -677,6 +677,14 @@ function makeSchedule(data) { return this.formData.items.reduce((sum, item) => sum + (parseInt(item.amount) || 0), 0); }, + get corporateCardTotal() { + return this.formData.items.filter(i => i.payment_method === 'corporate_card').reduce((sum, i) => sum + (parseInt(i.amount) || 0), 0); + }, + + get personalAdvanceTotal() { + return this.formData.items.filter(i => i.payment_method === 'personal_advance').reduce((sum, i) => sum + (parseInt(i.amount) || 0), 0); + }, + get tripExpenseTotal() { const e = this.formData.trip_expenses; return (parseInt(e.transport) || 0) + (parseInt(e.accommodation) || 0) + (parseInt(e.meal) || 0) + (parseInt(e.other) || 0); @@ -836,7 +844,14 @@ function makeSchedule(data) { return { ...base, traveler: this.formData.traveler, destination: this.formData.destination, trip_start: this.formData.trip_start, trip_end: this.formData.trip_end, schedules: this.formData.schedules.map(s => ({ date: s.date, destination: s.destination, task: s.task })), trip_expenses: { ...this.formData.trip_expenses }, trip_expense_total: this.tripExpenseTotal }; } if (this.prType === 'pr_settlement') { - return { ...base, items: cleanItems(), total_amount: this.totalAmount, payment_method: this.formData.payment_method }; + const settlementItems = this.formData.items.map(item => ({ + date: item.date, + description: item.description, + amount: parseInt(item.amount) || 0, + payment_method: item.payment_method, + remark: item.remark, + })); + return { ...base, items: settlementItems, total_amount: this.totalAmount, corporate_card_total: this.corporateCardTotal, personal_advance_total: this.personalAdvanceTotal }; } return base; }, diff --git a/resources/views/approvals/partials/_purchase-request-show.blade.php b/resources/views/approvals/partials/_purchase-request-show.blade.php index 505abd75..dbed3d83 100644 --- a/resources/views/approvals/partials/_purchase-request-show.blade.php +++ b/resources/views/approvals/partials/_purchase-request-show.blade.php @@ -295,6 +295,12 @@ @endif @if(!empty($content['items'])) + @php + $paymentLabels = [ + 'corporate_card' => '법인카드', + 'personal_advance' => '개인선지출', + ]; + @endphp
@@ -302,6 +308,7 @@ + @@ -311,6 +318,7 @@ + @endforeach @@ -319,27 +327,24 @@ - + + @if(($content['corporate_card_total'] ?? 0) > 0 || ($content['personal_advance_total'] ?? 0) > 0) + + + + + + + + + + + @endif
사용일자 항목 금액지급방법 비고
{{ $item['date'] ?? '' }} {{ $item['description'] ?? '' }} {{ number_format($item['amount'] ?? 0) }}{{ $paymentLabels[$item['payment_method'] ?? ''] ?? ($item['payment_method'] ?? '-') }} {{ $item['remark'] ?? '' }}
합계 {{ number_format($content['total_amount'] ?? 0) }}
법인카드{{ number_format($content['corporate_card_total'] ?? 0) }}
개인선지출{{ number_format($content['personal_advance_total'] ?? 0) }}
@endif - - @if(!empty($content['payment_method'])) -
- 지급방법 -
- @if($content['payment_method'] === 'corporate_card') - 법인카드 사용 - @elseif($content['payment_method'] === 'personal_advance') - 개인 선지출 후 정산 - @else - {{ $content['payment_method'] }} - @endif -
-
- @endif @endif {{-- 공통: 첨부서류 메모 --}}