Files
sam-api/app/Http/Requests/TaxInvoice/CreateTaxInvoiceRequest.php
권혁성 c46b950fde feat: 회계 시스템 확장 — 계정과목·전표·세금계산서·카드·바로빌
- 계정과목 확장 및 더존 Smart A 표준 시딩 (전 테넌트)
- 전표 연동 시스템 구현 (JournalSyncService, SyncsExpenseAccounts)
- 세금계산서 매입/매출 필수값 조건 분리 + null 방어
- 카드거래 대시보드 리다이렉트 + 악성채권 집계 수정
- 바로빌 연동 API 엔드포인트 추가
- 복리후생 날짜 필터 + 바로빌 조인 컬럼 수정
- codebridge DB 커넥션 설정 추가
2026-03-10 11:29:39 +09:00

79 lines
3.6 KiB
PHP

<?php
namespace App\Http\Requests\TaxInvoice;
use App\Models\Tenants\TaxInvoice;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CreateTaxInvoiceRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'invoice_type' => ['required', 'string', Rule::in(TaxInvoice::INVOICE_TYPES)],
'issue_type' => ['required', 'string', Rule::in(TaxInvoice::ISSUE_TYPES)],
'direction' => ['required', 'string', Rule::in(TaxInvoice::DIRECTIONS)],
// 공급자 정보 (매입 시 필수, 매출 시 선택)
'supplier_corp_num' => ['required_if:direction,purchases', 'nullable', 'string', 'max:20'],
'supplier_corp_name' => ['required_if:direction,purchases', 'nullable', 'string', 'max:100'],
'supplier_ceo_name' => ['nullable', 'string', 'max:50'],
'supplier_addr' => ['nullable', 'string', 'max:200'],
'supplier_biz_type' => ['nullable', 'string', 'max:100'],
'supplier_biz_class' => ['nullable', 'string', 'max:100'],
'supplier_contact_id' => ['nullable', 'string', 'email', 'max:100'],
// 공급받는자 정보 (매출 시 필수, 매입 시 선택)
'buyer_corp_num' => ['required_if:direction,sales', 'nullable', 'string', 'max:20'],
'buyer_corp_name' => ['required_if:direction,sales', 'nullable', 'string', 'max:100'],
'buyer_ceo_name' => ['nullable', 'string', 'max:50'],
'buyer_addr' => ['nullable', 'string', 'max:200'],
'buyer_biz_type' => ['nullable', 'string', 'max:100'],
'buyer_biz_class' => ['nullable', 'string', 'max:100'],
'buyer_contact_id' => ['nullable', 'string', 'email', 'max:100'],
// 금액 정보
'issue_date' => ['required', 'date'],
'supply_amount' => ['required', 'numeric', 'min:0'],
'tax_amount' => ['required', 'numeric', 'min:0'],
// 품목 정보
'items' => ['nullable', 'array'],
'items.*.name' => ['required_with:items', 'string', 'max:100'],
'items.*.spec' => ['nullable', 'string', 'max:100'],
'items.*.qty' => ['nullable', 'numeric', 'min:0'],
'items.*.unit_price' => ['nullable', 'numeric', 'min:0'],
'items.*.supply_amt' => ['nullable', 'numeric', 'min:0'],
'items.*.tax_amt' => ['nullable', 'numeric', 'min:0'],
'items.*.remark' => ['nullable', 'string', 'max:200'],
// 참조 정보
'reference_type' => ['nullable', 'string', 'max:50'],
'reference_id' => ['nullable', 'integer'],
'description' => ['nullable', 'string', 'max:1000'],
];
}
public function attributes(): array
{
return [
'invoice_type' => __('validation.attributes.invoice_type'),
'issue_type' => __('validation.attributes.issue_type'),
'direction' => __('validation.attributes.direction'),
'supplier_corp_num' => __('validation.attributes.supplier_corp_num'),
'supplier_corp_name' => __('validation.attributes.supplier_corp_name'),
'buyer_corp_num' => __('validation.attributes.buyer_corp_num'),
'buyer_corp_name' => __('validation.attributes.buyer_corp_name'),
'issue_date' => __('validation.attributes.issue_date'),
'supply_amount' => __('validation.attributes.supply_amount'),
'tax_amount' => __('validation.attributes.tax_amount'),
];
}
}