Skip to content

Commit

Permalink
차트 기간 조정
Browse files Browse the repository at this point in the history
  • Loading branch information
dhfmepd committed Jul 14, 2021
1 parent 1ea055c commit 68c2899
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions analysis/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ def get_monthly_list(month):
경비 Monthly 증감 현황 SQL
"""
sql_str = "SELECT M.YEARMONTH, IFNULL(ROUND(DT.APV_SUM_AMT / 10000, 0), 0) AS APV_SUM_AMT FROM ( "
sql_str += " SELECT DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -4 MONTH, '%Y%m') AS YEARMONTH "
sql_str += " UNION "
sql_str += " SELECT DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -3 MONTH, '%Y%m') AS YEARMONTH "
sql_str += " UNION "
sql_str += " SELECT DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -2 MONTH, '%Y%m') AS YEARMONTH "
sql_str += " UNION "
sql_str += " SELECT DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -1 MONTH, '%Y%m') AS YEARMONTH "
Expand All @@ -254,13 +258,13 @@ def get_monthly_list(month):
sql_str += " SELECT SUBSTR(APV_DD, 1, 6) AS YEARMONTH, APV_SUM_AMT AS APV_SUM_AMT "
sql_str += " FROM EX_CORPCARD_ASK "
sql_str += " WHERE COM_CD = '1000' AND SEND_DIV = '01' "
sql_str += " AND APV_DD BETWEEN DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -2 MONTH, '%Y%m01') "
sql_str += " AND APV_DD BETWEEN DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -4 MONTH, '%Y%m01') "
sql_str += " AND DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL +1 MONTH + INTERVAL -1 DAY, '%Y%m%d') "
sql_str += " UNION ALL "
sql_str += " SELECT SUBSTR(OCCR_YMD, 1, 6) AS YEARMONTH, ECAL_AMT AS APV_SUM_AMT "
sql_str += " FROM EX_EXPN_ETC "
sql_str += " WHERE COM_CD = '1000' AND SLIP_NO IS NULL AND OCCR_ACC_CD LIKE '5%' "
sql_str += " AND OCCR_YMD BETWEEN DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -2 MONTH, '%Y%m01') "
sql_str += " AND OCCR_YMD BETWEEN DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL -4 MONTH, '%Y%m01') "
sql_str += " AND DATE_FORMAT(CONCAT('" + month + "', '01') + INTERVAL +1 MONTH + INTERVAL -1 DAY, '%Y%m%d') "
sql_str += " ) A "
sql_str += " GROUP BY A.YEARMONTH "
Expand Down

0 comments on commit 68c2899

Please sign in to comment.