254 lines
11 KiB
Plaintext
254 lines
11 KiB
Plaintext
<!-- #include virtual = "lib/config.asp" -->
|
|
<%
|
|
set rsp = server.CreateObject("ADODB.RECORDSET")
|
|
|
|
'프로젝트 컨택후 수정 후 실제 등록
|
|
|
|
p_sn = request("p_sn") '프로젝트 코드
|
|
p_subject = request("p_subject") '프로젝트명
|
|
p_sub_type = request("p_sub_type") '신규프로젝트 타입
|
|
p_child_sn = request("p_child_sn") '자식 프로젝트 번호
|
|
p_intention = request("p_intention") '조사내용
|
|
p_cli_company_cd = request("p_cli_company_cd") '클라이언트 회사코드
|
|
p_cli_company_nm = request("p_cli_company_nm") '클라이언트 회사명
|
|
p_cli_per_cd = request("p_cli_per_cd") '클라이언트 회사 담당자 코드
|
|
p_cli_depart = request("p_cli_depart") '클라이언트 회사 부서 코드
|
|
p_cli_per_nm = request("p_cli_per_nm") '클라이언트 회사 담당자 이름
|
|
p_cli_per_tel = request("p_cli_per_tel") '클라이언트 회사 담당자 전화번호
|
|
p_cli_per_email = request("p_cli_per_email") '클라이언트 회사 담당자 이메일
|
|
p_client_type_cd = request("p_client_type_cd") '조사 업종
|
|
p_cont_cost = replace(request("p_cont_cost"),",", "") '예상 계약액
|
|
p_decide_date = request("p_decide_date") '결정예정일
|
|
p_memo = request("p_memo") '비고
|
|
|
|
p_method_cd = Split(request("p_method_cd"), ",") '조사 방법
|
|
|
|
current_p_sub_type = request("current_p_sub_type") '신규프로젝트 타입
|
|
current_p_method_cd = Trim(Replace(request("current_p_method_cd"), ",", "")) '신규 조사 방법
|
|
add_p_cont_cost = Trim(Replace(request("add_p_cont_cost"), ",", "")) '추가 계약액
|
|
|
|
If CInt(current_p_method_cd) < 10 Then
|
|
tmp_method_cd = "0" & current_p_method_cd
|
|
Else
|
|
tmp_method_cd = current_p_method_cd
|
|
End If
|
|
|
|
If UBound(p_method_cd) > 0 Then
|
|
If UBound(p_method_cd) = 1 Then
|
|
'response.write "p_method_cd : " & p_method_cd(0) & "<br>"
|
|
Else
|
|
For i = 0 To UBound(p_method_cd) Step 1
|
|
'response.write "p_method_cd : " & p_method_cd(i) & "<br>"
|
|
next
|
|
End If
|
|
Else
|
|
'response.write "p_method_cd : " & p_method_cd(0) & "<br>"
|
|
End If
|
|
|
|
'p_method_cd 이걸 M일 경우 split ","로 쪼개서 ubound로 카운팅한다.
|
|
'response.write "UBound(p_method_cd) + 2 : " & UBound(p_method_cd) + 2 & "<br>"
|
|
tmp_method_count = UBound(p_method_cd) + 2
|
|
If tmp_method_count < 10 Then
|
|
tmp_method_count = "0" & tmp_method_count
|
|
End If
|
|
|
|
'response.write "p_sn : " & p_sn & "<br>"
|
|
'response.write "p_subject : " & p_subject & "<br>"
|
|
'response.write "p_sub_type : " & p_sub_type & "<br>"
|
|
'response.write "p_child_sn : " & p_child_sn & "<br>"
|
|
|
|
'response.write "p_intention : " & p_intention & "<br>"
|
|
|
|
'response.write "current_p_sub_type : " & current_p_sub_type & "<br>"
|
|
'response.write "current_p_method_cd : " & current_p_method_cd & "<br>"
|
|
'response.write "add_p_cont_cost : " & add_p_cont_cost & "<br>"
|
|
'response.write "current_p_child_sn : " & p_sn & "_" & current_p_sub_type & tmp_method_cd & tmp_method_count & "<br>"
|
|
'current_p_child_sn = p_sn & "_" & current_p_sub_type & tmp_method_cd & tmp_method_count
|
|
current_p_child_sn = p_sn & "_" & current_p_sub_type & tmp_method_count
|
|
'response.write "current_p_child_sn : " & current_p_child_sn & "<br>"
|
|
'response.write "p_cli_company_cd : " & p_cli_company_cd & "<br>"
|
|
'response.write "p_cli_company_nm : " & p_cli_company_nm & "<br>"
|
|
'response.write "p_cli_per_cd : " & p_cli_per_cd & "<br>"
|
|
'response.write "p_cli_depart : " & p_cli_depart & "<br>"
|
|
'response.write "p_cli_per_nm : " & p_cli_per_nm & "<br>"
|
|
'response.write "p_cli_per_tel : " & p_cli_per_tel & "<br>"
|
|
'response.write "p_cli_per_email : " & p_cli_per_email & "<br>"
|
|
'response.write "p_client_type_cd : " & p_client_type_cd & "<br>"
|
|
'response.write "p_cont_cost : " & p_cont_cost & "<br>"
|
|
'response.write "p_decide_date : " & p_decide_date & "<br>"
|
|
'response.write "p_memo : " & p_memo & "<br>"
|
|
|
|
|
|
''' 1 : 기존 프로젝트가 C인 경우 M으로 변경하면서 조사를 추가 할 것이냐? 그냥 C를 추가 할 것이냐?
|
|
''' 계약금액 변경이 있으면 M일경우 계약금액에 추가로 더하고, 수행계획서 결재 다시 받아야 함, C일 경우 추가계약금으로 프로젝트를 추가
|
|
|
|
''' 2 : 기존 프로젝트가 M인 경우 조사를 추가 할 것이냐? 그냥 C를 추가 할 것이냐?
|
|
''' 계약금액 변경이 있으면 M일경우 계약금액에 추가로 더하고, 수행계획서 결재 다시 받아야 함, C일 경우 추가계약금으로 프로젝트를 추가
|
|
|
|
set dbin = server.CreateObject("ADODB.CONNECTION")
|
|
|
|
'수행계획서 코드 생성에 부족분을 추가
|
|
query = "select top 1 * from T_Project_method where p_sn='"&p_sn&"' order by p_child_sn desc"
|
|
rsp.Open query, adoConn, 1
|
|
|
|
if not rsp.eof then
|
|
if current_p_child_sn = rsp("p_child_sn") Then
|
|
child_count = Cint(mid(rsp("p_child_sn"),10,11))+1
|
|
current_p_child_sn = p_sn & "_" & current_p_sub_type & child_count
|
|
End If
|
|
End IF
|
|
rsp.Close
|
|
|
|
|
|
'신규 T_Project_BASE의 P_Method_Cd 체크 후, 추가된 조사방법 코드가 없으면 추가'
|
|
|
|
query = " select isnull(p_methodCd, '') as p_methodCd from project2.dbo.T_PROJECT_BASE where p_sn='"&p_sn&"' "
|
|
rsp.Open query, adoConn, 1
|
|
method_cd = False
|
|
if not rsp.eof then
|
|
Base_p_method_Cd = split(rsp("p_methodCd"),",")
|
|
For iCnt = LBOUND(Base_p_method_Cd) to UBOUND(Base_p_method_Cd)
|
|
If Cstr(Base_p_method_Cd(iCnt)) = Cstr(current_p_method_cd) Then
|
|
method_cd = True
|
|
End IF
|
|
NEXT
|
|
End IF
|
|
rsp.Close
|
|
|
|
If method_cd = False then
|
|
query=" Update project2.dbo.T_PROJECT_BASE set p_methodCd=p_methodCd+','+'"¤t_p_method_cd&"' where p_sn='"&p_sn&"' "
|
|
dbin.Open adoConn
|
|
dbin.Execute query
|
|
dbin.Close
|
|
End IF
|
|
|
|
sql_from = "INSERT INTO "
|
|
sql_from = sql_from & " T_PROJECT_METHOD "
|
|
sql_from = sql_from & "(p_sn, p_sub_type, p_method_cd, p_subject, p_intention, p_child_sn, p_progress_status, p_cli_company_cd, p_client_type_cd, p_input_dt, p_input_complete, p_progress_flag, "
|
|
sql_from = sql_from & " p_rsch_1_a, p_rsch_2_a, p_rsch_3_a, p_rsch_4_a, p_rsch_1_b, p_rsch_2_b, p_rsch_3_b, p_rsch_4_b, p_rsch_1_c, p_rsch_2_c, p_rsch_3_c, p_rsch_4_c, "
|
|
sql_from = sql_from & " p_sv_1, p_sv_2, p_sv_3, p_sv_4, p_code_1, p_code_2, p_code_3, p_code_4, p_verify_1, p_verify_2, p_verify_3, p_verify_4, p_punch_1, p_punch_2, p_punch_3, p_punch_4, "
|
|
sql_from = sql_from & " p_dp_1, p_dp_2, p_dp_3, p_dp_4, p_it_1, p_it_2, p_it_3, p_it_4 "
|
|
|
|
sql_values = " ) VALUES ( "
|
|
|
|
sql_insertValue = "'" & p_sn & "', '" & current_p_sub_type & "', '" & current_p_method_cd & "', '" & p_subject & "', '" & p_intention & "', '" & current_p_child_sn & "', '" & "001" & "', '" & p_cli_company_cd & "', '" & p_client_type_cd & " ', GETDATE(), 'xxx', 'xxx', "
|
|
sql_insertValue = sql_insertValue & " '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','' "
|
|
sql_end = " ) "
|
|
|
|
project_M_type_exist = False
|
|
project_workflow = false
|
|
|
|
If p_sub_type = "M" Then
|
|
'''모프로젝트가 M인 경우
|
|
If current_p_sub_type = "M" Then '''조사를 M으로 추가 할 경우
|
|
If add_p_cont_cost <> "0" Or add_p_cont_cost <> "" Then
|
|
'''T_PROJECT_BASE의 p_cont_cost에 add_p_cont_cost를 합산한다. (한개의 p_sn에 M프로젝트는 한개 이므로 T_PROJECT_BASE 테이블에 업데이트 한다.
|
|
query = "update T_PROJECT_BASE set p_cont_cost = '" & (CLng(p_cont_cost) + CLng(add_p_cont_cost)) & "' where p_sn = '" & p_sn & "' "
|
|
|
|
dbin.Open adoConn
|
|
dbin.Execute query
|
|
dbin.Close
|
|
End If
|
|
|
|
query = "select COUNT(p_sub_type) as p_sub_type_cnt, p_progress_status from V_PROJECT_METHOD where p_sn = '" & p_sn & "' and p_sub_type = 'M' group by p_progress_status "
|
|
rsp.Open query, adoConn, 1
|
|
|
|
if rsp.RecordCount = 1 Then
|
|
Response.Write "rsp.RecordCount : " & rsp.RecordCount & "<BR>"
|
|
|
|
If CInt(rsp("p_progress_status")) > 6 Then
|
|
project_workflow = true
|
|
'''원래 p_progress_status가 007이거나, 008일 경우 수행계획서의 결재가 취소되거나, 이미 결재 난 부분이 반려 처리 되어야 한다.
|
|
'''(p_progress_status = 001, p_state = 'K', Document 테이블, 문서내용 테이블 등등 수정...
|
|
'''T_PROJECT_METHOD에 child_sn의 정보를 바탕으로 p_progress_status 를 001로 업데이트 한다.
|
|
Else
|
|
'''T_PROJECT_METHOD에 child_sn의 정보를 바탕으로 p_progress_status 를 001로 업데이트 한다.
|
|
query = "update T_PROJECT_METHOD set p_progress_status = '001' where p_sn = '" & p_sn & "' and p_sub_type = 'M' "
|
|
dbin.Open adoConn
|
|
dbin.Execute query
|
|
dbin.Close
|
|
End if
|
|
End If
|
|
rsp.close
|
|
Else
|
|
'''조사를 C로 추가 할 경우 - C-C추가 완료
|
|
If add_p_cont_cost <> "0" Or add_p_cont_cost <> "" Then
|
|
sql_from = sql_from & ", p_cont_cost"
|
|
sql_insertValue = sql_insertValue & ", '" & add_p_cont_cost & "' "
|
|
End If
|
|
End If
|
|
Else
|
|
'''모프로젝트가 C인 경우
|
|
If current_p_sub_type = "M" Then '''조사를 M으로 추가 할 경우
|
|
'''이미 모프로젝트에 p_sub_type이 M이 있을 경우에는 추가 불가능~!!! (2014-06-29 모프로젝트에 멀티 프로젝트가 1개를 초과 할수 없다...)
|
|
query = "select COUNT(p_sub_type) as cnt from T_PROJECT_METHOD where p_sn = '" & p_sn & "' and p_sub_type = 'M' "
|
|
rsp.Open query, adoConn, 1
|
|
|
|
if rsp.RecordCount > 0 Then
|
|
'Response.Write "rsp.RecordCount : " & rsp.RecordCount & "<BR>"
|
|
'Response.Write "rsp('cnt') : " & rsp("cnt") & "<BR>"
|
|
If rsp("cnt") > 0 Then
|
|
project_M_type_exist = True
|
|
End if
|
|
End if
|
|
rsp.close
|
|
|
|
If Not project_M_type_exist Then
|
|
'''모프로젝트의 Method Table의 p_sub_type을 M, p_child_sn의 C도 M으로 업데이트 한다.
|
|
tmp_change_p_child_sn = Replace(p_child_sn, "C", "M")
|
|
'''T_PROJECT_METHOD에 child_sn의 정보를 바탕으로 p_progress_status 를 001로 업데이트 한다.
|
|
query = "update T_PROJECT_METHOD set p_progress_status = '001', p_sub_type = 'M', p_child_sn = '" & tmp_change_p_child_sn & "' where p_sn = '" & p_sn & "' and p_sub_type = 'C' and p_child_sn = '" & p_child_sn & "' "
|
|
'Response.Write "query : " & query & "<BR>"
|
|
dbin.Open adoConn
|
|
dbin.Execute query
|
|
dbin.Close
|
|
End if
|
|
|
|
'''모프로젝트의 계약액, 계약 날자, 용역범위, 결정일자, 프로젝트명, 조사내용 정보를 Method Table로 업데이트 한다.
|
|
'''T_PROJECT_BASE의 p_cont_cost에 add_p_cont_cost를 합산한다.
|
|
'''원래 p_progress_status가 007이거나, 008일 경우 수행계획서의 결재가 취소되거나, 이미 결재 난 부분이 반려 처리 되어야 한다.
|
|
Else
|
|
'''조사를 C로 추가 할 경우 - C-C추가 완료
|
|
If add_p_cont_cost <> "0" Or add_p_cont_cost <> "" Then
|
|
sql_from = sql_from & ", p_cont_cost"
|
|
sql_insertValue = sql_insertValue & ", '" & add_p_cont_cost & "' "
|
|
End If
|
|
End If
|
|
|
|
query = sql_from & sql_values & sql_insertValue & sql_end
|
|
End If
|
|
|
|
query = sql_from & sql_values & sql_insertValue & sql_end
|
|
|
|
dbin.Open adoConn
|
|
|
|
If project_M_type_exist Or project_workflow Then
|
|
Response.Write "예외로 인한 처리 실패<BR>"
|
|
Else
|
|
dbin.Execute query
|
|
End if
|
|
dbin.Close
|
|
%>
|
|
<html>
|
|
<script>
|
|
function goit() {
|
|
var form = document.pms;
|
|
if(form.project_M_type_exist.value == "true"){
|
|
alert("부모 프로젝트에 이미 Multi Project가 존재 합니다.\n관리자에게 문의 하세요.");
|
|
}else if(form.project_workflow.value == "true"){
|
|
alert("부모 프로젝트에 대한 수행계획서가 결재 중이거나, 결재가 완료 되었습니다.\n관리자에게 문의 하세요.");
|
|
}else{
|
|
alert('등록되었습니다');
|
|
}
|
|
window.opener.opener.location.reload();
|
|
window.opener.close();
|
|
window.close();
|
|
}
|
|
</script>
|
|
<body onLoad="goit()">
|
|
<form name="pms" method="post">
|
|
<input type="hidden" name="project_M_type_exist" value="<%=project_M_type_exist%>"/>
|
|
<input type="hidden" name="project_workflow" value="<%=project_workflow%>"/>
|
|
</form>
|
|
</body>
|
|
</html> |