304 lines
13 KiB
Plaintext
304 lines
13 KiB
Plaintext
<!-- #include virtual = "lib/config.asp" -->
|
|
<!-- #include virtual = "include/holiday_count.asp" -->
|
|
<%
|
|
set dbin = server.CreateObject("ADODB.CONNECTION")
|
|
set rsp = server.CreateObject("ADODB.RECORDSET")
|
|
set rsa = server.CreateObject("ADODB.RECORDSET")
|
|
|
|
|
|
dbin.Open adoConn
|
|
|
|
for i=1 to request("cnt")
|
|
d_order_cnt = request("d_order_cnt")(i)
|
|
if d_order_cnt = "결재 반려" OR d_order_cnt = "" OR isnull(d_order_cnt) then
|
|
id = request("id")(i)
|
|
confirm_flag = request("work_confirm_"&i)
|
|
query = " select * from neakeun_work with(nolock) "
|
|
query = query & " where id = '" & id & "' "
|
|
|
|
rsc.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
if rsc.RecordCount > 0 then
|
|
query = " update neakeun_work"
|
|
query = query & " set job_confirm_yn = '"&request("work_confirm_"&i)&"' "
|
|
query = query & " , job_add_time = '"&request("job_add_time")(i)&"' "
|
|
query = query & " , job_add_time_memo = '"&request("job_add_time_memo")(i)&"' "
|
|
query = query & " where neakeun_jumin = '" & rsc("neakeun_jumin") & "' and neakeun_name = '" & rsc("neakeun_name") & "' "
|
|
query = query & " and p_child_sn = '" & rsc("p_child_sn") & "' and date = '" & rsc("date") & "' and p_sebu = '" & rsc("p_sebu") & "' "
|
|
|
|
dbin.Execute query
|
|
end if
|
|
rsc.close
|
|
|
|
If confirm_flag = "Y" Then
|
|
'2014-12-18 정강욱 : 건당 컨펌이 이루어 질 경우 해당 컨펌된 데이터는 수당 내역 테이블에 입력 된다.
|
|
'입력을 하기 위하여 해당 컨펌데이터 내역을 ID를 통하여 조회한다.
|
|
query = " SELECT * "
|
|
query = query & " FROM neakeun_work with(nolock) "
|
|
query = query & " WHERE id = '" & id & "' "
|
|
|
|
rsp.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
If rsp.recordcount > 0 Then
|
|
Dim in_time
|
|
Dim out_time
|
|
Dim add_time
|
|
Dim yoil
|
|
Dim holiday
|
|
Dim lunch
|
|
Dim dinner
|
|
Dim grade_cost
|
|
Dim pay
|
|
Dim lunch_cost
|
|
Dim dinner_cost
|
|
|
|
in_time = Cdbl(rsp("job_in_time"))
|
|
out_time = Cdbl(rsp("job_out_time"))
|
|
|
|
If isnull(rsp("job_add_time")) or Trim(rsp("job_add_time")) = "" Then
|
|
add_time = 0
|
|
Else
|
|
add_time = Cdbl(rsp("job_add_time"))
|
|
End if
|
|
|
|
yoil = rsp("yoil")
|
|
|
|
pay = 0
|
|
lunch_cost = 0
|
|
dinner_cost = 0
|
|
|
|
query = " select id, m_jumin, m_name, m_grade "
|
|
query = query & " ,(select top 1 cost from t_neakeun_pay_COST WITH(nolock) where grade = T.m_grade and type = 'cost' and use_start_dt <= '" & rsp("date") & "' order by use_start_dt desc) as m_grade_cost "
|
|
query = query & " from ( "
|
|
query = query & " select id, m_jumin, m_name "
|
|
query = query & " ,(select top 1 m_grade from T_MYUN_GRADE_HISTORY WITH(nolock) where m_id = m.id and (attribute02 = '" & rsp("p_sebu_code") & "' OR attribute02 IS NULL) and m_grade_dt <= '" & rsp("date") & "' order by m_grade_dt desc, insert_dt desc) as m_grade "
|
|
query = query & " from man as m "
|
|
query = query & " ) as T "
|
|
query = query & " where T.m_name = '" & rsp("neakeun_name") & "' and left(T.m_jumin, 6) = '" & Left(rsp("neakeun_jumin"), 6) & "' "
|
|
'response.write query
|
|
rsa.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
If rsa.recordcount > 0 Then
|
|
If rsa("m_grade_cost") = "" Or IsNull(rsa("m_grade_cost")) = True Then
|
|
grade_cost = 0
|
|
End If
|
|
|
|
'grade_cost = rsa("m_grade_cost")
|
|
grade_cost = request("lunch_cost_"&i)
|
|
|
|
Dim currentMonth
|
|
currentMonth = Left(Replace(rsp("date"), "-", ""), 6)
|
|
|
|
'in_time 은 하루의 총 근무 시간 이다 (즉 시간내, 외를 다 합한 하루의 총 근무 시간)
|
|
'If holiday = True Or yoil = "토요일" Or yoil = "일요일" Then
|
|
' pay = ((in_time + add_time) * (grade_cost + 1000))
|
|
'Else
|
|
pay = ((in_time + add_time) * grade_cost) + (out_time * 1000)
|
|
'End If
|
|
Else
|
|
grade_cost = 0
|
|
pay = 0
|
|
End If
|
|
|
|
rsa.close
|
|
|
|
'내근직페이가 이미 입력되어 있으면 삭제 하고 다시 입력~!
|
|
query = " delete t_neakeun_pay "
|
|
query = query & " where attribute01 = '" & rsp("id") & "'"
|
|
|
|
dbin.Execute query
|
|
|
|
query = " insert into 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) "
|
|
query = query & " values ("
|
|
query = query & "'" & rsp("p_child_sn") & "', " 'p_sn
|
|
query = query & "'" & rsp("neakeun_name") & "', " 'm_name
|
|
query = query & "'" & rsp("neakeun_jumin") & "', " 'm_jumin
|
|
query = query & "'" & rsp("date") & "', " 'work_dt
|
|
query = query & "'" & 0 & "', " 's_ot
|
|
query = query & "'" & rsp("p_sebu") & "', " 's_gubun 구분
|
|
query = query & "'" & grade_cost & "', " 's_pay_unit 단가
|
|
query = query & "'" & (in_time + (add_time)) & "', "'s_wan 시간
|
|
query = query & "'" & CDbl(Formatnumber(pay, 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 & "'" & rsp("id") & "') " 'attribute01 neakeun_work의 ID
|
|
|
|
dbin.Execute query
|
|
|
|
lunch = rsp("job_lunch_yn")
|
|
dinner = rsp("job_dinner_yn")
|
|
Dim lunch_alr
|
|
Dim dinner_alr
|
|
Dim lunch_dinner_rate
|
|
lunch_dinner_rate = 1
|
|
|
|
If lunch = "1" Or dinner = "1" Then
|
|
query = " select COUNT(p_child_sn) as p_sn_cnt, sum(job_in_time) as job_in_time "
|
|
query = query & " from neakeun_work WITH(nolock) "
|
|
query = query & " where date = '" & rsp("date") & "' "
|
|
query = query & " and neakeun_name = '" & rsp("neakeun_name") & "' "
|
|
query = query & " and left(neakeun_jumin, 6) = '" & Left(rsp("neakeun_jumin"), 6) & "' "
|
|
query = query & " and in_time + out_time <> '00000000' "
|
|
rsa.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
If rsa.recordcount > 0 Then
|
|
If rsa("p_sn_cnt") > 1 Then
|
|
lunch_dinner_rate = Formatnumber( (1 / rsa("job_in_time") * rsp("job_in_time")) , 5 )
|
|
End if
|
|
End if
|
|
rsa.close
|
|
End if
|
|
|
|
If lunch = "1" Then
|
|
'식대 비용 조회~!
|
|
query = " select top 1 cost from t_neakeun_pay_COST WITH(nolock) where type = 'lunch' and use_start_dt <= '" & rsp("date") & "' order by use_start_dt desc "
|
|
rsa.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
If rsa.recordcount > 0 Then
|
|
'lunch_cost = rsa("cost")
|
|
lunch_cost = request("lunch_cost_"&i)
|
|
'위에 쿼리 없어지고, lunch_cost = grade_cost 가 되어야함
|
|
End if
|
|
rsa.close
|
|
|
|
query = " delete t_neakeun_pay "
|
|
query = query & " where attribute01 = '" & rsp("id") & "' and s_gubun = '추가수당1' "
|
|
|
|
dbin.Execute query
|
|
|
|
'해당 업무일지 일자에 이미 식대가 포함되어 있는지 체크
|
|
query = " select isnull(sum(s_sum), 0) as m_lunch_cost from t_neakeun_pay WITH(nolock) "
|
|
query = query & " where m_name = '" & rsp("neakeun_name") & "' "
|
|
query = query & " and left(m_jumin, 6) = '" & Left(rsp("neakeun_jumin"), 6) & "' "
|
|
query = query & " and work_dt = '" & rsp("date") & "' "
|
|
query = query & " and s_gubun = '추가수당1' "
|
|
|
|
lunch_alr = true
|
|
rsa.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
if cstr(rsa("m_lunch_cost")) = cstr(lunch_cost) then
|
|
lunch_alr = false
|
|
end if
|
|
|
|
If lunch_alr = true Then
|
|
query = " insert into 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) "
|
|
query = query & " values ("
|
|
query = query & "'" & rsp("p_child_sn") & "', " 'p_sn
|
|
query = query & "'" & rsp("neakeun_name") & "', " 'm_name
|
|
query = query & "'" & rsp("neakeun_jumin") & "', " 'm_jumin
|
|
query = query & "'" & rsp("date") & "', " 'work_dt
|
|
query = query & "'" & 0 & "', " 's_ot
|
|
query = query & "'추가수당1', " 's_gubun 구분
|
|
query = query & "'" & lunch_cost & "', " 's_pay_unit 단가
|
|
query = query & "'" & lunch_dinner_rate & "', " 's_wan 시간
|
|
'query = query & "'" & round(CDbl(Formatnumber(lunch_cost * lunch_dinner_rate, 1)), 2) & "', " 's_sum 합계
|
|
query = query & "'" & CDbl(Formatnumber(lunch_cost * lunch_dinner_rate, 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 & "'" & rsp("id") & "') " 'attribute01 neakeun_work의 ID
|
|
|
|
'Response.Write query & "<BR>"
|
|
dbin.Execute query
|
|
|
|
End if
|
|
rsa.close
|
|
Else
|
|
query = " delete t_neakeun_pay "
|
|
query = query & " where attribute01 = '" & rsp("id") & "' and s_gubun = '추가수당1' "
|
|
|
|
dbin.Execute query
|
|
End If
|
|
|
|
If dinner = "1" Then
|
|
'식대 비용 조회~!
|
|
query = " select top 1 cost from t_neakeun_pay_COST WITH(nolock) where type = 'dinner' and use_start_dt <= '" & rsp("date") & "' order by use_start_dt desc "
|
|
rsa.open query, adoConn, adopenstatic, adlockreadonly
|
|
|
|
If rsa.recordcount > 0 Then
|
|
dinner_cost = rsa("cost")
|
|
End if
|
|
rsa.close
|
|
|
|
query = " delete t_neakeun_pay "
|
|
query = query & " where attribute01 = '" & rsp("id") & "' and s_gubun = '추가수당2' "
|
|
|
|
dbin.Execute query
|
|
|
|
'해당 업무일지 일자에 이미 식대가 포함되어 있는지 체크
|
|
query = " select isnull(sum(s_sum), 0) as t_dinner_cost from t_neakeun_pay WITH(nolock) "
|
|
query = query & " where m_name = '" & rsp("neakeun_name") & "' "
|
|
query = query & " and left(m_jumin, 6) = '" & Left(rsp("neakeun_jumin"), 6) & "' "
|
|
query = query & " and work_dt = '" & rsp("date") & "' "
|
|
query = query & " and s_gubun = '추가수당2' "
|
|
|
|
rsa.open query, adoConn, adopenstatic, adlockreadonly
|
|
dinner_alr = true
|
|
|
|
if rsa("t_dinner_cost") = dinner_cost then
|
|
dinner_alr = false
|
|
end if
|
|
|
|
If dinner_alr = true Then
|
|
query = " insert into 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) "
|
|
query = query & " values ("
|
|
query = query & "'" & rsp("p_child_sn") & "', " 'p_sn
|
|
query = query & "'" & rsp("neakeun_name") & "', " 'm_name
|
|
query = query & "'" & rsp("neakeun_jumin") & "', " 'm_jumin
|
|
query = query & "'" & rsp("date") & "', " 'work_dt
|
|
query = query & "'" & 0 & "', " 's_ot
|
|
query = query & "'추가수당2', " 's_gubun 구분
|
|
query = query & "'" & dinner_cost & "', " 's_pay_unit 단가
|
|
query = query & "'" & lunch_dinner_rate & "', " 's_wan 시간
|
|
query = query & "'" & CDbl(Formatnumber(dinner_cost * lunch_dinner_rate, 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 & "'" & rsp("id") & "') " 'attribute01 neakeun_work의 ID
|
|
|
|
'Response.Write query & "<BR>"
|
|
dbin.Execute query
|
|
End if
|
|
rsa.close
|
|
Else
|
|
query = " delete t_neakeun_pay "
|
|
query = query & " where attribute01 = '" & rsp("id") & "' and s_gubun = '추가수당2' "
|
|
|
|
dbin.Execute query
|
|
End If
|
|
|
|
End if
|
|
rsp.close
|
|
Else
|
|
query = " delete t_neakeun_pay "
|
|
query = query & " where attribute01 = '" & id & "'"
|
|
|
|
dbin.Execute query
|
|
End if
|
|
END if
|
|
next
|
|
|
|
dbin.Close
|
|
%>
|
|
<html>
|
|
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
|
|
<script>
|
|
function goit() {
|
|
alert('저장되었습니다');
|
|
document.pms.action = 'neakeun_work_confirm.asp?command=<%=request("command") %>&p_field_date_month=<%=request("p_field_date_month") %>&p_field_date_week=<%=request("p_field_date_week")%>';
|
|
document.pms.submit();
|
|
}
|
|
</script>
|
|
<body onLoad="goit()">
|
|
<form name="pms" method="post">
|
|
</form>
|
|
</body>
|
|
</html>
|