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

173 lines
7.0 KiB
Plaintext

<!-- #include virtual = "lib/config.asp" -->
<!-- #include virtual = "include/JSON_2.0.4.asp" -->
<%
Response.CharSet = "EUC-KR"
dim gubun : gubun = Request("gubun")
dim prj_code : prj_code = Request("prj_code")
dim n_name : n_name = replace(unescape(Request("n_name"))," ","")
dim n_birth : n_birth = Request("n_birth")
dim e_gubun : e_gubun = unescape(Request("n_gubun"))
dim n_date : n_date = Request("n_date")
dim n_cnt : n_cnt = Request("n_cnt") '시간(부수)
dim p_danga : p_danga = Request("p_danga") '단가
dim add1 : add1 = Request("n_add1")
dim add2 : add2 = Request("n_add2")
dim p_sum : p_sum = Request("p_sum")
dim p_etc : p_etc = unescape(Request("p_etc"))
dim err_chk : err_chk = Request("err_chk")
dim no_chk : no_chk = Request("no_chk")
dim n_gubun, n_gubun_cd
dim insert_ok, select_ok1, select_ok2, select_ok
Dim id, pay_id
Dim json_obj
dim etc_ok
n_birth = Cstr(n_birth)
set json_obj = jsObject()
Select case gubun
case "p"
n_gubun = "펀치"
case "v1"
n_gubun = "검증"
case "v2"
n_gubun = "감청"
case "e"
n_gubun = e_gubun
etc_ok = "ETC"
End Select
query = " select d_cost_code from project2.dbo.direct_costcode where d_cost_kind='field' and d_cost_name = '" & n_gubun & "' and d_cost_useyn = 'Y' "
Rs.open query, adoconn, adopenstatic, adlockreadonly
if not rs.eof then
n_gubun_cd = Rs("d_cost_code")
end if
Rs.close
query = "select * from project2.dbo.neakeun_work where p_child_sn = '" & prj_code & "' and neakeun_name = '" & n_name & "' and neakeun_jumin = '" & n_birth & "0000000' and date = '" & n_date & "' and p_sebu = '" & n_gubun & "' "
If etc_ok = "ETC" Then
query = query&"and workload = '" & etc_ok & "' "
Else
query = query&"and ISNULL(workload, '') = '' "
End IF
Rs.open query, adoconn, adopenstatic, adlockreadonly
if not Rs.eof Then
select_ok1 = 1
id = Rs("id")
Else
select_ok1 = 0
End If
Rs.close
query = "select * from project2.dbo.t_neakeun_pay where p_sn = '" & prj_code & "' and m_name = '" & n_name & "' and m_jumin = '" & n_birth & "0000000' and work_dt = '" & n_date & "' and s_gubun = '" & n_gubun & "' "
If etc_ok = "ETC" Then
query = query&"and attribute02 = '" & etc_ok & "' "
Else
query = query&"and ISNULL(attribute02, '') = '' "
End IF
Rs.open query, adoconn, adopenstatic, adlockreadonly
if not Rs.eof Then
pay_id = Rs("id")
select_ok2 = 2
Else
select_ok2 = 0
End If
Rs.close
select_ok = select_ok1 + select_ok2
on error resume next
If select_ok = 2 or select_ok = 0 Then
query = "Set NoCount On "
query = query&" Insert into project2.dbo.neakeun_work "
query = query&" (neakeun_jumin, neakeun_name, p_sn, p_sebu, date, yoil, in_time, out_time, job_in_time, job_out_time, job_jumal_time, "
query = query&" insert_date, insert_time, insert_ip, p_sv_no, p_sv_main, p_child_sn, job_start_time, job_end_time, job_total_time, job_lunch_yn, "
query = query&" job_dinner_yn, job_confirm_yn, p_sebu_code, job_add_time, job_add_time_memo, workload, extra_pay1, extra_pay2 "
query = query&" ) values ("
query = query&"'" & n_birth & "0000000', "'neakeun_jumin
query = query&"'" & n_name & "', "'neakeun_name
query = query&"'" & left(prj_code,7) & "', "'p_sn
query = query&"'" & n_gubun & "', "'p_sebu
query = query&"'" & n_date & "', "'date
query = query&"DATENAME(DW,'" & n_date & "'), "'yoil
query = query&"'0000', "'in_time
query = query&"'0000', "'out-time
query = query&"'0', "'job_in_time
query = query&"'0', "'job_out_time
query = query&"'0', "'job_jumal_time
query = query&"CONVERT(CHAR(10), GETDATE(), 23), "'insert_date
query = query&"CONVERT(CHAR(5), GETDATE(), 8), "'insert_time
query = query&"'" & Request.ServerVariables("remote_host") & "', "'insert_ip
query = query&"'" & Session("User_Number") & "', "'p_sv_no
query = query&"'" & Session("User_Number") & "', "'p_sv_main
query = query&"'" & prj_code & "', "'p_child_sn
query = query&"'1000', "'job_start_time
query = query&"'2400', "'job_end_time
query = query&"'0', "'job_total_time
query = query&"'', "
query = query&"'', "
query = query&"'Y', "'job_Confirm_yn
query = query&"'" & n_gubun_cd & "', "'job_sebu_code
query = query&"'', "'job_add_time
query = query&"'" & p_etc & "', "'job_add_time_memo
query = query&"'" & etc_ok & "', "'기타 수당
query = query&"'" & add1 & "', "'기타 수당
query = query&"'" & add2 & "' "'기타 수당
query = query&" ) "
query = query&" select @@IDENTITY as ID "
query = query&" Set NoCount off "
Rs.Open query, adoConn, adOpenForwardOnly, adLockReadOnly, adCmdText
If Not(Rs.Eof Or Rs.Bof) Then
id = Rs(0)
End If
Rs.Close
End If
If select_ok <> 2 Then
query = "Set NoCount On "
query = query & " insert into project2.dbo.t_neakeun_pay (p_sn, m_name, m_jumin, work_dt, s_ot, s_gubun, s_pay_unit, s_wan, s_sum, s_time_style, pay_type, pay_month, insert_dt, insert_user, attribute01, attribute02, chk1, chk2) "
query = query & " values ("
query = query & "'" & prj_code & "', " 'p_sn
query = query & "'" & n_name & "', " 'm_name
query = query & "'" & n_birth & "0000000', " 'm_jumin
query = query & "'" & n_date & "', " 'work_dt
query = query & "'" & 0 & "', " 's_ot
query = query & "'" & n_gubun & "', " 's_gubun 구분
query = query & "'" & p_danga & "', "'s_pay_unit 단가
query = query & "'" & n_cnt & "', " 's_wan 부수
query = query & "'" & CDbl(Formatnumber(p_sum, 0)) & "', "'s_sum 합계
query = query & "'" & "" & "', " 's_time_style
query = query & "'1', " 'pay_type 1 : 내근직, 2 : 면접원
query = query & "'" & "" & "', " 'pay_month
query = query & "getdate(), " 'insert_dt
query = query & "'" & Session("User_Number") & "', "'insert_user
query = query & "'" & id & "', " 'attribute01 neakeun_work의 ID
query = query & "'" & etc_ok & "', "'기타 수당
query = query & "'" & err_chk & "', "'기타 수당
query = query & "'" & no_chk & "') "'기타 수당
query = query &" select @@IDENTITY as ID "
query = query &" Set NoCount off "
Rs.Open query, adoConn, adOpenForwardOnly, adLockReadOnly, adCmdText
If Not(Rs.Eof Or Rs.Bof) Then
pay_id = Rs(0)
End If
Rs.Close
End If
if Err.Number <> 0 then
insert_ok = 0 'insert 실패
json_obj("err") = Err.description
else
insert_ok = 1 'insert 성공
end if
on error goto 0
json_obj("ok") = insert_ok
json_obj("id") = id
json_obj("pay_id") = pay_id
Response.Write toJSON(json_obj)
%>