<% dim Query dim i, j dim title dim Max_length '입력가능 줄수정의 dim Gap() dim cost_type(2) ''지출방법 구분 dim sel_date, sel_date_st, sel_date_ed, now_month dim depart_cost_type cost_type(0) = "선택" cost_type(1) = "개인법인카드" cost_type(2) = "현금/개인카드" sel_date = request("txt_date") sel_date_st = request("sel_date_st") sel_date_ed = request("sel_date_ed") now_month = request("now_month") 'response.write now_month depart_cost_type = request("depart_cost_type") ' 1:그룹활동비, 2:그룹장활동비 if depart_cost_type = "" Then if session("Depart_Code") = "0" Then depart_cost_type = "2" Else depart_cost_type = "1" end if End if title="부서비신청서" if sel_date <> "" Then Max_length=5 Else Max_length=13 End if redim gap(Max_length,6) 'x:순서, y:1:일자, 2:프로젝트명, 3:세부항목, 4:금액,5:프로젝트코드, 6:지출방법, (0,0) : 총액 %>
<%for i=1 to Max_length%> <%next%>
<% Dim depart_cd_string Dim total_est, total_use, total_res Dim hang1_res_cost, hang2_res_cost, hang3_res_cost, hang4_res_cost, hang5_res_cost, hang6_res_cost, hang7_res_cost, hang8_res_cost, hang9_res_cost depart_cd_string = "" total_est = 0 total_use = 0 total_res = 0 over_hang = "" '2023-05-15 서성완 파트너는 관리하는 팀 그룹비 & 사용내역 제공 (단 그룹비는 2개 팀 이상일 경우 합산해서 제공) ' ex) msbu1,2 = 이혜진 상무 msbu3,4 = 김다슬 전무, psbu1,4 = 원성훈 부사장, psbu2, aibd = 신상욱 상무, dco = 서지원 상무 '2023-05-31 서성완 ' 최정심 상무님 [ Session("User_Number") = "20151203" ]은 파트너가 아니지만 억지로 파트너로 만듬 V_GROUP_COST_NEW 뷰 테이블에 하드코딩 되어 있음 ' 채주희 본부장님 [ Session("User_Number") = "20031102" ]은 파트너가 아니지만 억지로 파트너로 만듬 V_GROUP_COST_NEW 뷰 테이블에 하드코딩 되어 있음 Query = "" If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then Query = Query & " Select 'GROUP_SUM' as depart_nm " Query = Query & " ,''''+STRING_AGG(depart_cd,''',''')+'''' as depart_cd_string " Query = Query & " ,ISNULL(SUM(hang1_cost),0) as hang1_cost " Query = Query & " ,ISNULL(SUM(hang2_cost),0) as hang2_cost " Query = Query & " ,ISNULL(SUM(hang3_cost),0) as hang3_cost " Query = Query & " ,ISNULL(SUM(hang4_cost),0) as hang4_cost " Query = Query & " ,ISNULL(SUM(hang5_cost),0) as hang5_cost " Query = Query & " ,ISNULL(SUM(hang6_cost),0) as hang6_cost " Query = Query & " ,ISNULL(SUM(hang7_cost),0) as hang7_cost " Query = Query & " ,ISNULL(SUM(hang8_cost),0) as hang8_cost " Query = Query & " ,ISNULL(SUM(hang9_cost),0) as hang9_cost " Query = Query & " ,ISNULL(SUM(hang1_use_cost),0) as hang1_use_cost " Query = Query & " ,ISNULL(SUM(hang2_use_cost),0) as hang2_use_cost " Query = Query & " ,ISNULL(SUM(hang3_use_cost),0) as hang3_use_cost " Query = Query & " ,ISNULL(SUM(hang4_use_cost),0) as hang4_use_cost " Query = Query & " ,ISNULL(SUM(hang5_use_cost),0) as hang5_use_cost " Query = Query & " ,ISNULL(SUM(hang6_use_cost),0) as hang6_use_cost " Query = Query & " ,ISNULL(SUM(hang7_use_cost),0) as hang7_use_cost " Query = Query & " ,ISNULL(SUM(hang8_use_cost),0) as hang8_use_cost " Query = Query & " ,ISNULL(SUM(hang9_use_cost),0) as hang9_use_cost " Query = Query & " from( " END IF Query = Query & " SELECT GCE.depart_nm, GCE.depart_cd, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대' THEN VGC.cost ELSE 0 END), 0) AS hang1_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '교통비' THEN VGC.cost ELSE 0 END), 0) AS hang2_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비' THEN VGC.cost ELSE 0 END), 0) AS hang3_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '물품구입비' THEN VGC.cost ELSE 0 END), 0) AS hang4_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '주차비' THEN VGC.cost ELSE 0 END), 0) AS hang5_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '기타' THEN VGC.cost ELSE 0 END), 0) AS hang6_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대 및 교통비' THEN VGC.cost ELSE 0 END), 0) AS hang7_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비 및 기타' THEN VGC.cost ELSE 0 END), 0) AS hang8_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '활동비' THEN VGC.cost ELSE 0 END), 0) AS hang9_use_cost " Query = Query & " FROM GROUP_COST_EST GCE LEFT JOIN V_GROUP_COST_NEW VGC " Query = Query & " ON VGC.d_code IN ( " Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S301' ELSE GCE.depart_cd END, " Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S401' ELSE GCE.depart_cd END, " Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S501' ELSE GCE.depart_cd END, " Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S601' ELSE GCE.depart_cd END " Query = Query & " ) " Query = Query & " AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date " Query = Query & " WHERE use_yn = '1' " '박준성 2023-05-02 파트너들 한도 추가 If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then Query = Query & " AND GCE.partner_no = '" & Session("User_Number") & "' " Else If Session("N_depart") = "S" And (Session("N_team") = "301" Or Session("N_team") = "401" Or Session("N_team") = "501" Or Session("N_team") = "601") Then Query = Query & " AND GCE.depart_cd = 'S801' " ElseIf Session("N_depart") = "S" And (Session("N_team") = "101" Or Session("N_team") = "201") Then Query = Query & " AND GCE.depart_cd = 'S101S201' " Else Query = Query & " AND GCE.depart_cd = '" & Session("N_depart") & Session("N_team") & "' " END IF End If Query = Query & " AND '" & now_month & "-01' BETWEEN GCE.st_date AND GCE.ed_date " Query = Query & " GROUP BY GCE.depart_nm, GCE.depart_cd, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost " '2023-05-15 서성완 파트너는 관리하는 팀 그룹비 & 사용내역 제공 (단 그룹비는 2개 팀 이상일 경우 합산해서 제공) If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then Query = Query & " ) GROUP_COST " END IF 'Response.Write Query adoRs.open Query, adoconn,adopenstatic, adlockreadonly if adoRs.recordCount > 0 Then If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then depart_cd_string = adoRs("depart_cd_string") END IF total_est = adoRs("hang1_cost") + adoRs("hang2_cost") + adoRs("hang3_cost") + adoRs("hang4_cost") + adoRs("hang5_cost") + adoRs("hang6_cost") + adoRs("hang7_cost") + adoRs("hang8_cost") total_use = adoRs("hang1_use_cost") + adoRs("hang2_use_cost") + adoRs("hang3_use_cost") + adoRs("hang4_use_cost") + adoRs("hang5_use_cost") + adoRs("hang6_use_cost") + adoRs("hang7_use_cost") + adoRs("hang8_use_cost") total_res = total_est - total_use hang1_res_cost = adoRs("hang1_cost") - adoRs("hang1_use_cost") hang2_res_cost = adoRs("hang2_cost") - adoRs("hang2_use_cost") hang3_res_cost = adoRs("hang3_cost") - adoRs("hang3_use_cost") hang4_res_cost = adoRs("hang4_cost") - adoRs("hang4_use_cost") hang5_res_cost = adoRs("hang5_cost") - adoRs("hang5_use_cost") hang6_res_cost = adoRs("hang6_cost") - adoRs("hang6_use_cost") hang7_res_cost = adoRs("hang7_cost") - adoRs("hang7_use_cost") hang8_res_cost = adoRs("hang8_cost") - adoRs("hang8_use_cost") hang9_res_cost = adoRs("hang9_cost") - adoRs("hang9_use_cost") %> <% End if adoRs.close %>
<%=now_month %> 구분 식대 및 교통비 회식비 및 기타 합계
<% if Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR session("Depart_Code") <> "0" OR Session("N_Depart") = "E" then %>
<% end if %>
예산 " readonly /> " readonly />
사용 " readonly /> " readonly />
잔여
<%If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then %> <% Dim total_est2, total_use2, total_res2 Dim hang1_res_cost2, hang2_res_cost2, hang3_res_cost2, hang4_res_cost2, hang5_res_cost2, hang6_res_cost2, hang7_res_cost2, hang8_res_cost2 total_est2 = 0 total_use2 = 0 total_res2 = 0 over_hang = "" Query = "" Query = Query & " SELECT GCE.depart_nm, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대' THEN VGC.cost ELSE 0 END), 0) AS hang1_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '교통비' THEN VGC.cost ELSE 0 END), 0) AS hang2_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비' THEN VGC.cost ELSE 0 END), 0) AS hang3_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '물품구입비' THEN VGC.cost ELSE 0 END), 0) AS hang4_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '주차비' THEN VGC.cost ELSE 0 END), 0) AS hang5_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '기타' THEN VGC.cost ELSE 0 END), 0) AS hang6_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대 및 교통비' THEN VGC.cost ELSE 0 END), 0) AS hang7_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비 및 기타' THEN VGC.cost ELSE 0 END), 0) AS hang8_use_cost, " Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '활동비' THEN VGC.cost ELSE 0 END), 0) AS hang9_use_cost " Query = Query & " FROM GROUP_COST_EST GCE LEFT JOIN V_GROUP_COST_NEW VGC " IF Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" THEN Query = Query & " ON VGC.d_code = 'E101' AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date " END IF 'IF Session("User_Number") = "20000201" OR Session("User_Number") = "20160205" THEN '박준성 2023-05-02 원성훈 부사장님은 특별취급 E102로 고정 ' Query = Query & " ON VGC.d_code = 'E101' AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date " 'ELSE ' Query = Query & " ON CHARINDEX(VGC.d_code, GCE.depart_cd) > 0 AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date " 'END IF Query = Query & " AND VGC.p_no = '" & Session("User_Number") & "' " Query = Query & " WHERE use_yn = '1' " Query = Query & " AND GCE.depart_cd='" & Session("User_Number") & "'" Query = Query & " AND '" & now_month & "-01' BETWEEN GCE.st_date AND GCE.ed_date " Query = Query & " GROUP BY GCE.depart_nm, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost " 'Response.Write Query adoRs.open Query, adoconn,adopenstatic, adlockreadonly if adoRs.recordCount > 0 Then 'total_est2 = adoRs("hang1_cost") + adoRs("hang2_cost") + adoRs("hang3_cost") + adoRs("hang4_cost") + adoRs("hang5_cost") + adoRs("hang6_cost") + adoRs("hang7_cost") + adoRs("hang8_cost") 'total_use2 = adoRs("hang1_use_cost") + adoRs("hang2_use_cost") + adoRs("hang3_use_cost") + adoRs("hang4_use_cost") + adoRs("hang5_use_cost") + adoRs("hang6_use_cost") + adoRs("hang7_use_cost") + adoRs("hang8_use_cost") total_est2 = adoRs("hang9_cost") total_use2 = adoRs("hang9_use_cost") total_res2 = total_est2 - total_use2 'hang1_res_cost2 = adoRs("hang1_cost") - adoRs("hang1_use_cost") 'hang2_res_cost2 = adoRs("hang2_cost") - adoRs("hang2_use_cost") 'hang3_res_cost2 = adoRs("hang3_cost") - adoRs("hang3_use_cost") 'hang4_res_cost2 = adoRs("hang4_cost") - adoRs("hang4_use_cost") 'hang5_res_cost2 = adoRs("hang5_cost") - adoRs("hang5_use_cost") 'hang6_res_cost2 = adoRs("hang6_cost") - adoRs("hang6_use_cost") 'hang7_res_cost2 = adoRs("hang7_cost") - adoRs("hang7_use_cost") 'hang8_res_cost2 = adoRs("hang8_cost") - adoRs("hang8_use_cost") hang9_res_cost2 = adoRs("hang9_cost") - adoRs("hang9_use_cost") hang9_res_cost = adoRs("hang9_cost") - adoRs("hang9_use_cost") %> <% End if adoRs.close %>
<%=now_month %> 구분 활동비 합계
본부장
활동비 <% if Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR session("Depart_Code") <> "0" then %>
<% end if %>
사용 " readonly />
잔여
<% End if%>
증빙일자 프로젝트 항목 세부항목 금액
<% if sel_date <> "" Then %> <%=sel_date %> <% else %> <% End if %>
합 계
<% dim timeQuery, prjQuery, prevSaveQuery, foodQuery, preCostQuery, preGroupfeeQuery prjQuery = "" prjQuery = prjQuery & " SELECT VPM.p_child_sn, p_subject, CASE WHEN JP.p_child_sn IS NOT NULL THEN '1' ELSE '0' END AS user_sel " prjQuery = prjQuery & " FROM V_PROJECT_METHOD VPM LEFT JOIN " prjQuery = prjQuery & " (SELECT DISTINCT p_child_sn, p_user FROM Job_ProjectList) JP " prjQuery = prjQuery & " ON VPM.p_child_sn = JP.p_child_sn AND JP.p_user = '" & Session("User_Number") & "' " prjQuery = prjQuery & " WHERE ISNULL(VPM.p_child_sn, '') > '" & RIGHT(cstr(year(date)-2), 2) & "' " prjQuery = prjQuery & " AND (p_research_complete IS NULL OR p_field_complete IS NULL OR p_dp_complete IS NULL) " prjQuery = prjQuery & " AND VPM.p_progress_status > '001' " prjQuery = prjQuery & " ORDER BY VPM.p_child_sn " preGroupfeeQuery = "" preGroupfeeQuery = preGroupfeeQuery & " SELECT d_no, hangmok, gubun, cost_date, txt_pjt , txt_hangmok, contents, cost " preGroupfeeQuery = preGroupfeeQuery & " ,depart, depart_cd, write_name " preGroupfeeQuery = preGroupfeeQuery & " FROM V_GROUP_COST_NEW " preGroupfeeQuery = preGroupfeeQuery & " where 1=1 " preGroupfeeQuery = preGroupfeeQuery & " AND left(cost_date,7) = '" & now_month & "' " '//-- 20220630 hwkim if session("Depart_Code") = "18" then '//-- 경영문화본부 & 데이터솔루션 팀 구분 if session("job_code") = "08" then preGroupfeeQuery = preGroupfeeQuery & " and depart_cd = '18' and p_job_part = '08'" else preGroupfeeQuery = preGroupfeeQuery & " and depart_cd = '18' and p_job_part <> '08' " end if Elseif depart_cd_string <> "" then ' 2023-05-15 박준성 파트너들이 각 그룹의 사용내역 볼 수 있게 변경 자기의 사용내역은 못 봄 preGroupfeeQuery = preGroupfeeQuery & " and d_code in (" & depart_cd_string & ") " Elseif Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR session("Depart_Code") = "0" then preGroupfeeQuery = preGroupfeeQuery & " and p_no = '" & session("User_Number") & "' " 'Elseif session("Depart_Code") = "17" Or session("Depart_Code") = "19" Then ' preGroupfeeQuery = preGroupfeeQuery & " and (depart_cd = '17' OR (depart_cd = '18' and p_job_part = '08') OR depart_cd = '19') " Else preGroupfeeQuery = preGroupfeeQuery & " and depart_cd = '" & session("Depart_Code") & "' " end if preGroupfeeQuery = preGroupfeeQuery & " order by cost_date asc " 'response.write preGroupfeeQuery %>