99 lines
4.8 KiB
Plaintext
99 lines
4.8 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
|
|
<%@ page import="java.util.*"%>
|
|
<%@ page import="java.io.*"%>
|
|
<%@ page import="com.oreilly.servlet.MultipartRequest" %>
|
|
<%@ page import="com.oreilly.servlet.multipart.DefaultFileRenamePolicy" %>
|
|
<%@include file="/include/db/db_connect.jsp"%>
|
|
<%@include file="/include/function/function.jsp"%>
|
|
<%request.setCharacterEncoding("utf-8");%>
|
|
<%
|
|
String show_no = r_call(request.getParameter("show_no"));
|
|
String check_no = r_call(request.getParameter("check_no"));
|
|
String c_relation = r_call(request.getParameter("c_relation"));
|
|
String c_relation2 = r_call(request.getParameter("c_relation2"));
|
|
String c_home = r_call(request.getParameter("c_home"));
|
|
String c_survey_no = r_call(request.getParameter("c_survey_no"));
|
|
String c_survey_project_no = r_call(request.getParameter("c_survey_project_no"));
|
|
String c_target_no = r_call(request.getParameter("c_target_no"));
|
|
String c_project_no = r_call(request.getParameter("c_project_no"));
|
|
|
|
String sql_r = " select c_now from tbl_survey_target where c_no = " + c_target_no;
|
|
ResultSet rs_r = stmt.executeQuery(sql_r);
|
|
if(rs_r.next()){
|
|
|
|
if(rs_r.getInt("c_now") == 0){
|
|
|
|
String sql_init = " update tbl_survey_target set c_now = 1, c_answer_date = now() where c_no = " + c_target_no;
|
|
stmt2.execute(sql_init);
|
|
|
|
int t1 = 0;
|
|
String sql_sr=" SELECT * from tbl_survey_problem where c_survey_no = " + c_survey_no + " and c_up_no = 0 and c_use=0 order by c_order asc";
|
|
ResultSet rs_sr = stmt.executeQuery(sql_sr);
|
|
while (rs_sr.next()) {
|
|
String sql_sr2=" SELECT * from tbl_survey_problem where c_survey_no = " + c_survey_no + " and c_up_no = "+ rs_sr.getInt("c_no") +" and c_use=0 order by c_order asc";
|
|
ResultSet rs_sr2 = stmt.executeQuery(sql_sr2);
|
|
while (rs_sr2.next()) {
|
|
if(rs_sr2.getInt("c_type") < 2 ) {
|
|
if(rs_sr2.getInt("c_type") == 0 ) {
|
|
if( !r_call(request.getParameter("p_" + rs_sr2.getInt("c_no"))).equals("")){
|
|
String call_p = r_call(request.getParameter("p_" + rs_sr2.getInt("c_no")));
|
|
String i_t = "";
|
|
String sql_sr3=" SELECT * from tbl_survey_answer where c_survey_no = " + c_survey_no + " and c_problem_no = "+ rs_sr2.getInt("c_no") +" and c_use=0 and c_no = "+ call_p +" order by c_order asc";
|
|
ResultSet rs_sr3 = stmt.executeQuery(sql_sr3);
|
|
if (rs_sr3.next()) {
|
|
if(rs_sr3.getInt("c_type") == 1){
|
|
i_t = r_call(request.getParameter("t_" + rs_sr2.getInt("c_no") + "_" + rs_sr3.getInt("c_no")));
|
|
}
|
|
}
|
|
rs_sr3.close();
|
|
|
|
String sql_in = "insert into tbl_survey_result ( c_project_no, c_survey_no, c_survey_project_no, c_target_no, c_problem_no, c_answer_no, c_text ) values (";
|
|
sql_in = sql_in + " " + c_project_no + "," + c_survey_no + "," + c_survey_project_no + "," + c_target_no + "," + rs_sr2.getInt("c_no") + "," + call_p + ",'" + i_t + "')";
|
|
stmt2.execute(sql_in);
|
|
}
|
|
}
|
|
if(rs_sr2.getInt("c_type") == 1 ) {
|
|
String sql_sr3=" SELECT * from tbl_survey_answer where c_survey_no = " + c_survey_no + " and c_problem_no = "+ rs_sr2.getInt("c_no") +" and c_use=0 order by c_order asc";
|
|
ResultSet rs_sr3 = stmt.executeQuery(sql_sr3);
|
|
while (rs_sr3.next()) {
|
|
t1 = t1 + 1;
|
|
if( r_call(request.getParameter("p_" + rs_sr2.getInt("c_no") + "_" + rs_sr3.getInt("c_no"))).equals("1")){
|
|
String i_t = "";
|
|
if(rs_sr3.getInt("c_type") == 1){
|
|
i_t = r_call(request.getParameter("t_" + rs_sr2.getInt("c_no") + "_" + rs_sr3.getInt("c_no")));
|
|
}
|
|
String sql_in = "insert into tbl_survey_result ( c_project_no, c_survey_no, c_survey_project_no, c_target_no, c_problem_no, c_answer_no, c_text ) values (";
|
|
sql_in = sql_in + " " + c_project_no + "," + c_survey_no + "," + c_survey_project_no + "," + c_target_no + "," + rs_sr2.getInt("c_no") + "," + rs_sr3.getInt("c_no") + ",'" + i_t + "')";
|
|
stmt2.execute(sql_in);
|
|
}
|
|
}
|
|
rs_sr3.close();
|
|
}
|
|
}else{
|
|
t1 = t1 + 1;
|
|
if( !r_call(request.getParameter("p_" + rs_sr2.getInt("c_no") )).equals("")){
|
|
String sql_in = "insert into tbl_survey_result ( c_project_no, c_survey_no, c_survey_project_no, c_target_no, c_problem_no, c_answer_no, c_text ) values (";
|
|
sql_in = sql_in + " " + c_project_no + "," + c_survey_no + "," + c_survey_project_no + "," + c_target_no + "," + rs_sr2.getInt("c_no") + ",0,'" + r_call(request.getParameter("p_" + rs_sr2.getInt("c_no") )) + "')";
|
|
stmt2.execute(sql_in);
|
|
}
|
|
}
|
|
}
|
|
rs_sr2.close();
|
|
}
|
|
rs_sr.close();
|
|
|
|
%>
|
|
<script>
|
|
alert("Thanks for participating.")
|
|
parent.location.href="list.jsp?show_no=<%=show_no%>&check_no=<%=check_no%>&c_relation=<%=c_relation%>&c_relation2=<%=c_relation2%>";
|
|
</script>
|
|
|
|
<%
|
|
}else{
|
|
|
|
}
|
|
}
|
|
rs_r.close();
|
|
%>
|
|
<%@include file="/include/db/db_close.jsp"%>
|