<% Response.CharSet="euc-kr" Response.AddHeader "Pragma","no-cache" Response.AddHeader "cache-control", "no-staff" Response.Expires = -1 Dim Flag : Flag = Request("Flag") Dim Search : Search = unescape(Request("Search")) Dim Depart : Depart = Request("Depart") Dim DivHtml Select case Flag Case "CompanyList" query = "select * from project2.dbo.V_CLIENT_COMP where p_cli_company_nm like '%"&Search&"%' ORDER BY p_cli_company_nm" rsc.Open query, adoConn, 1 DivHtml="" If not rsc.eof Then while not rsc.eof DivHtml =+ DivHtml&"
"&rsc("p_cli_company_nm")&"
" rsc.movenext wend end If rsc.close DivHtml =+ DivHtml&"
" DivHtml =+ DivHtml&" " DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"
" response.write DivHtml case "CompanyPerson" query = "select * from project2.dbo.V_CLIENT_PERSON where p_cli_company_cd = '"&Search&"' ORDER BY p_cli_per_nm " 'response.write query rsc.Open query, adoConn, 1 DivHtml = "" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" If not rsc.eof Then while not rsc.eof DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" rsc.movenext wend end If DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"" DivHtml =+ DivHtml&"
Client부서명
"&rsc("p_cli_per_nm")&""&rsc("p_cli_depart")&"
미정(Click!)
" rsc.close response.write DivHtml case "DetailList" Dim sdate : sdate = Request("sdate") Dim edate : edate = Request("edate") query = "" query = query&" select p_sn, p_subject, a.p_cli_company_cd, b.p_cli_company_nm, a.p_cli_per_cd, c.p_cli_per_nm, "&VbScript query = query&" a.p_client_type_cd, d.p_client_type_nm, p_memo, isnull(p_total_cost,0) p_total_cost, isnull(p_obtain_cost,0) p_obtain_cost, "&VbScript query = query&" p_cont_cost, p_decide_date, convert(varchar(10),a.p_input_dt,23) as p_input_dt, a.p_input_user, e.p_name, "&VbScript query = query&" case p_state "&VbScript query = query&" when 'E' then '검토(가망)' "&VbScript query = query&" when 'K' then '제안' "&VbScript query = query&" when 'D' then '연기' "&VbScript query = query&" when 'X' then '탈락' "&VbScript query = query&" when 'P' then '수주' "&VbScript query = query&" when 'C' then '진행' "&VbScript query = query&" when 'F' then '완료' end p_state, "&VbScript query = query&" p_Depart_N, p_Team_N, f.D_Name, f.T_Name "&VbScript query = query&" from T_PROJECT_BASE a "&VbScript query = query&" left join project2.dbo.V_CLIENT_COMP b on a.p_cli_company_cd=b.p_cli_company_cd "&VbScript query = query&" left join project2.dbo.V_CLIENT_PERSON c on a.p_cli_per_cd=c.p_cli_per_cd and a.p_cli_company_cd=c.p_cli_company_cd "&VbScript query = query&" left join project2.dbo.T_CLIENT_TYPE_CD d on a.p_client_type_cd=d.p_client_type_cd "&VbScript query = query&" left join project2.dbo.V_Person e on a.p_input_user = e.p_no "&VbScript query = query&" left join project2.dbo.v_Department f on a.p_Depart_N+a.p_Team_N=f.Code "&VbScript If sdate = "" Then query = query&" where convert(varchar(7),a.p_input_dt,23)='"&Year(Now())&"-0"&Month(Now())&"' "&Vbscript Else query = query&" where a.p_input_dt between '"&sdate&"' and '"&edate&"'"&VbScript End If query = query&" order by p_sn desc "&VbScript 'response.write query rsc.Open query, adoConn, 1 set json = jsObject() Redim data(rsc.recordcount-1) iCnt = 0 if not rsc.eof then while not rsc.eof set Contact = jsObject() Contact("p_sn") = rsc("p_sn") Contact("p_subject") = rsc("p_subject") Contact("p_state") = rsc("p_state") Contact("p_cli_company_nm") = rsc("p_cli_company_nm") Contact("p_total_cost") = Cdbl(rsc("p_total_cost")) Contact("p_cont_cost") = Cdbl(rsc("p_cont_cost")) Contact("p_name") = rsc("p_name") Contact("p_input_dt") = rsc("p_input_dt") set data(iCnt) = Contact iCnt = iCnt + 1 rsc.movenext wend json("data") = data Else json("data") = "" End If rsc.close response.write toJSON(json) Case "ContactList" sdate = Request("sdate") edate = Request("edate") query = "" query = query &"select * from"&VbCrlf query = query &" ("&VbCrlf query = query &" select"&VbCrlf query = query &" isnull(PCode,'') PCode, isnull(PTeam,'') PTeam, p_sn, p_subject, p_cli_company_nm, '' as p_method, ''as p_sample ,"&VbCrlf query = query &" p_cont_cost, isnull(p_total_cost,0) as p_total_cost, '' as pc_con_cost, '' as sum_est, '' as rate_est, '' as sum_act, '' as rate_act, "&VbCrlf query = query &" '' as r_est, '' as r_act, '' as f_est, '' as f_act, convert(varchar(10), p_decide_date,23) p_decide_date,"&VbCrlf query = query &" '' as p_con_date_st, '' as p_con_date_end, p_state, '' as r_user, '' as f_user, p_input_user, p_name, convert(varchar(10), p_input_dt,23) p_input_dt, '' as p_input_progress, p_project_type_cd from"&VbCrlf query = query &" ("&VbCrlf query = query &" select f.Code as PCode, f.T_Name as PTeam,T.* from"&VbCrlf query = query &" ("&VbCrlf query = query &" select p_sn, p_subject, a.p_cli_company_cd, b.p_cli_company_nm, p_total_cost, p_obtain_cost,"&VbCrlf query = query &" p_cont_cost, p_decide_date, a.p_input_dt, a.p_input_user, e.p_name, a.p_project_type_cd,"&VbCrlf query = query &" case p_state"&VbCrlf query = query &" when 'E' then '검토(가망)'"&VbCrlf query = query &" when 'K' then '제안'"&VbCrlf query = query &" when 'D' then '연기'"&VbCrlf query = query &" when 'X' then '탈락'"&VbCrlf query = query &" when 'P' then '수주'"&VbCrlf query = query &" when 'C' then '진행'"&VbCrlf query = query &" when 'F' then '완료' end p_state,"&VbCrlf query = query &" Case "&VbCrlf query = query &" When p_Depart_N is null then cast(p_depart_dep as varchar)"&VbCrlf query = query &" Else p_Depart_N+p_Team_N"&VbCrlf query = query &" End Team"&VbCrlf query = query &" from project2.dbo.T_PROJECT_BASE a"&VbCrlf query = query &" left join project2.dbo.V_CLIENT_COMP b on a.p_cli_company_cd=b.p_cli_company_cd"&VbCrlf query = query &" left join project2.dbo.V_Person e on a.p_input_user = e.p_no"&VbCrlf query = query &" ) T"&VbCrlf query = query &" left join project2.dbo.v_Department f on T.Team=f.Code or T.Team=f.before_t_cd1"&VbCrlf query = query &" ) as A"&VbCrlf query = query &" union all"&VbCrlf query = query &" "&VbCrlf query = query &" select"&VbCrlf query = query &" isnull(Tcode,'') Tcode, isnull(depart_name,'') depart_name, p_child_sn as p_sn, p_subject, p_cli_company_nm, p_method_nm, isnull(p_sample,'') p_sample, p_cont_cost, p_total_cost, isnull(pc_cont_cost,0) pc_cont_cost,"&VbCrlf query = query &" sum_est, case when pc_cont_cost = 0 or isnull(pc_cont_cost,0) = 0 then 0 else (isnull(sum_est,0)*100)/pc_cont_cost end as rate_est,"&VbCrlf query = query &" sum_act, case when pc_cont_cost = 0 or isnull(pc_cont_cost,0) = 0 then 0 else (isnull(sum_act,0)*100)/pc_cont_cost end as rate_act,"&VbCrlf query = query &" r_est, r_act, f_est, f_act, '', "&VbCrlf query = query &" isnull(p_con_date_st,'') p_con_date_st, isnull(p_con_date_end,'') p_con_date_end, p_state, isnull(r_user, '') as r_user, isnull(f_user, '') as f_user, p_input_user, isnull(p_name,'') p_name, convert(varchar(10), p_input_dt,23) p_input_dt, "&VbCrlf query = query &" CASE WHEN left(p_input_complete, 1) = 'x' THEN '연구 ' ELSE '' END + "&VbCrLf query = query &" CASE WHEN substring(p_input_complete, 2, 1) = 'x' THEN '실사' + "&VbCrLf query = query &" CASE WHEN p_field_dept = '8' THEN "&VbCrLf query = query &" CASE WHEN ISNULL(qc_prog, '') = '' THEN '(QC) ' ELSE '' END "&VbCrLf query = query &" WHEN p_field_dept = '9' THEN "&VbCrLf query = query &" CASE WHEN ISNULL(SV_prog, '') = '' THEN '(SV) ' ELSE '' END "&VbCrLf query = query &" ELSE "&VbCrLf query = query &" CASE WHEN ISNULL(SV_prog, '') = '' THEN "&VbCrLf query = query &" '(SV' + "&VbCrLf query = query &" CASE WHEN ISNULL(qc_prog, '') = '' THEN ', QC) ' ELSE ') ' END "&VbCrLf query = query &" ELSE "&VbCrLf query = query &" CASE WHEN ISNULL(qc_prog, '') = '' THEN '(QC) ' ELSE '' END "&VbCrLf query = query &" END "&VbCrLf query = query &" END "&VbCrLf query = query &" ELSE '' "&VbCrLf query = query &" END + "&VbCrLf query = query &" CASE WHEN left(p_input_complete, 1) = 'x' OR substring(p_input_complete, 2, 1) = 'x' THEN '직접비 미입력' ELSE '' END AS p_input_progress, p_project_type_cd "&VbCrLf query = query &" from"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT p_field_dept, p_is_dept,"&VbCrlf query = query &" TPB.p_Depart_N+TPB.p_Team_N as Tcode,"&VbCrlf query = query &" ISNULL(ISNULL(DRE.depart_name, DFI.depart_name), DDE.depart_name) AS depart_name,"&VbCrlf query = query &" TPM.p_child_sn, TPM.p_subject,"&VbCrlf query = query &" VCC.p_cli_company_nm,"&VbCrlf query = query &" TPM.p_method_cd,"&VbCrlf query = query &" TPMC.p_method_nm,"&VbCrlf query = query &" TPM.p_sample, --표본"&VbCrlf query = query &" TPB.p_cont_cost, --예상계약액"&VbCrlf query = query &" TPB.p_total_cost, --실제계약액"&VbCrlf query = query &" TPM.p_cont_cost as pc_cont_cost, --단위계약"&VbCrlf query = query &" ISNULL(DC.sum_est, 0) AS sum_est, --예상직접비"&VbCrlf query = query &" (ISNULL(DC.sum_act, 0) + ISNULL(MC.marketing_cost, 0) + ISNULL(JC.job_money, 0)) AS sum_act, --집행직접비"&VbCrlf query = query &" ISNULL(DC.sum_act, 0) AS sum_act_tmp,"&VbCrlf query = query &" ISNULL(DC.r_est, 0) AS r_est,"&VbCrlf query = query &" ISNULL(DC.r_act, 0) AS r_act,"&VbCrlf query = query &" ISNULL(DC.f_est, 0) AS f_est,"&VbCrlf query = query &" ISNULL(DC.f_act, 0) AS f_act,"&VbCrlf query = query &" TPM.p_con_date_st,"&VbCrlf query = query &" TPM.p_con_date_end,"&VbCrlf query = query &" TPM.p_progress_status,"&VbCrlf query = query &" TPM.p_input_complete,"&VbCrlf query = query &" DCF.sv_prog,"&VbCrlf query = query &" DCF.qc_prog,"&VbCrlf query = query &" ISNULL(TPM.p_research_complete, 0) AS p_research_complete,"&VbCrlf query = query &" ISNULL(TPM.p_field_complete, 0) AS p_field_complete,"&VbCrlf query = query &" ISNULL(TPM.p_dp_complete, 0) AS p_dp_complete,"&VbCrlf query = query &" TPM.p_sn, RU.p_name as r_user, FU.p_name as f_user, VP.p_name, TPB.p_input_user, TPM.p_input_dt, TPB.p_project_type_cd,"&VbCrlf query = query &" case p_progress_status when '008' then case when p_research_complete='1' and p_field_complete='1' and p_dp_complete='1' then '완료' else '진행' end else '미진행' end p_state"&VbCrlf query = query &" FROM project2.dbo.T_PROJECT_METHOD TPM LEFT JOIN"&VbCrlf query = query &" project2.dbo.T_PROJECT_BASE TPB on TPM.p_sn = TPB.p_sn LEFT JOIN"&VbCrlf query = query &" project2.dbo.T_PROJECT_METHOD_CD TPMC ON TPM.p_method_cd = TPMC.p_method_cd LEFT JOIN"&VbCrlf query = query &" project2.dbo.V_Person VP ON TPB.p_input_user = VP.p_no LEFT JOIN"&VbCrlf query = query &" project2.dbo.V_Person RU ON TPM.p_rsch_1_a = RU.p_no LEFT JOIN"&VbCrlf query = query &" project2.dbo.V_Person FU ON TPM.p_sv_1 = FU.p_no LEFT JOIN"&VbCrlf query = query &" project2.dbo.V_CLIENT_COMP VCC ON TPM.p_cli_company_cd = VCC.p_cli_company_cd LEFT JOIN"&VbCrlf query = query &" project2.dbo.direct_cost_field DCF ON TPM.p_child_sn = DCF.p_child_sn AND DCF.del_yn = 'n' LEFT JOIN"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT DISTINCT LEFT(CASE WHEN D_Code = 'S' AND before_t_cd1 IN (17, 18, 19) THEN '키위서베이' ELSE T_Name END, 8) AS depart_name, "&VbCrlf query = query &" before_t_cd1 AS depart_code "&VbCrlf query = query &" FROM project2.dbo.v_Department"&VbCrlf query = query &" WHERE before_t_cd1 NOT IN ('0', '18')"&VbCrlf query = query &" ) DDE ON TPB.p_depart_dep = DDE.depart_code LEFT JOIN"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT DISTINCT LEFT(T_Name, 8) AS depart_name, before_t_cd1 AS depart_code"&VbCrlf query = query &" FROM project2.dbo.v_Department"&VbCrlf query = query &" WHERE before_t_cd1 NOT IN ('17', '18', '0')"&VbCrlf query = query &" ) DRE ON TPM.p_rsch_dept = DRE.depart_code LEFT JOIN"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT DISTINCT LEFT(T_Name, 8) AS depart_name, before_t_cd1 AS depart_code"&VbCrlf query = query &" FROM project2.dbo.v_Department"&VbCrlf query = query &" WHERE before_t_cd1 NOT IN ('17', '18', '0')"&VbCrlf query = query &" ) DFI ON TPM.p_field_dept = DFI.depart_code LEFT JOIN"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT p_child_sn,"&VbCrlf query = query &" sum(CONVERT(money, est_money)) AS sum_est,"&VbCrlf query = query &" sum(CONVERT(money, act_money)) AS sum_act,"&VbCrlf query = query &" sum(case when cost_type = 'research' then CONVERT(money, est_money) else 0 end) AS r_est,"&VbCrlf query = query &" sum(case when cost_type = 'research' then CONVERT(money, act_money) else 0 end) AS r_act,"&VbCrlf query = query &" sum(case when cost_type = 'field' then CONVERT(money, est_money) else 0 end) AS f_est,"&VbCrlf query = query &" sum(case when cost_type = 'field' then CONVERT(money, act_money) else 0 end) AS f_act"&VbCrlf query = query &" FROM project2.dbo.direct_cost"&VbCrlf query = query &" WHERE p_child_sn > '17' AND del_yes_no = 'no'"&VbCrlf query = query &" GROUP BY p_child_sn"&VbCrlf query = query &" ) DC ON TPM.p_child_sn = DC.p_child_sn LEFT JOIN"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT M.p_sn, SUM(CONVERT(money, REPLACE(CONVERT(varchar(100), M.target6), ',', ''))) AS marketing_cost"&VbCrlf query = query &" FROM project2.dbo.문서내용 M LEFT JOIN project2.dbo.Document D ON M.문서번호 = D.d_no"&VbCrlf query = query &" WHERE M.문서제목 = '접대비보고서' AND M.del_yes_no = 'no'"&VbCrlf query = query &" AND D.d_order_cnt = '77'"&VbCrlf query = query &" GROUP BY M.p_sn"&VbCrlf query = query &" ) MC ON TPM.p_child_sn = MC.p_sn LEFT JOIN"&VbCrlf query = query &" ("&VbCrlf query = query &" SELECT CA.p_sn, SUM(CA.cost_money) AS job_money"&VbCrlf query = query &" FROM project2.dbo.cost_account CA LEFT JOIN project2.dbo.문서내용 M ON CA.d_no = M.문서번호"&VbCrlf query = query &" LEFT JOIN project2.dbo.Document D ON M.문서번호 = D.d_no"&VbCrlf query = query &" WHERE CA.cost_money > 0 AND CA.approval = 'yes'"&VbCrlf query = query &" AND M.del_yes_no = 'no' AND D.d_order_cnt = '77'"&VbCrlf query = query &" GROUP BY CA.p_sn"&VbCrlf query = query &" ) JC ON TPM.p_child_sn = JC.p_sn"&VbCrlf query = query &" where TPM.p_child_sn is not null"&VbCrlf query = query &" ) as A"&VbCrlf query = query &" ) AA"&VbCrlf query = query& " where p_input_dt between '"&sdate&"' and '"&edate&"' and p_state <> '수주'"&VBCrlf if Depart <> "1" Then if session("User_Number") <> "20210801" Then '서강신 if cint(session("Depart_Code")) >= 20 Then query = query & " AND (PCode = '" & Session("N_depart") & Session("N_team") &"' " & vbCrLf ' if session("depart_code") = 64 Then ' query = query & " OR PCode = 'R601' " & vbCrLf ' End IF if session("depart_code") = 63 Then query = query & " OR PCode = 'R602' " & vbCrLf End IF if session("User_Number") = "20200302" Then '안정모 query = query & " OR PCode in ('R701', 'R702') " & vbCrLf End IF query = query & " ) " End if End IF if session("User_Number") = "20000201" Then '원성훈 query = query & " AND PCode in ('R601', 'R602', 'R603','R604','R605','R606') " & vbCrLf End IF if session("User_Number") = "20190601" Then '이혜진 query = query & " AND PCode in ('R701', 'R702', 'R501') " & vbCrLf End IF if session("User_Number") = "20210105" Then '김다슬 query = query & " AND PCode in ('R703', 'R704') " & vbCrLf End IF if session("User_Number") = "20160205" Then '박지훈 'query = query & " and PCode in ('R604','R605','R606', 'A101') " & vbCrLf query = query & " AND PCode in ('R601','R602','R603') " & vbCrLf End IF if session("User_Number") = "20210107" Then '신상욱 'query = query & " and PCode in ('R604','R605','R606', 'A101') " & vbCrLf query = query & " AND PCode in ('R604','R605','R606') " & vbCrLf End IF if session("User_Number") = "20210801" Then '서강신 query = query & " and PCode in ('R900','R903') " & vbCrLf End IF End If query = query&" ORDER BY p_sn"&VbCrlf 'response.write query &" ---------------------------------
" rsc.Open query, adoConn, 1 set json = jsObject() Redim data(rsc.recordcount-1) iCnt = 0 if not rsc.eof then while not rsc.eof set Contact = jsObject() if rsc("PTeam") = "" Then Contact("Team") = "미지정" Else Contact("Team") = rsc("PTeam") End If Contact("p_sn") = rsc("p_sn") Contact("p_subject") = replace(rsc("p_subject"), """", """) Contact("p_cli_company_nm") = rsc("p_cli_company_nm") If rsc("p_method") = "" Then Contact("p_method") = "미지정" Else Contact("p_method") = rsc("p_method") End If Contact("p_sample") = Cdbl(rsc("p_sample")) Contact("p_cont_cost") = Cdbl(rsc("p_cont_cost")) Contact("p_total_cost") = Cdbl(rsc("p_total_cost")) Contact("pc_con_cost") = Cdbl(rsc("pc_con_cost")) Contact("sum_est") = Cdbl(rsc("sum_est")) Contact("rate_est") = Round(Cdbl(rsc("rate_est")),2) Contact("sum_act") = Cdbl(rsc("sum_act")) Contact("rate_act") = Round(Cdbl(rsc("rate_act")),2) Contact("r_est") = Cdbl(rsc("r_est")) Contact("r_act") = Cdbl(rsc("r_act")) Contact("f_est") = Cdbl(rsc("f_est")) Contact("f_act") = Cdbl(rsc("f_act")) Contact("p_decide_date") = rsc("p_decide_date") Contact("p_con_date_st") = rsc("p_con_date_st") Contact("p_con_date_end") = rsc("p_con_date_end") Contact("p_state") = rsc("p_state") Contact("p_project_type_cd") = rsc("p_project_type_cd") If rsc("p_name") = "" then Contact("p_input_user") = "미지정" Else Contact("p_input_user") = rsc("p_name") End If If rsc("r_user") = "" then Contact("r_user") = "미지정" Else Contact("r_user") = rsc("r_user") End If If rsc("f_user") = "" then Contact("f_user") = "미지정" Else Contact("f_user") = rsc("f_user") End If Contact("p_input_dt") = rsc("p_input_dt") Contact("p_input_progress") = rsc("p_input_progress") set data(iCnt) = Contact iCnt = iCnt + 1 rsc.movenext wend json("data") = data Else json("data") = "" End If rsc.close response.write toJSON(json) End Select %>