feat: 백제약품 월간 매출 API 라우트 추가
This commit is contained in:
parent
06c975ce34
commit
4b2d934839
@ -260,3 +260,46 @@ def api_get_balance():
|
|||||||
session = get_baekje_session()
|
session = get_baekje_session()
|
||||||
result = session.get_balance(year if year else None)
|
result = session.get_balance(year if year else None)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
||||||
|
|
||||||
|
@baekje_bp.route('/monthly-sales', methods=['GET'])
|
||||||
|
def api_get_monthly_sales():
|
||||||
|
"""
|
||||||
|
월간 매출(주문) 합계 조회
|
||||||
|
|
||||||
|
GET /api/baekje/monthly-sales?year=2026&month=3
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"total_amount": 7305877, // 월간 매출 합계
|
||||||
|
"total_returns": 0, // 월간 반품 합계
|
||||||
|
"net_amount": 7305877, // 순매출 (매출 - 반품)
|
||||||
|
"total_paid": 0, // 월간 입금 합계
|
||||||
|
"ending_balance": 14563978, // 월말 잔액
|
||||||
|
"prev_balance": 14565453, // 전월이월금
|
||||||
|
"from_date": "2026-03-01",
|
||||||
|
"to_date": "2026-03-31",
|
||||||
|
"rotate_days": 58.4 // 회전일수
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
year = flask_request.args.get('year', '').strip()
|
||||||
|
month = flask_request.args.get('month', '').strip()
|
||||||
|
|
||||||
|
# 기본값: 현재 연월
|
||||||
|
now = datetime.now()
|
||||||
|
if not year:
|
||||||
|
year = now.year
|
||||||
|
else:
|
||||||
|
year = int(year)
|
||||||
|
|
||||||
|
if not month:
|
||||||
|
month = now.month
|
||||||
|
else:
|
||||||
|
month = int(month)
|
||||||
|
|
||||||
|
session = get_baekje_session()
|
||||||
|
result = session.get_monthly_sales(year, month)
|
||||||
|
return jsonify(result)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user