161 lines
10 KiB
Plaintext
161 lines
10 KiB
Plaintext
<!-- #include virtual = "lib/config.asp" -->
|
||
<!-- #include virtual = "include/JSON_2.0.4.asp" -->
|
||
<%
|
||
Response.CharSet="euc-kr"
|
||
Response.AddHeader "Pragma","no-cache"
|
||
Response.AddHeader "cache-control", "no-staff"
|
||
Response.Expires = -1
|
||
|
||
MoneyDate = Request("MoneyDate")
|
||
|
||
query = ""
|
||
'query = query &" select *, CASE WHEN p_subject LIKE '%KRC%' THEN 'KRC' WHEN p_subject LIKE '%KRD%' THEN 'KRD' ELSE 'KRI' END as comp from"&VbCrlf
|
||
query = query &" select *, (select p_project_type_cd from T_PROJECT_BASE where p_sn = left(t.p_sn,7)) as comp from"&VbCrlf
|
||
query = query &" ("&VbCrlf
|
||
query = query &" --³»±ÙÁ÷(ÄÚµù Á¦¿Ü)"&VbCrlf
|
||
query = query &" select '³»±ÙÁ÷' as m_n, TMP.m_name, left(m.M_JUMIN,6) + '-' + right(m.M_JUMIN,7) as M_JUMIN, M.m_mobile, b.b_fullname, isnull(m.m_b_no,'') m_b_no, TMP.p_sn, TPM.p_subject, work_dt, D.d_write_date, s_gubun,"&VbCrlf
|
||
query = query &" s_pay_unit, s_wan, s_sum, convert(varchar(15),insert_dt,23) as insert_dt, p.p_no, p.p_name, isnull(tmp.attribute05, ' ') as attribute05"&VbCrlf
|
||
query = query &" from project2.dbo.t_neakeun_pay TMP WITH(NOLOCK) "&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.neakeun_work NW WITH(NOLOCK) ON TMP.attribute01 = cast(NW.id as varchar)"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.T_PROJECT_METHOD TPM WITH(NOLOCK) ON TMP.p_sn = TPM.p_child_sn"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.person P WITH(NOLOCK) on TMP.insert_user = p.p_no"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.man M WITH(NOLOCK) ON left(tmp.m_jumin,6) = LEFT(m.m_jumin,6) and TMP.m_name = m.m_name"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.bank B WITH(NOLOCK) ON m.M_bank = b.b_code"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.Document D WITH(NOLOCK) ON isnull(TMP.attribute05,'') = D.d_no"&VbCrlf
|
||
query = query &" where D.d_order_cnt = '77' "
|
||
if MoneyDate = "2022-04" Then
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-01' and '"&MoneyDate&"-25' "
|
||
elseif MoneyDate > "2022-04" Then
|
||
'ÃÖ³²½Ä :: 20260310 :: Á¶È¸±âÁØ º¯°æ
|
||
if MoneyDate < "2026-02" Then
|
||
query = query &" and ( D.d_write_date between cast(DATEADD(m,-1,cast('"&MoneyDate&"-26' as date))as varchar) and '"&MoneyDate&"-25' "
|
||
query = query &" or ( '"&MoneyDate&"' = '2023-07' and TMP.attribute05 in ('KRC-2023-t-00507','KRC-2023-t-00506','KRC-2023-t-00505')))"
|
||
elseif MoneyDate > "2026-01" Then
|
||
if MoneyDate = "2026-02" Then
|
||
'26³â 2¿ù: 2/6ÀÏ ~ 3/10ÀÏ(°íÁ¤)
|
||
query = query & " and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar) "
|
||
Else
|
||
'26³â3¿ù ÀÌÈÄ : ÁöÃâ°áÀÇÀÏ ±âÁØ ÇØ´ç¿ù11ÀÏ~´ÙÀ½´Þ10ÀÏ
|
||
query = query & " and D.d_write_date between '"&MoneyDate&"-11' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar) "
|
||
End If
|
||
End If
|
||
'''''''''''''''''''20230807 ¹ÚÁؼº ÇÏÁöÀ± ¼±ÀÓÀÇ Áö°á ´©¶ôÀ¸·Î ÀÎÇÑ ÇϵåÄÚµå·Î ƯÁ¤ ¹®¼ 2023-07¿ù¿¡ ³ª¿Ã¼ö ÀÖµµ·Ï ¼öÁ¤
|
||
'''''''''''''''''''query = query &" and work_dt between cast(DATEADD(m,-1,cast('"&MoneyDate&"-26' as date))as varchar) and '"&MoneyDate&"-25' "
|
||
'query = query &" and ( work_dt between cast(DATEADD(m,-1,cast('"&MoneyDate&"-26' as date))as varchar) and '"&MoneyDate&"-25' "
|
||
'query = query &" or ( '"&MoneyDate&"' = '2023-07' and TMP.attribute05 in ('KRC-2023-t-00507','KRC-2023-t-00506','KRC-2023-t-00505')))"
|
||
'''''''''''''''''''20241205 ÀÌÀçÀº Á¶¹Î¾Æ Ã¥ÀÓÀÇ ³»±ÙÁ÷ ¼ö´ç Áö°á ´©¶ôÀ¸·Î ÀÎÇÑ ÇϵåÄÚµå·Î ƯÁ¤ ¹®¼ ¼ö´ç°ü¸®(n) 2024-11¿ù¿¡ ³ª¿Ã¼ö ÀÖµµ·Ï ¼öÁ¤ but ¹Ý¿µ Ãë¼Ò
|
||
' query = query &" or ( '"&MoneyDate&"' = '2023-07' and TMP.attribute05 in ('KRC-2023-t-00507','KRC-2023-t-00506','KRC-2023-t-00505'))"
|
||
' query = query &" or ( '"&MoneyDate&"' = '2024-11' and TMP.attribute05 in ('KRC-2024-t-01104')))"
|
||
else
|
||
query = query & " and LEFT(D.d_write_date, 7) = '" & MoneyDate & "' "
|
||
end if
|
||
query = query &" AND NW.in_time + NW.out_time + NW.p_sebu_code <> '000000004'"&VbCrlf
|
||
query = query &" "&VbCrlf
|
||
query = query &" union all"&VbCrlf
|
||
query = query &" --³»±ÙÁ÷(ÄÚµù)"&VbCrlf
|
||
query = query &" select '³»±ÙÁ÷' as m_n, TMP.m_name, left(m.M_JUMIN,6) + '-' + right(m.M_JUMIN,7) as M_JUMIN, M.m_mobile, b.b_fullname, isnull(m.m_b_no,'') m_b_no, TMP.p_sn, TPM.p_subject, work_dt, D.d_write_date, s_gubun,"&VbCrlf
|
||
query = query &" s_pay_unit, s_wan, s_sum, convert(varchar(15),insert_dt,23) as insert_dt, p.p_no, p.p_name, isnull(tmp.attribute05, ' ') as attribute05"&VbCrlf
|
||
query = query &" from project2.dbo.t_neakeun_pay TMP WITH(NOLOCK)"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.neakeun_work NW WITH(NOLOCK) ON TMP.attribute01 = cast(NW.id as varchar)"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.T_PROJECT_METHOD TPM WITH(NOLOCK) ON TMP.p_sn = TPM.p_child_sn"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.person P WITH(NOLOCK) on TMP.insert_user = p.p_no"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.man M WITH(NOLOCK) ON left(tmp.m_jumin,6) = LEFT(m.m_jumin,6) and TMP.m_name = m.m_name"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.bank B WITH(NOLOCK) ON m.M_bank = b.b_code"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.Document D WITH(NOLOCK) ON isnull(TMP.attribute05,'') = D.d_no"&VbCrlf
|
||
query = query &" where D.d_order_cnt = '77'"&VbCrlf
|
||
if MoneyDate = "2022-04" Then
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-16' and cast(DATEADD(m,1,cast('"&MoneyDate&"-05' as date)) as varchar)"&VbCrlf
|
||
elseif MoneyDate > "2022-04" Then
|
||
'ÃÖ³²½Ä :: 20260310 :: Á¶È¸±âÁØ º¯°æ
|
||
if MoneyDate < "2026-02" Then
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar)"&VbCrlf
|
||
elseif MoneyDate > "2026-01" Then
|
||
if MoneyDate = "2026-02" Then
|
||
'26³â 2¿ù: 2/6ÀÏ ~ 3/10ÀÏ(°íÁ¤)
|
||
query = query & " and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar) "
|
||
Else
|
||
'26³â3¿ù ÀÌÈÄ : ÁöÃâ°áÀÇÀÏ ±âÁØ ÇØ´ç¿ù11ÀÏ~´ÙÀ½´Þ10ÀÏ
|
||
query = query & " and D.d_write_date between '"&MoneyDate&"-11' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar) "
|
||
End If
|
||
End If
|
||
'query = query &" and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar)"&VbCrlf
|
||
else
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-16' and cast(DATEADD(m,1,cast('"&MoneyDate&"-15' as date)) as varchar)"&VbCrlf
|
||
end if
|
||
query = query &" AND NW.in_time + NW.out_time + NW.p_sebu_code = '000000004'"&VbCrlf
|
||
query = query &" "&VbCrlf
|
||
query = query &" union all"&VbCrlf
|
||
query = query &" --¸éÁ¢¿ø(CATI)"&VbCrlf
|
||
query = query &" select '¸éÁ¢¿ø' as m_n, TMP.m_name, left(m.M_JUMIN,6) + '-' + right(m.M_JUMIN,7) as M_JUMIN, M.m_mobile, b.b_fullname, isnull(m.m_b_no,'') m_b_no, TMP.p_sn, TPM.p_subject, TMP.work_dt, D.d_write_date, s_gubun,"&VbCrlf
|
||
query = query &" s_pay_unit, s_wan + isnull(add_count, 0) as s_wan, s_sum, convert(varchar(15),insert_dt,23) as insert_dt, p.p_no, p.p_name, isnull(tmp.attribute05, ' ') as attribute05"&VbCrlf
|
||
query = query &" from project2.dbo.t_myun_pay TMP WITH(NOLOCK)"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.T_PROJECT_METHOD TPM WITH(NOLOCK) ON TMP.p_sn = TPM.p_child_sn"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.person P WITH(NOLOCK) on TMP.insert_user = p.p_no"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.man M WITH(NOLOCK) ON left(tmp.m_jumin,6) = LEFT(m.m_jumin,6) and TMP.m_name = m.m_name"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.bank B WITH(NOLOCK) ON m.M_bank = b.b_code"&VbCrlf
|
||
query = query &" LEFT OUTER JOIN project2.dbo.Document D WITH(NOLOCK) ON isnull(TMP.attribute05,'') = D.d_no"&VbCrlf
|
||
query = query &" where TMP.confirm_yn = 'Y' and s_sum <> '0' and D.d_order_cnt = '77'"&VbCrlf
|
||
if MoneyDate = "2022-04" Then
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-16' and cast(DATEADD(m,1,cast('"&MoneyDate&"-05' as date)) as varchar)"&VbCrlf
|
||
elseif MoneyDate > "2022-04" Then
|
||
'ÃÖ³²½Ä :: 20260310 :: Á¶È¸±âÁØ º¯°æ
|
||
if MoneyDate < "2026-02" Then
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar)"&VbCrlf
|
||
elseif MoneyDate > "2026-01" Then
|
||
if MoneyDate = "2026-02" Then
|
||
'26³â 2¿ù: 2/6ÀÏ ~ 3/10ÀÏ(°íÁ¤)
|
||
query = query & " and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar) "
|
||
Else
|
||
'26³â3¿ù ÀÌÈÄ : ÁöÃâ°áÀÇÀÏ ±âÁØ ÇØ´ç¿ù11ÀÏ~´ÙÀ½´Þ10ÀÏ
|
||
query = query & " and D.d_write_date between '"&MoneyDate&"-11' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar) "
|
||
End If
|
||
End If
|
||
'query = query &" and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-10' as date)) as varchar)"&VbCrlf
|
||
else
|
||
query = query &" and D.d_write_date between '"&MoneyDate&"-16' and cast(DATEADD(m,1,cast('"&MoneyDate&"-15' as date)) as varchar)"&VbCrlf
|
||
end if
|
||
query = query &" ) T"&VbCrlf
|
||
query = query &" order by p_sn, s_gubun"&VbCrlf
|
||
'Response.Write query
|
||
Rs.Open query, adoConn, 1
|
||
set json = jsObject()
|
||
Redim data(Rs.recordcount-1)
|
||
iCnt = 0
|
||
|
||
if not Rs.eof then
|
||
while not Rs.eof
|
||
set MoneyList = jsObject()
|
||
MoneyList("Company") = Rs("comp")
|
||
MoneyList("P_Sn") = Rs("p_sn")
|
||
MoneyList("P_Subject") = Rs("p_subject")
|
||
MoneyList("P_Name") = Rs("m_name")
|
||
MoneyList("M_Jumin") = Rs("M_JUMIN")
|
||
MoneyList("M_Work") = Rs("s_gubun")
|
||
MoneyList("Danga") = Rs("s_pay_unit")
|
||
MoneyList("Cnt") = Rs("s_wan")
|
||
MoneyList("Allowance") = Rs("s_sum")
|
||
MoneyList("WorkDate") = Rs("work_dt")
|
||
MoneyList("Doc_Date") = Rs("d_write_date")
|
||
MoneyList("M_Phone") = Rs("m_mobile")
|
||
MoneyList("M_Bank") = Rs("b_fullname")
|
||
MoneyList("M_Acount") = CStr(Rs("m_b_no"))
|
||
MoneyList("P_No") = Rs("p_no")
|
||
MoneyList("P_SV") = Rs("p_name")
|
||
MoneyList("ConfirmDate") = Rs("insert_dt")
|
||
MoneyList("D_No") = Rs("attribute05")
|
||
MoneyList("M_Gubun") = Rs("m_n")
|
||
set data(iCnt) = MoneyList
|
||
iCnt = iCnt + 1
|
||
Rs.movenext
|
||
wend
|
||
json("recordsTotal") = Rs.recordcount
|
||
json("recordsFiltered") = Rs.recordcount
|
||
json("data") = data
|
||
Else
|
||
json("data") = ""
|
||
End If
|
||
|
||
Rs.close
|
||
|
||
response.write toJSON(json)
|
||
%> |