문서 작성

<% dim tmpstr dim Query dim i, j dim user_name(4) '현재 사용자,0:사원코드, 1:이름,2:직급,3:전화번호, 4:부서코드(명) dim Max_Width dim title dim Curr_date '오늘날짜 dim Company(6) dim krc_no '정산서의 문서번호 dim krc_no_estimate '가지급금지출결의서의 문서번호 dim gap(27) dim gap_real(65) dim print_type dim tabindex dim db_table_name db_table_name = "문서내용" title="가지급금정산2" Max_Width =750 Curr_date = year(date) & "년 " & month(date) & "월 " & day(date) & "일" set rsm = server.CreateObject("ADODB.RECORDSET") ''//================= ''//================= '''''과거 지난기록 가져오기(가지급금지출결의서의 내용 가져오기 krc_no_estimate=request("krc_no_estimate") gap(2) = "--" ' '전화번호 'split때문에 if krc_no_estimate <> "" then '가지급정산인데 가지급지출결의서의 문서번호를 기준으로 일단은 가지급지출결의서 내용을 가져오기 query = "select * from " & db_table_name query = query & " where 문서번호 = '" & krc_no_estimate & "'" adors.open query, adoconn, adopenstatic, adlockreadonly gap(1) = adors("target1") gap(2) = adors("target2") gap(3) = adors("target3") gap(4) = adors("target4") gap(5) = adors("target5") gap(6) = adors("target6") gap(7) = ViewWord(adors("target7")) gap(8) = adors("target8") gap(9) = adors("target9") gap(10) = adors("target10") gap(11) = ViewWord(adors("target11")) gap(16) = adors("target12") gap(17) = adors("target13") gap(18) = adors("target19") gap(19) = adors("target20") gap(20) = adors("target21") gap(21) = adors("target22") gap(22) = adors("target23") gap(23) = adors("target24") gap(24) = adors("target25") gap(25) = adors("target26") gap(26) = adors("target27") gap(27) = adors("target28") adoRs.close end if print_type = request("print_type") tmpstr = split(request("txt_target"),",") gap(11) = request("txt_target08") if print_type = "1" then for i=1 to ubound(tmpstr) gap_real(i) = tmpstr(i) 'Response.Write i & " => " & gap_real(i) & "'
" next elseif print_type = "2" then for i=1 to ubound(tmpstr)-12 gap_real(i) = tmpstr(i+12) 'Response.Write i & " => " & gap_real(i) & "'
" next end if ' Response.Write tmpstr(0) & "'
" ''//================= ''//================= ''//=============== ''회사 회사명, 사업자등록번호, 대표자명, 주소 가져오기 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") 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 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") tmp_txt11 = request("tmp_txt11") tmp_txt12 = request("tmp_txt12") 'Response.Write "tmp_txt1 : " & tmp_txt1 & "
" if cint(print_type) = 2 then '먼저 가지급금정산서의 문서번호 생성 ''///=============== ''문서번호 정보 Query = "select 문서번호 as krc_no from " & db_table_name query = query & " where 문서제목 = '" & replace(title, " ", "") & "' " 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 & "5-" krc_no = tmpstr & ZeroFormat(krc_no,5) '''진행비 gap(12) = "" for i=1 to 24 step 2 gap(12) = gap(12) & gap_real(i) & "^^" & gap_real(i+1) & "^^" 'Response.Write gap(12) & "
" next ''출장비 gap(13)="" for i=25 to 36 step 2 gap(13) = gap(13) & gap_real(i) & "^^" & gap_real(i+1) & "^^" next ''기타 gap(14)="" for i=37 to 47 step 2 gap(14) = gap(14) & gap_real(i) & "^^" & gap_real(i+1) & "^^" next ''정산내역 gap(15)="" for i=48 to 51 gap(15) = gap(15) & gap_real(i+1) & "^^" next ' Response.Write "12 => '" & gap(12) & "
" ' Response.Write "13 => '" & gap(13) & "
" ' Response.Write "14 => '" & gap(14) & "
" ' Response.Write "15 => '" & gap(15) & "
" 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) %> <% target99 = tmp_txt1 & "^^" & tmp_txt2 & "^^" & tmp_txt3 & "^^" & tmp_txt4 & "^^" & tmp_txt5 & "^^" & tmp_txt6 target100 = tmp_txt7 & "^^" & tmp_txt8 & "^^" & tmp_txt9 & "^^" & tmp_txt10 & "^^" & tmp_txt11 & "^^" & tmp_txt12 '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 & "', '" & replace(title, " ", "") & "', '" & Session("loginuser") & "', '" & date() & "', '16', '" & 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 '==================================================================== '//======================== '내용 저장하기 '일단 기존에 저장된 가지급금정산서는 지우고 '왜냐하면 가지급금정산서는 가지급금지출결의서와 1대1이기에 'query = "select 문서번호 from " & db_table_name & " where target16 like '" & krc_no_estimate & "%'" 'adoRs.open Query, adoconn,adopenstatic, adlockreadonly 'if adoRs.recordcount > 0 then ' krc_no = adors("문서번호") 'end if 'adoRs.close 'query = "delete from " & db_table_name & " where target16 like '" & krc_no_estimate & "%'" 'adoconn.execute query query = "insert into " & db_table_name & " (문서번호, 문서제목, target1, target2, target3, target4, target5, " query = query & " target6, target7, target8, target9, target10, target11, " query = query & " target12, target13, target14, target15, target16, target17, target18," query = query & " target19, target20, target21, target22, target23, target24, target25, target26, target27, target28, "'가지급금의 세부내역(2009-10-01) query = query & " target97,target98,target99,target100, " query = query & " p_sn, 발급일, 발급시각, login_p_no, login_이름,login_ip) values ( " query = query & "'" & krc_no & "', " query = query & "'" & replace(title, " ", "") & "', " query = query & "'" & gap(1) & "', " query = query & "'" & gap(2) & "', " query = query & "'" & gap(3) & "', " query = query & "'" & gap(4) & "', " query = query & "'" & gap(5) & "', " query = query & "'" & gap(6) & "', " query = query & "'" & CheckWord(gap(7)) & "', " query = query & "'" & gap(8) & "', " query = query & "'" & gap(9) & "', " query = query & "'" & gap(10) & "', " query = query & "'" & CheckWord(replace(gap(11),chr(13),"
")) & "', " query = query & "'" & gap(12) & "', " query = query & "'" & gap(13) & "', " query = query & "'" & gap(14) & "', " query = query & "'" & gap(15) & "', " query = query & "'" & krc_no_estimate & "', " query = query & "'" & gap(16) & "', " query = query & "'" & gap(17) & "', " for i= 18 to 27''가지급금의 세부내역(2009-10-01) query = query & "'" & gap(i) & "', " next query = query & "'" & target97 & "', " query = query & "'" & target98 & "', " query = query & "'" & target99 & "', " query = query & "'" & target100 & "', " query = query & "'" & gap(17) & "', " 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 & "
" ' if session("loginuser") = "김홍근" or session("loginuser") = "강두형" then 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") & "')" adoconn.execute query end if %> <%if cint(print_type) = 2 then%> <% end if %>
<%if cint(print_type) = 1 then%> <%end if%>
<%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_txt6 = tmp_txt tmp_txt7 = "/" tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = "/" tmp_txt11 = "/" tmp_txt12 = 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 = "/" tmp_txt10 = "/" tmp_txt11 = month(now()) & " / " & day(now()) tmp_txt12 = "/" elseif my_pos = 3 or my_pos = 4 then '부서장 tmp_txt1 = "전결" tmp_txt2 = tmp_txt tmp_txt3 = " " tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = " " tmp_txt7 = "/" tmp_txt8 = month(now()) & " / " & day(now()) tmp_txt9 = "/" tmp_txt10 = "/" tmp_txt11 = "/" tmp_txt12 = "/" elseif my_pos = 1 OR my_pos = 2 then '팀 팀원, 팀장 tmp_txt1 = tmp_txt tmp_txt2 = " " tmp_txt3 = " " tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = " " tmp_txt7 = month(now()) & " / " & day(now()) tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = "/" tmp_txt11 = "/" tmp_txt12 = "/" else '노팀 팀원 tmp_txt1 = tmp_txt tmp_txt2 = " " tmp_txt3 = " " tmp_txt4 = " " tmp_txt5 = " " tmp_txt6 = " " tmp_txt7 = month(now()) & " / " & day(now()) tmp_txt8 = "/" tmp_txt9 = "/" tmp_txt10 = "/" tmp_txt11 = "/" tmp_txt12 = "/" end if %>

기안/승인(실사) 기안/승인(임원) 검토/승인(관리부서)
본인 부서장 임원 <%=tmp_title%> 담당 부서장 임원 <%=tmp_title%>
<%=tmp_txt1%>  <%=tmp_txt3%>  <%=tmp_txt4%>  <%=tmp_txt5%> 
<%=tmp_txt7%> <%=tmp_txt9%> <%=tmp_txt11%> <%=tmp_txt12%> / / / /
가지급금 정산 내역서
지급처 <%=gap(1)%> <%tmpstr = split(gap(2),"-")%> Tel. <%=tmpstr(0)%> - <%=tmpstr(1)%> - <%=tmpstr(2)%> 가지급금 내역 <%if not (trim(gap(7)) = " " or trim(gap(7)) = "") then%> <%=ViewWord(gap(7))%> <%else%> <%for i=1 to 5%> <%if trim(gap(18+((i-1)*2))) = "" then%> <% else %> <% end if %> <%next%>
항목 금액
   <%=gap(18+((i-1)*2))%> \ <%=gap(19+((i-1)*2))%>
<%end if%>
지급처 담당자 <%=gap(3)%>
지급일자 <%=gap(4)%>
정산 예정일 <%=gap(5)%>
지출사유 <%=gap(6)%> 계 <%=gap(8)%> 원
프로젝트 <%=gap(16)%> 부가세액 <%=gap(9)%> 원
지출 발의자 <%=user_name(1)%> 가지급 합계액 <%=gap(10)%> 원
",chr(13))%>"> <% 'Response.Write "gap_real = " & gap_real(13) & "
" tabindex = 11 for i=1 to 2 '사례비, 운반비 tabindex = tabindex + 1 %> <%tabindex = tabindex + 1%> <% next %> <%for i=1 to 3%> <%for j=(i-1) * 2+3 to (i-1) * 2+4 '임대료부터 우편료까지 tabindex = tabindex + 1'%> <%tabindex = tabindex + 1%> <%next%> <%next%> <%for i=4 to 5%> <%for j=(i-1) * 2+3 to (i-1) * 2+4 '여분4개 tabindex = tabindex + 1'%> <%tabindex = tabindex + 1'%> <%next%> <%next%> <% for i=13 to 14 '항공료부터 교통비까지 tabindex = tabindex + 1 %> <%tabindex = tabindex + 1%> <% next %> <%for i=7 to 8%> <%for j=(i-1) * 2+3 to (i-1) * 2+4 '숙바료 부터 기타까지 tabindex = tabindex + 1'%> <%tabindex = tabindex + 1'%> <%next%> <%next%> <% for i=19 to 20 tabindex = tabindex + 1 %> <%tabindex = tabindex + 1%> <% next %> <%for i=10 to 11%> <%for j=(i-1) * 2+3 to (i-1) * 2+4 tabindex = tabindex + 1'%> <%tabindex = tabindex + 1'%> <%next%> <%next%> <%tabindex = tabindex + 1'%> <%if print_type=2 then%> <%end if%>
세 부 정 산 내 역 (진 행 비)
 원
 원
 원
세 부 정 산 내 역 (출 장 비)
 원
 원
세 부 정 산 내 역 (기 타)
 원
 원
정 산 내 역
정산일자
가지급 정산 총사용 금액  원
 원
비 고
	영 수 일 자 :              년      월      일
	영   수   자 :                               (印)
<% '프로그램이 구려서 아래의 히든 값은 반드시 여기에 위치해야 함.. '위로 올리면 저장되는 값이 어긋남. %>