feat: 도매상 잔고 모달에 월간 매출 추가
- 백제/지오영/수인 월간매출 API 라우트 추가 - 모달 UI: 잔고 + 월간 매출 동시 표시 - 총 주문액 / 총 미수금 요약 표시
This commit is contained in:
@@ -134,6 +134,55 @@ def api_sooin_balance():
|
||||
}), 500
|
||||
|
||||
|
||||
@sooin_bp.route('/monthly-sales', methods=['GET'])
|
||||
def api_sooin_monthly_sales():
|
||||
"""
|
||||
수인약품 월간 매출 조회 API
|
||||
|
||||
GET /api/sooin/monthly-sales?year=2026&month=3
|
||||
|
||||
Returns:
|
||||
{
|
||||
"success": true,
|
||||
"total_amount": 3700239, // 월간 매출 합계
|
||||
"total_paid": 0, // 월간 입금 합계
|
||||
"ending_balance": 14293001, // 월말 잔액
|
||||
"opening_balance": 10592762, // 전일(기초) 잔액
|
||||
"from_date": "2026-03-01",
|
||||
"to_date": "2026-03-31"
|
||||
}
|
||||
"""
|
||||
from datetime import datetime
|
||||
|
||||
year = flask_request.args.get('year', type=int)
|
||||
month = flask_request.args.get('month', type=int)
|
||||
|
||||
# 기본값: 현재 월
|
||||
if not year or not month:
|
||||
now = datetime.now()
|
||||
year = year or now.year
|
||||
month = month or now.month
|
||||
|
||||
try:
|
||||
session = get_sooin_session()
|
||||
if hasattr(session, 'get_monthly_sales'):
|
||||
result = session.get_monthly_sales(year, month)
|
||||
return jsonify(result)
|
||||
else:
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'error': 'NOT_IMPLEMENTED',
|
||||
'message': '수인약품 월간 매출 조회 미구현'
|
||||
}), 501
|
||||
except Exception as e:
|
||||
logger.error(f"수인약품 월간 매출 조회 오류: {e}")
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'error': 'MONTHLY_SALES_ERROR',
|
||||
'message': str(e)
|
||||
}), 500
|
||||
|
||||
|
||||
@sooin_bp.route('/cart', methods=['GET'])
|
||||
def api_sooin_cart():
|
||||
"""장바구니 조회 API"""
|
||||
|
||||
Reference in New Issue
Block a user