Files
KIN/inspection/Ajax_Money.asp
2025-09-29 17:55:08 +09:00

123 lines
8.1 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 &" ("&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, '&nbsp;') 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 work_dt between '"&MoneyDate&"-01' and '"&MoneyDate&"-25' "
elseif MoneyDate > "2022-04" Then
'''''''''''''''''''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(work_dt, 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, '&nbsp;') 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
query = query &" and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-05' 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, '&nbsp;') 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
query = query &" and D.d_write_date between '"&MoneyDate&"-06' and cast(DATEADD(m,1,cast('"&MoneyDate&"-05' 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)
%>