<% ''//===================== ''//===================== ''2013년 9월 27일자로 ' 지출 결의서에 입금결의서를 추가하여 2개문서를 같은 프로그램에서 구동 '' 구분은 titie와 title_type로 구분 ''//===================== ''//===================== dim tmpstr dim Query dim i dim user_name(4) '현재 사용자,0:사원코드, 1:이름,2:직급,3:전화번호, 4:부서코드(명) dim Max_Width dim title dim target_name '발급대상자 이름 dim Curr_date '오늘날짜 dim Company(6) dim Gap(10) '1:프로젝트 코드, 2:지출(입금)목적, 3:지출(입금)일자, 4:지출(입금)방법, 5:공급가액, 6:부가세액, 7:총액, 8:거래처, 9:프로젝트 코드, 10:품의서 문서번호 dim krc_no dim print_type '1:보기, 2:진짜프린트 dim db_table_name dim approval_chk dim title_type dim p_sn dim d_p_subject dim d_p_child_sn dim d_estimate_money dim d_currentMoney dim d_totalPay dim d_chaPay dim d_sotPay db_table_name = "문서내용" approval_chk = "true" pay_type = request("pay_type") startDT = request("startDT") endDT = request("endDT") sv = request("sv") print_type = request("print_type") p_sn = request("p_sn") ' response.write "pay_type : " & request("pay_type") & "
" ' response.write "startDT : " & request("startDT") & "
" ' response.write "endDT : " & request("endDT") & "
" ' response.write "print_type : " & request("print_type") & "
" dim pay_month dim key_day if Session("loginuser") = "신상운" or Session("loginuser") = "양영은" then sql = "select ver as key_day from information where program='인트라넷페이입력기준날자(경영지원실)'" elseif Session("loginuser") = "김홍근" then sql = "select ver as key_day from information where program='인트라넷페이입력기준날자(김홍근만)'" else sql = "select ver as key_day from information where program='인트라넷페이입력기준날자(자료조사부)'" end if rsc.open sql, adoConn,adopenstatic, adlockreadonly key_day = rsc.fields("key_day") rsc.close if cint(day(date)) >= 1 and cint(day(date)) <= cint(key_day) then '1일 에서 5일 사이면 종료날짜가 금번달 5일인것 찾기 if cint(month(date)) = 1 then '1월 이면 전년도 12월 자료 '수당 입력시 기준이 되는 날짜~! 쉽게 말해서 수당 지급 날짜가 된다~! pay_month = year(date) & "-01-15" else '수당 입력시 기준이 되는 날짜~! 쉽게 말해서 수당 지급 날짜가 된다~! pay_month = year(date) & "-" & zeroformat(month(date),2) & "-15" end If else if cint(month(date)) = 12 then '12월 이면 종료날짜가 다음년도 1월5일 인것 찾기 '수당 입력시 기준이 되는 날짜~! 쉽게 말해서 수당 지급 날짜가 된다~! pay_month = year(date) + 1 & "-01-15" Else '수당 입력시 기준이 되는 날짜~! 쉽게 말해서 수당 지급 날짜가 된다~! pay_month = year(date) & "-" & zeroformat(month(date)+1,2) & "-15" end If end if If pay_type = 1 Then title="내근직 수당 지출결의서" Else title="면접원 수당 지출결의서" End if If cint(print_type) = 0 Then d_no = request("d_no") query = "SELECT * " query = query & " FROM 문서내용 as a " query = query & " INNER JOIN Document as b on a.문서번호 = b.d_no " query = query & " WHERE a.문서번호='" & d_no & "' " query = query & " AND b.d_delok = 'N' " rsc.Open query, adoConn, 1 if rsc.RecordCount > 0 Then If rsc("문서제목") = "내근직수당지출결의서" Then pay_type = "1" Else pay_type = "2" End If tmp_d_order_cnt = rsc("d_order_cnt") startDT = rsc("target10") endDT = rsc("target11") overMoney_reason = rsc("target17") End if End if title_type = mid(replace(title," ",""), 1, 7) Max_Width =750 Curr_date = year(date) & "년 " & zeroformat(month(date),2) & "월 " & zeroformat(day(date),2) & "일" ''//=============== ''회사 회사명, 사업자등록번호, 대표자명, 주소 가져오기 Query = "select * from company" adoRs.open Query, adoconn,adopenstatic, adlockreadonly Company(1) = adors("com_name") Company(2) = adors("사업자등록번호") Company(3) = adors("대표자명") Company(4) = adors("주소") Company(5) = adors("법인등록번호") Company(6) = adors("회사대표전화번호") adoRs.close ''///=============== ''로그인 사용자 정보 'user_name(0) = Session("User_Number") user_name(0) = Session("User_Number") Query = "SELECT p_name, p_team_name, p_rank_name, p_tel3 FROM project2.dbo.V_Person WHERE p_no = '" & user_name(0) & "'" adoRs.open Query, adoconn,adopenstatic, adlockreadonly user_name(1) = adoRs("p_name") '이름 user_name(2) = adoRs("p_rank_name") '직위 코드 user_name(3) = adoRs("p_tel3") '직통 전화 user_name(4) = adoRs("p_team_name") '부서코드 adoRs.close ''////////======================== ''값가져오기 gap(1) = request("txt_prj_name") gap(2) = request("txt_pay_target") gap(3) = request("txt_date") gap(4) = request("sel_pay_type") gap(5) = request("txt_pay") gap(6) = request("txt_pay_vat") gap(7) = request("txt_pay_tot") gap(8) = request("txt_client") gap(9) = request("txt_p_sn") gap(10) = request("txt_d_no") ' Response.Write "gap(1) : " & gap(1) & "
" ' Response.Write "gap(2) : " & gap(2) & "
" ' Response.Write "gap(3) : " & gap(3) & "
" ' Response.Write "gap(4) : " & gap(4) & "
" ' Response.Write "gap(5) : " & gap(5) & "
" ' Response.Write "gap(6) : " & gap(6) & "
" ' Response.Write "gap(7) : " & gap(7) & "
" ' Response.Write "gap(8) : " & gap(8) & "
" ' Response.Write "gap(9) : " & gap(9) & "
" ' Response.Write "gap(10) : " & gap(10) & "
" tmp_txt1 = request("tmp_txt1") tmp_txt2 = request("tmp_txt2") tmp_txt3 = request("tmp_txt3") tmp_txt4 = request("tmp_txt4") tmp_txt5 = request("tmp_txt5") tmp_txt6 = request("tmp_txt6") tmp_txt7 = request("tmp_txt7") tmp_txt8 = request("tmp_txt8") tmp_txt9 = request("tmp_txt9") tmp_txt10 = request("tmp_txt10") ' Response.Write "tmp_txt1 : " & tmp_txt1 & "
" ' Response.Write "tmp_txt2 : " & tmp_txt2 & "
" ' Response.Write "tmp_txt3 : " & tmp_txt3 & "
" ' Response.Write "tmp_txt4 : " & tmp_txt4 & "
" ' Response.Write "tmp_txt5 : " & tmp_txt5 & "
" ' Response.Write "tmp_txt6 : " & tmp_txt6 & "
" ' Response.Write "tmp_txt7 : " & tmp_txt7 & "
" ' Response.Write "tmp_txt8 : " & tmp_txt8 & "
" ' Response.Write "tmp_txt9 : " & tmp_txt9 & "
" ' Response.Write "tmp_txt10 : " & tmp_txt10 & "
" if cint(print_type) = 2 then '먼저 지 출 결 의 서의 문서번호 생성 ''///=============== ''문서번호 정보 Query = "select 문서번호 as krc_no from 문서내용 " query = query & " where 문서번호 like 'KRC-" & year(date) & "-t-%' " query = query & " and substring(문서번호,5,4) = '" & year(date) & "' " query = query & " order by 문서번호" adoRs.open Query, adoconn,adopenstatic, adlockreadonly if adoRs.recordcount <= 0 then krc_no = 0 else adoRs.movelast tmpstr = split(trim(adoRs("krc_no")),"-") krc_no = tmpstr(3) end If adoRs.close krc_no = int(krc_no) + 1 tmpstr = "KRC-" & year(date) & "-" tmpstr = tmpstr & "t-" krc_no = tmpstr & ZeroFormat(krc_no,5) 'Response.Write "krc_no : " & krc_no & "
" tmp_p_sn = split(gap(9),",") target97 = user_name(1) & "^^" & user_name(2) & "^^" & user_name(3) & "^^" & user_name(4) target98 = Company(1) & "^^" & Company(2) & "^^" & Company(3) & "^^" & Company(4) & "^^" & Company(5) & "^^" & Company(6) '==================================================================== dataCount = request("dataCount") overMoney_reason = "" d_estimate_money = "" d_currentMoney = "" d_totalPay = "" d_chaPay = "" d_p_child_sn = "" d_p_subject = "" Dim overMoney_reason_count overMoney_reason_count = 0 For i = 1 To request("overMoney_reason").count If Trim(request("overMoney_reason")(i)) <> "" Then overMoney_reason_count = overMoney_reason_count + 1 End if d_p_subject = d_p_subject + ( cstr(i) + "^^" + request("p_subject")(i) + "^//^" ) d_p_child_sn = d_p_child_sn + ( cstr(i) + "^^" + request("p_sn")(i) + "^//^" ) overMoney_reason = overMoney_reason + ( cstr(i) + "^^" + request("overMoney_reason")(i) + "^//^" ) d_estimate_money = d_estimate_money + ( cstr(i) + "^^" + request("estimate_money")(i) + "^//^" ) d_currentMoney = d_currentMoney + ( cstr(i) + "^^" + request("currentMoney")(i) + "^//^" ) d_totalPay = d_totalPay + ( cstr(i) + "^^" + request("totalPay")(i) + "^//^" ) d_chaPay = d_chaPay + ( cstr(i) + "^^" + request("chaPay")(i) + "^//^" ) Next %> <% target99 = tmp_txt1 & "^^" & tmp_txt2 & "^^" & tmp_txt3 & "^^" & tmp_txt4 & "^^" & tmp_txt5 target100 = tmp_txt6 & "^^" & tmp_txt7 & "^^" & tmp_txt8 & "^^" & tmp_txt9 & "^^" & tmp_txt10 'Document table에 삽입 query = "INSERT INTO Document " query = query & " (d_no, d_name, d_write_name, d_write_date, d_flag, d_type, " query = query & " d_order_cnt, d_orders," query = query & " d_order1, d_order2, d_order3, d_order4, d_order5, " query = query & " d_order6, d_order7, d_order8, d_order9, d_order10, " query = query & " d_view, d_delok) " query = query & "VALUES " query = query & " ('" & krc_no & "', '" & title_type & "결의서', '" & Session("loginuser") & "', '" & date() & "', '10', '" & d_type & "', " query = query & " '" & d_order_cnt & "', '" & d_orders & "', " query = query & " '" & d_order1 & "', '" & d_order2 & "', '" & d_order3 & "', '" & d_order4 & "', '" & d_order5 & "', " query = query & " '" & d_order6 & "', '" & d_order7 & "', '" & d_order8 & "', '" & d_order9 & "', '" & d_order10 & "', " query = query & " 'Y', 'N') " 'Response.Write query & "
" adoconn.execute query '==================================================================== '//======================== '내용 저장하기 '- GET 방식으로 넘겼을 경우. 'request.QueryString("aa") '- POST 방식으로 넘겼을 경우. 'request.Form("aa") '- GET 방식, POST 방식 둘다 가능. 'request("aa") query = "insert into 문서내용 (문서번호, 문서제목, target1, target2, target3, target4, target5, " query = query & " target6, target7, target8, target9, target10, target11, target12, target13, target14, target15, target16, target17, target20, target21, target97,target98,target99,target100,p_sn, 발급일, 발급시각, login_p_no, login_이름,login_ip) values ( " query = query & "'" & krc_no & "', " query = query & "'" & replace(title, " ", "") & "', " query = query & "'" & gap(1) & "', " query = query & "'" & CheckWord(gap(2)) & "', " query = query & "'" & gap(3) & "', " query = query & "'" & gap(4) & "', " query = query & "'" & gap(5) & "', " query = query & "'" & gap(6) & "', " query = query & "'" & gap(7) & "', " query = query & "'" & gap(8) & "', " query = query & "'" & gap(10) & "', " query = query & "'" & startDT & "', " query = query & "'" & endDT & "', " query = query & "'" & sv & "', " query = query & "'" & d_estimate_money & "', " query = query & "'" & d_currentMoney & "', " query = query & "'" & d_totalPay & "', " query = query & "'" & d_chaPay & "', " query = query & "'" & overMoney_reason & "', " query = query & "'" & d_p_child_sn & "', " query = query & "'" & d_p_subject & "', " query = query & "'" & target97 & "', " query = query & "'" & target98 & "', " query = query & "'" & target99 & "', " query = query & "'" & target100 & "', " query = query & "'" & gap(9) & "', " query = query & "'" & year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2) & "', " query = query & "'" & time() & "', " query = query & "'" & user_name(0) & "', " query = query & "'" & user_name(1) & "', " query = query & "'" & Session("USERIP") & "') " 'Response.Write query & "
" adoconn.execute query ''로그저장 query = "insert into " & db_table_name & "_log (문서번호, 문서제목, 대상자_p_no, 대상자_이름, 내용," query = query & " 발급일, 발급시각, 발급자_p_no, 발급자_이름, 발급자_ip) values ( " query = query & "'" & krc_no & "', " query = query & "'" & replace(title, " ", "") & "', " query = query & "'" & user_name(0) & "', " query = query & "'" & user_name(1) & "', " query = query & "'" & replace(title, " ", "") & "인쇄', " query = query & "'" & year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2) & "', " query = query & "'" & time() & "', " query = query & "'" & user_name(0) & "', " query = query & "'" & user_name(1) & "', " query = query & "'" &Session("USERIP") & "')" 'Response.Write query & "
" adoconn.execute query ''날자를 '-'에서 년,월로 교체 gap(3) = mid(gap(3),1,4) & "년 " & mid(gap(3),6,2) & "월 " & mid(gap(3),9,2) & "일" for i=1 to 9 if trim(gap(i)) = "" then gap(i) = " " end if Next for i=5 to 7 if gap(i) = " " then gap(i) = "0" end if next 'response.write "krc_no : " & krc_no & "
" 'response.write "title : " & replace(title, " ", "") & "
" 'response.write "startDT : " & startDT & "
" 'response.write "endDT : " & endDT & "
" 'response.write "sv : " & sv & "
" If replace(title, " ", "") = "내근직수당지출결의서" Or replace(title, " ", "") = "면접원수당지출결의서" Then query = "Update man " query = query & " set m_last_work_date = convert(varchar(10), GETDATE(), 23) " query = query & " where id in " query = query & "(SELECT (select id from man where m_name=T.m_name and left(m_jumin,6)+'0000000' = T.m_jumin) as id FROM " query = query & "T_myun_pay T " query = query & "WHERE p_sn = '" & p_sn & "' and isnull(attribute05,'') = '' " query = query & " group by m_name, m_jumin) " adoconn.execute query query = "UPDATE t_myun_pay " query = query & "SET attribute05 = '" & krc_no & "' , pay_month = '" & pay_month & "' " query = query & "WHERE p_sn = '" & p_sn & "' and isnull(attribute05,'') = '' and confirm_yn = 'Y' " adoconn.execute query End if '2014-12-26 면접원, 내근직 지출 결의서 일 경우 ------------------------------------ If d_order_cnt = 77 Then if tmp_d_order_cnt <> "77" then set dbin = server.CreateObject("ADODB.CONNECTION") query = " SELECT p_sn, s_gubun, SUM(s_sum) as s_sum " query = query & " FROM " query = query & " ( " query = query & " select p_sn, m_name, m_jumin, work_dt, est_money as s_gubun, " query = query & " case when s_gubun = 'ff' then s_pay_unit * (s_wan + add_count) + add_money else s_sum end as s_sum, " query = query & " attribute05, confirm_yn, s_ot " query = query & " from t_myun_pay " query = query & " union all " query = query & " select p_sn, m_name, m_jumin, work_dt, '교육비' as s_gubun, " query = query & " case when s_gubun = 'ff' then s_sum - s_pay_unit * (s_wan + add_count) - add_money else 0 end as s_sum, " query = query & " attribute05, confirm_yn, s_ot " query = query & " from t_myun_pay " query = query & " ) t " query = query & " WHERE p_sn = '" & p_sn & "' and isnull(attribute05,'') = '" & krc_no & "' and confirm_yn = 'Y' " query = query & " group by s_gubun, p_sn " rsc.open query, adoconn,adopenstatic, adlockreadonly do while not rsc.eof directQuery = " UPDATE direct_cost " directQuery = directQuery & " set act_money = act_money + " & rsc("s_sum") & " , " directQuery = directQuery & " cha_money = cha_money + " & rsc("s_sum") & " " directQuery = directQuery & " where p_child_sn = '" & rsc("p_sn") & "' " directQuery = directQuery & " and del_yes_no = 'no' and sebu = '" & rsc("s_gubun") & "' " adoConn.Execute directQuery, i if i < 1 then Query = "select 문서번호 as krc_no from 문서내용 " query = query & " where 문서제목 = '" & replace(title, " ", "") & "' " query = query & " and substring(문서번호,5,4) = '" & year(date) & "' " query = query & " order by 문서번호" Rs.open Query, adoconn,adopenstatic, adlockreadonly if Rs.recordcount <= 0 then krc_no = 0 else Rs.movelast tmpstr = split(trim(Rs("krc_no")),"-") krc_no = tmpstr(3) end if Rs.close krc_no = int(krc_no) + 1 tmpstr = "KRC-" & year(date) & "-" tmpstr = tmpstr & "X-" krc_no = tmpstr & ZeroFormat(krc_no,5) Query = " insert into direct_cost(p_sn, krc_no, p_subject, hangmok, sebu, act_money, " Query = Query & " modify_date, modify_time, modify_user, modify_user_code, modify_ip, del_yes_no, cost_type, p_child_sn) " Query = Query & " values( " Query = Query & " left('" & rsc("p_sn") & "',7), " Query = Query & " '" & krc_no & "', " Query = Query & " (select p_subject from T_PROJECT_METHOD where p_child_sn = '" & rsc("p_sn") & "'), " Query = Query & " '48', " Query = Query & " '" & rsc("s_gubun") & "', " Query = Query & " '" & rsc("s_sum") & "', " Query = Query & " convert(char(10),GETDATE(),23), " Query = Query & " convert(char(10),GETDATE(),24), " Query = Query & " '"& Session("loginuser") &"', " Query = Query & " '"& Session("User_Number") &"', " Query = Query & " '"& Session("USERIP") &"', " Query = Query & " 'no', " Query = Query & " 'field', " Query = Query & " '" & rsc("p_sn") & "') " 'Response.Write "Query :" & Query 'dbin.Open adoConn adoConn.Execute Query 'dbin.Close end if rsc.movenext loop rsc.close else alert2 "이미 결재가 완료된 문서입니다." end if End if '---------------------------------------------------------------------------------- elseif cint(print_type) = 1 then end if %> <%=GNB_TITLE%> onLoad="clsit();" <% end if %>>
<%if cint(print_type) = 1 then%> <%end if%>
<%if approval_chk = "true" then%> <%else Response.Write "본부가 혼재된 프로젝트는 결재 상신이 안됩니다. 본부를 구분하세요" end if%>
<% Dim pay_apply_username pay_apply_username = "" set adors2 = server.CreateObject("ADODB.RECORDSET") query = "select p_name from person where p_no = '" & sv & "' " adors2.open query, adoconn, adopenstatic, adlockreadonly If adors2.recordCount > 0 Then pay_apply_username = adors2("p_name") End If adors2.close %>
<%=title%> <%if cdate(formatdatetime(date,2)) > "2014-01-07" then tmp_title = "대표이사" else tmp_title = "부회장" end if%> <% 'my_pos = "3" 'Response.Write "my_pos : " & my_pos & "
" tmp_txt = "

" & Session("loginuser") & "
" & replace(date(), "-","") & "
" & FormatDateTime(time,4) tmp_txt = Session("loginuser") & "
" & replace(date(), "-","") & "
" & Session("User_Number") if my_pos = 6 then '사장 tmp_txt1 = "전결" tmp_txt2 = "전결" tmp_txt3 = "전결" tmp_txt4 = "전결" tmp_txt5 = tmp_txt tmp_txt6 = "/" tmp_txt7 = "/" tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = month(now()) & " / " & day(now()) elseif my_pos = 5 then '임원 tmp_txt1 = "전결" tmp_txt2 = "전결" tmp_txt3 = "전결" tmp_txt4 = tmp_txt tmp_txt5 = " " tmp_txt6 = "/" tmp_txt7 = "/" tmp_txt8 = "/" tmp_txt9 = month(now()) & " / " & day(now()) tmp_txt10 = "/" elseif my_pos = 3 or my_pos = 4 then '부서장 tmp_txt1 = "전결" tmp_txt2 = "전결" tmp_txt3 = tmp_txt tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = "/" tmp_txt7 = "/" tmp_txt8 = month(now()) & " / " & day(now()) tmp_txt9 = "/" tmp_txt10 = "/" elseif my_pos = 2 then '팀장 tmp_txt1 = tmp_txt tmp_txt2 = "전결" tmp_txt3 = " " tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = month(now()) & " / " & day(now()) tmp_txt7 = "/" tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = "/" elseif my_pos = 1 then '팀 팀원 tmp_txt1 = tmp_txt tmp_txt2 = " " tmp_txt3 = " " tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = month(now()) & " / " & day(now()) tmp_txt7 = "/" tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = "/" else '노팀 팀원 tmp_txt1 = tmp_txt tmp_txt2 = "전결" tmp_txt3 = " " tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = month(now()) & " / " & day(now()) tmp_txt7 = "/" tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = "/" end if %>

기안/승인(소속부서) 검토/승인(관리부서)
본인 팀장 부서장 임원 <%=tmp_title%> 담당 부서장 임원 <%=tmp_title%>
<%=tmp_txt1%>  <%=tmp_txt2%>  <%=tmp_txt3%>  <%=tmp_txt4%>  <%=tmp_txt5%> 
<%=tmp_txt6%> <%=tmp_txt7%> <%=tmp_txt8%> <%=tmp_txt9%> <%=tmp_txt10%> / / / /
결 의 일 자 <%=Curr_date%>
성         명 <%=user_name(1)%>
소         속 <%=user_name(4)%>
직         급 <%=user_name(2)%>
하기의 프로젝트(업무)와 관련하여, <%=title_type%>을 결의하오니 승인하여 주시기 바랍니다.
수당 결재 기간 <%if startDT <> "" then %><%=startDT%> ~ <%=endDT%><% else %>프로젝트단위<%end if %> 수당 담당자 <%=pay_apply_username%>
<% Query = "select p_sn, isnull(p_subject, (select p_subject from V_PROJECT_METHOD where p_sn = T.p_sn )) as p_subject, isnull(SUM(pay), 0) as pay " Query = Query & "from ( " Query = Query & " select isnull(A.attribute05,'') as d_no, A.p_sn, C.p_subject, s_gubun, '2' as pay_type, isnull(SUM(s_sum), 0) as pay " Query = Query & " from t_myun_pay as A " Query = Query & " left outer join v_project as B " Query = Query & " on A.p_sn = B.p_sn " Query = Query & " left outer join v_project_method as C " Query = Query & " on A.p_sn = C.p_child_sn " Query = Query & " where A.p_sn = '" & p_sn & "' and isnull(A.attribute05,'') = '' " Query = Query & " and A.s_gubun in ('FF', 'CATI', 'ETC') and confirm_yn = 'Y' " Query = Query & " group by isnull(A.attribute05,''), A.p_sn, C.p_subject, s_gubun " Query = Query & ") as T " Query = Query & "group by p_sn, p_subject " 'Response.Write query & "
" adoRs.open Query, adoconn,adopenstatic, adlockreadonly Dim total_estimate_money, total_currentMoney, total_Pay, total_chaPay, total_sum total_estimate_money = 0 total_currentMoney = 0 total_Pay = 0 total_chaPay = 0 total_sum = 0 Dim minus_money_flag, dataCount dataCount = 0 if adoRs.recordcount > 0 Then dataCount = adoRs.recordcount do while not adoRs.eof minus_money_flag = False Query = "select p_sn, p_child_sn, SUM(convert(numeric(18,0), est_money)) as est_money from ( " Query = Query & " select * from direct_cost where p_sn like '" & Left(adoRs("p_sn"), 2) & "%' and hangmok = '48' and del_yes_no = 'no' union all" Query = Query & " select * from direct_cost where p_sn like '" & Left(adoRs("p_sn"), 2) & "%' and hangmok = '49' and sebu = '해독원' and del_yes_no = 'no' " Query = Query & ") as T " If Len(adoRs("p_sn")) > 9 Then Query = Query & "where p_child_sn = '" & adoRs("p_sn") & "' " Else Query = Query & "where p_sn = '" & adoRs("p_sn") & "' " End If Query = Query & "group by p_sn, p_child_sn " 'response.Write query adors2.open Query, adoconn,adopenstatic, adlockreadonly Dim estimate_money estimate_money = 0 if adors2.recordcount > 0 Then estimate_money = adors2("est_money") End If adors2.close Query = "SELECT p_sn, SUM(pay) AS pay FROM " Query = Query & "( " Query = Query & "select p_sn, isnull(sum(s_sum), 0) as pay from t_myun_pay " Query = Query & "where pay_type = 2 " Query = Query & "and isnull(pay_month,'') <> '' " Query = Query & "and p_sn = '" & adoRs("p_sn") & "' " Query = Query & "group by p_sn " Query = Query & "UNION ALL " Query = Query & "SELECT CONVERT(varchar, target10) AS p_sn, " Query = Query & " sum(CONVERT(NUMERIC(18, 0), CONVERT(varchar, target5))) AS pay " Query = Query & "FROM 문서내용 " Query = Query & "WHERE del_yes_no='no' AND (target11 LIKE '48' OR (target11 LIKE '49' AND target12 LIKE '77')) " Query = Query & "AND CONVERT(varchar, target10) = '" & adoRs("p_sn") & "' " Query = Query & "GROUP BY CONVERT(varchar, target10) " Query = Query & ") T " Query = Query & "GROUP BY p_sn " 'response.Write query & "
" adors2.open Query, adoconn,adopenstatic, adlockreadonly Dim currentMoney currentMoney = 0 if adors2.recordcount > 0 Then currentMoney = adors2("pay") End If 'response.Write adors2.recordcount & "//" & currentMoney & "
" adors2.close Dim totalPay, chaPay totalPay = CDbl(adoRs("pay")) chaPay = CDbl(estimate_money) - CDbl(currentMoney) - CDbl(totalPay) If chaPay < 0 Then minus_money_flag = true End if %> <% total_estimate_money = total_estimate_money + CDbl(estimate_money) total_currentMoney = total_currentMoney + CDbl(currentMoney) total_Pay = total_Pay + CDbl(totalPay) total_chaPay = total_chaPay + CDbl(chaPay) %> <% adoRs.movenext loop end if adoRs.close %>
프로젝트 예상직접비 누적비용 지출결의비용 예상잔액 사유
[<%=adoRs("p_sn")%>]  ', '<%=startDT%>', '<%=endDT%>', '<%=sv%>', 2, '<%="field"%>', '<%= d_no %>')">
<%=adoRs("p_subject")%>
" /> " />
<%=FormatNumber(CDbl(estimate_money), 0)%> <%=FormatNumber(CDbl(currentMoney), 0)%> <%=FormatNumber(CDbl(totalPay), 0)%> color="red" <% end if %>><%=FormatNumber(CDbl(chaPay), 0)%> readonly <% End If %> />
합계 <%=FormatNumber(total_estimate_money, 0)%> <%=FormatNumber(total_currentMoney, 0)%> <%=FormatNumber(total_Pay, 0)%> <%=FormatNumber(total_chaPay, 0)%>  
	영 수 일 자 :                  년      월      일
	영   수   자 :                                   (印)