- 일일 일보 조회/엑셀 다운로드 API 추가 - 지출 예상 내역서 조회/엑셀 다운로드 API 추가 - ReportService: 전일/당일 잔액 계산, 월별 지출 예상 집계 - Laravel Excel을 이용한 엑셀 내보내기 구현 - Swagger 문서 작성 완료
213 lines
9.4 KiB
PHP
213 lines
9.4 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="Reports", description="보고서 관리")
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DailyReport",
|
|
* type="object",
|
|
* description="일일 일보",
|
|
*
|
|
* @OA\Property(property="date", type="string", format="date", example="2025-01-15", description="기준일"),
|
|
* @OA\Property(property="previous_balance", type="number", format="float", example=10000000, description="전일 잔액"),
|
|
* @OA\Property(property="daily_deposit", type="number", format="float", example=5000000, description="당일 입금액"),
|
|
* @OA\Property(property="daily_withdrawal", type="number", format="float", example=3000000, description="당일 출금액"),
|
|
* @OA\Property(property="current_balance", type="number", format="float", example=12000000, description="당일 잔액"),
|
|
* @OA\Property(property="details", type="array", description="상세 내역",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
*
|
|
* @OA\Property(property="type", type="string", enum={"deposit","withdrawal"}, description="유형"),
|
|
* @OA\Property(property="type_label", type="string", example="입금", description="유형 라벨"),
|
|
* @OA\Property(property="client_name", type="string", example="(주)테스트", description="거래처명"),
|
|
* @OA\Property(property="account_code", type="string", example="401", description="계정과목"),
|
|
* @OA\Property(property="deposit_amount", type="number", format="float", example=1000000, description="입금액"),
|
|
* @OA\Property(property="withdrawal_amount", type="number", format="float", example=0, description="출금액"),
|
|
* @OA\Property(property="description", type="string", example="1월 매출 입금", description="적요"),
|
|
* @OA\Property(property="payment_method", type="string", example="transfer", description="결제수단")
|
|
* )
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="ExpenseEstimate",
|
|
* type="object",
|
|
* description="지출 예상 내역서",
|
|
*
|
|
* @OA\Property(property="year_month", type="string", example="2025-01", description="기준 연월"),
|
|
* @OA\Property(property="total_estimate", type="number", format="float", example=15000000, description="예상 지출 합계"),
|
|
* @OA\Property(property="account_balance", type="number", format="float", example=20000000, description="계좌 잔액"),
|
|
* @OA\Property(property="expected_balance", type="number", format="float", example=5000000, description="예상 잔액"),
|
|
* @OA\Property(property="items", type="array", description="지출 예상 내역",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1, description="매입 ID"),
|
|
* @OA\Property(property="expected_date", type="string", format="date", example="2025-01-20", description="예상 지급일"),
|
|
* @OA\Property(property="item_name", type="string", example="원자재 구매", description="품목"),
|
|
* @OA\Property(property="amount", type="number", format="float", example=5000000, description="지출금액"),
|
|
* @OA\Property(property="client_name", type="string", example="(주)공급사", description="거래처"),
|
|
* @OA\Property(property="account_name", type="string", example="법인통장", description="계좌")
|
|
* )
|
|
* ),
|
|
* @OA\Property(property="monthly_summary", type="object", description="월별 합계",
|
|
* @OA\Property(property="by_month", type="array",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
*
|
|
* @OA\Property(property="month", type="string", example="2025/01", description="월"),
|
|
* @OA\Property(property="total", type="number", format="float", example=5000000, description="합계")
|
|
* )
|
|
* ),
|
|
* @OA\Property(property="total_expense", type="number", format="float", example=15000000, description="지출 합계"),
|
|
* @OA\Property(property="account_balance", type="number", format="float", example=20000000, description="계좌 잔액"),
|
|
* @OA\Property(property="final_difference", type="number", format="float", example=5000000, description="최종 차액")
|
|
* )
|
|
* )
|
|
*/
|
|
class ReportApi
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/reports/daily",
|
|
* tags={"Reports"},
|
|
* summary="일일 일보 조회",
|
|
* description="매일 전일의 입출금 및 매출 매입 현황을 자동 집계합니다.",
|
|
* security={{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="date",
|
|
* in="query",
|
|
* description="기준일 (YYYY-MM-DD, 기본값: 오늘)",
|
|
* required=false,
|
|
*
|
|
* @OA\Schema(type="string", format="date", example="2025-01-15")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="데이터를 조회했습니다."),
|
|
* @OA\Property(property="data", ref="#/components/schemas/DailyReport")
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=422, description="유효성 검사 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function daily() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/reports/daily/export",
|
|
* tags={"Reports"},
|
|
* summary="일일 일보 엑셀 다운로드",
|
|
* description="일일 일보를 엑셀 파일로 다운로드합니다.",
|
|
* security={{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="date",
|
|
* in="query",
|
|
* description="기준일 (YYYY-MM-DD, 기본값: 오늘)",
|
|
* required=false,
|
|
*
|
|
* @OA\Schema(type="string", format="date", example="2025-01-15")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="엑셀 파일",
|
|
*
|
|
* @OA\MediaType(
|
|
* mediaType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
*
|
|
* @OA\Schema(type="string", format="binary")
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=422, description="유효성 검사 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function dailyExport() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/reports/expense-estimate",
|
|
* tags={"Reports"},
|
|
* summary="지출 예상 내역서 조회",
|
|
* description="예상 지출 금액 및 일정을 조회합니다.",
|
|
* security={{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="year_month",
|
|
* in="query",
|
|
* description="기준 연월 (YYYY-MM, 기본값: 이번달)",
|
|
* required=false,
|
|
*
|
|
* @OA\Schema(type="string", example="2025-01")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="데이터를 조회했습니다."),
|
|
* @OA\Property(property="data", ref="#/components/schemas/ExpenseEstimate")
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=422, description="유효성 검사 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function expenseEstimate() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/reports/expense-estimate/export",
|
|
* tags={"Reports"},
|
|
* summary="지출 예상 내역서 엑셀 다운로드",
|
|
* description="지출 예상 내역서를 엑셀 파일로 다운로드합니다.",
|
|
* security={{"BearerAuth": {}}, {"ApiKeyAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="year_month",
|
|
* in="query",
|
|
* description="기준 연월 (YYYY-MM, 기본값: 이번달)",
|
|
* required=false,
|
|
*
|
|
* @OA\Schema(type="string", example="2025-01")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="엑셀 파일",
|
|
*
|
|
* @OA\MediaType(
|
|
* mediaType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
*
|
|
* @OA\Schema(type="string", format="binary")
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=422, description="유효성 검사 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function expenseEstimateExport() {}
|
|
}
|