DUT001.inc 10.2 KB
<script type="text/javascript" src="xmlhttp.js"></script>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
var SFlg = false;							//サブミットフラグを定義

function DoubleSubmit(){			//ダブルサブミットチェック関数
		if (SFlg){								//ダブルサブミットの場合
				alert("応答中です");	//メッセージを出力
				return false;
		}
		SFlg = true;							//サブミットフラグを設定
		return true;							//戻り値を設定
}

function dut_info(strDate){

		cal1 = new JKL.Calendar("calid","e_gru","colname");
		cal2 = new JKL.Calendar("calid2","e_gru","colname2");
		cal3 = new JKL.Calendar("calid3","e_gru","colname3");

		if(document.getElementById("dutinp").innerHTML !=""){
				document.getElementById("dutinp").innerHTML = "";
		}
		loadHTMLFile_SUB_info("DUT001-1.php?strwkdate="+strDate);
}

function loadHTMLFile_SUB_info(fName){
		httpObj2 = createXMLHttpRequest(displayData_info);
		if (httpObj2)
		{
				httpObj2.open(Get_BName(),fName,true);
				httpObj2.send(null);
		}
}

function displayData_info(){
		if ((httpObj2.readyState == 4) && (httpObj2.status == 200)){
				document.getElementById("dutdata").innerHTML = httpObj2.responseText;
		}else{
				document.getElementById("dutdata").innerHTML = "<b>Loading...</b>";
		}
}

function dut_inp(strDate,intTouban,intsts){
		cal1 = new JKL.Calendar("calid","e_gru","colname");
		cal2 = new JKL.Calendar("calid2","e_gru","colname2");
		cal3 = new JKL.Calendar("calid3","e_gru","colname3");

		//if(document.getElementById("dutinp").innerHTML !=""){
				document.getElementById("dutinp").innerHTML = "";
		//}else{
				loadHTMLFile_SUB("DUT002.php?strwkdate="+strDate+"&intTouban="+intTouban+"&intsts="+intsts);
		//}
}

function disp_off(){
		if(document.getElementById("dutinp").innerHTML !=""){
				document.getElementById("dutinp").innerHTML = "";
		}
}

function getDate(){
		document.e_gru.strwkdate.value=document.e_gru.main_year.value+document.e_gru.main_mon.value+"01";
		dut_info(document.e_gru.strwkdate.value) ;
}

function add(intTouban,intsts,intaddsts){
		var strsel;
		var stradd;
		var inti;
		var intchk;
		var intPt;
		var strArray = new Array();
		var intflg=0;
		document.e_gru.intTouban.value=intTouban;
		document.e_gru.intsts.value=intsts;
		document.e_gru.intaddsts.value=intaddsts;

		//社員追加
		if (intaddsts==1){
				inti=document.e_gru.syain_add.length-1;
				for(i=0;i<document.e_gru.syain_list.length;i++){
						if(document.e_gru.syain_list.options[i].selected){
								//データ存在チェック
								for(intchk=0;intchk<document.e_gru.syain_add.length;intchk++){
										if (document.e_gru.syain_list.options[i].value==document.e_gru.syain_add.options[intchk].value){
												intflg=1;
												break;
										}
								}
								
								//配信リスト設定
								if (intflg==0){
										document.e_gru.syain_add.options[inti]=new Option(document.e_gru.syain_list.options[i].text,document.e_gru.syain_list.options[i].value);
										inti=inti+1;
								}
								intflg=0;
						}
				}
				//最終行空文字
				document.e_gru.syain_add.options[inti]=new Option("      ","");
		}else{
			//社員削除
				inti=0;
				for(i=0;i<document.e_gru.syain_add.length;i++){
						if(document.e_gru.syain_add.options[i].selected){
								strArray[inti]=document.e_gru.syain_add.options[i].value;
								inti=inti+1;
						}
				}

				for(i=0;i<strArray.length;i++){
						for(intchk=0;intchk<document.e_gru.syain_add.length;intchk++){
								if (strArray[i]==document.e_gru.syain_add.options[intchk].value){
										if (document.e_gru.syain_add.options[intchk].value!=""){
											document.e_gru.syain_add.options[intchk]=null;
											break;
										}
								}
						}
				}
		}
}

function submit_inp(intsts,intTouban){
	var stradd;

	if (date_chk(document.e_gru.st_year.value,document.e_gru.st_mon.value,document.e_gru.st_day.value)==false) {
			document.e_gru.st_year.focus();
			return false;
	}
	if (date_chk(document.e_gru.ed_year.value,document.e_gru.ed_mon.value,document.e_gru.ed_day.value)==false) {
		document.e_gru.ed_year.focus();
		return false;
	}
	
	st_date=document.e_gru.st_year.value+document.e_gru.st_mon.value+document.e_gru.st_day.value;
	ed_date=document.e_gru.ed_year.value+document.e_gru.ed_mon.value+document.e_gru.ed_day.value;
	if (st_date >ed_date){
		alert("日付を正しく選択してください");
		document.e_gru.st_year.focus();
		return false;
	}

	if ((document.e_gru.st_hour.value=="") && (document.e_gru.st_minute.value!="")) {
			alert("時間を正しく選択してください");
			document.e_gru.st_hour.focus();
			return false;
	}
	if ((document.e_gru.ed_hour.value=="") && (document.e_gru.ed_minute.value!="")) {
			alert("時間を正しく選択してください");
			document.e_gru.ed_hour.focus();
			return false;
	}
	if ((document.e_gru.st_hour.value=="") && (document.e_gru.ed_hour.value!="")){
			alert("時間を正しく選択してください");
			document.e_gru.st_hour.focus();
			return false;
	}

	if ((document.e_gru.ed_hour.value!="") && (document.e_gru.ed_hour.value!="")){
		if(document.e_gru.st_hour.value+document.e_gru.st_minute.value > document.e_gru.ed_hour.value+document.e_gru.ed_minute.value){
				alert("時間を正しく選択してください");
				document.e_gru.st_hour.focus();
				return false;
		}
	}
			
	if (script_chk("担当内容",document.e_gru.contents.value)==false) {
		document.e_gru.contents.focus();
		return false;
	}

	stradd="";
	for (i=0; i<document.e_gru.syain_add.options.length; i++){ 
		stradd = stradd+document.e_gru.syain_add.options[i].value+"/";
	}
	if (stradd == "/"){
		alert("担当者を1人以上選択してください");
		return false;
	}
//	if (DoubleSubmit()) {
//		document.e_gru.intsts.value=intsts;
//		document.e_gru.intTouban.value=intTouban;
//		document.e_gru.strsel.value=stradd;
//		document.e_gru.intsyorists.value=1;
//		document.e_gru.action="DUT004.php";
//		document.e_gru.method="POST";
//		document.e_gru.submit();
//		return false;
//	}
//20081006 GET→POST修正
		prm = "intsts="+intsts+"&intTouban="+intTouban+"&strsel=" + stradd + "&intsyorists=1";
		prm += "&st_year="+document.e_gru.st_year.value;
		prm += "&st_mon="+document.e_gru.st_mon.value;
		prm += "&st_day="+document.e_gru.st_day.value;
		prm += "&ed_year="+document.e_gru.ed_year.value;
		prm += "&ed_mon="+document.e_gru.ed_mon.value;
		prm += "&ed_day="+document.e_gru.ed_day.value;
		prm += "&st_hour="+document.e_gru.st_hour.value;
		prm += "&st_minute="+document.e_gru.st_minute.value;
		prm += "&ed_hour="+document.e_gru.ed_hour.value;
		prm += "&ed_minute="+document.e_gru.ed_minute.value;
		prm += "&contents="+encodeURIComponent(document.e_gru.contents.value)+" ";
		prm += "&syain_add="+document.e_gru.syain_add.value;
		prm += "&syain_list="+document.e_gru.syain_list.value;
//		prm += "&="+document.e_gru..value
//		prm += "&="+document.e_gru..value
//		prm += "&="+document.e_gru..value
//		prm += "&="+document.e_gru..value
//		prm += "&="+document.e_gru..value
//		prm += "&="+document.e_gru..value

//		loadHTMLFile("DUT004.php?intsts="+intsts+"&intTouban="+intTouban+"&strsel="+stradd+"&intsyorists=1"+prm);
		loadHTMLFile_Data("DUT004.php",prm);

//		function loadHTMLFile(fName){
		function loadHTMLFile_Data(fName,prm){
			httpObj = createXMLHttpRequest(displayData);
			if (httpObj){
						//httpObj.open(Get_BName(),fName,true);
						//httpObj.send(null);
						httpObj.open("POST",fName,true);
						httpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
						httpObj.send(prm);

			}
		}

		function displayData()
		{
			if ((httpObj.readyState == 4) && (httpObj.status == 200))
			{
				dut_info(document.e_gru.strwkdate.value);
			}else{
				document.getElementById("dutinp").innerHTML = "<b>Loading...</b>";
			}
		}
}

function submit_del(intsts){
		loadHTMLFile_SUB("DUT003.php?intsts="+intsts);
}

function loadHTMLFile_SUB(fName){
		httpObj2 = createXMLHttpRequest(displayData2);
		if (httpObj2)
		{
			httpObj2.open(Get_BName(),fName,true);
			httpObj2.send(null);
		}
}

function displayData2(){
		if ((httpObj2.readyState == 4) && (httpObj2.status == 200)){
				document.getElementById("dutinp").innerHTML = httpObj2.responseText;
		}else{
				document.getElementById("dutinp").innerHTML = "<b>Loading...</b>";
		}
}

function del(intsts){
		prm = "intsts="+intsts+"&intsyorists=2";
		//loadHTMLFile("DUT004.php?intsts="+intsts+"&intsyorists=2");
		loadHTMLFile_Data("DUT004.php",prm);

		//function loadHTMLFile(fName){
		function loadHTMLFile_Data(fName,prm){
				httpObj = createXMLHttpRequest(displayData);
				if (httpObj){
					//httpObj.open(Get_BName(),fName,true);
					//httpObj.send(null);
					httpObj.open("POST",fName,true);
					httpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					httpObj.send(prm);
				}
		}
		function displayData(){
				if ((httpObj.readyState == 4) && (httpObj.status == 200)){
						dut_info(document.e_gru.strwkdate.value);
				}else{
						document.getElementById("dutinp").innerHTML = "<b>Loading...</b>";
				}
		}
}

function cal_get(strDate, divid){
		arrYMD = strDate.split("/");

		if(divid == "calid"){
				objY = document.e_gru.main_year;
				objM = document.e_gru.main_mon;
		}else if(divid == "calid2"){
				objY = document.e_gru.st_year;
				objM = document.e_gru.st_mon;
				objD = document.e_gru.st_day;
		}else if(divid == "calid3"){
				objY = document.e_gru.ed_year;
				objM = document.e_gru.ed_mon;
				objD = document.e_gru.ed_day;
		}
		//年
		for(i=0;i<objY.options.length;i++){
				if(objY.options[i].value == arrYMD[0]){
						objY.selectedIndex = i;
						break;
				}
		}
		//月
		for(i=0;i<objM.options.length;i++){
				if(objM.options[i].value == arrYMD[1]){
						objM.selectedIndex = i;
						break;
				}
		}
		if(divid == "calid"){
				//document.e_gru.strkijyunDate.value = arrYMD[0]+arrYMD[1]+arrYMD[2];
				loadHTMLFile_SUB_info("DUT001-1.php?strwkdate="+arrYMD[0]+arrYMD[1]+arrYMD[2]);
		}else{
				//日
				for(i=0;i<objD.options.length;i++){
						if(objD.options[i].value == arrYMD[2]){
								objD.selectedIndex = i;
								break;
						}
			}
		}
		cal1 = new JKL.Calendar("calid","e_gru","colname");
		cal2 = new JKL.Calendar("calid2","e_gru","colname2");
		cal3 = new JKL.Calendar("calid3","e_gru","colname3");
}

-->
</SCRIPT>

<script>
var cal1 = new JKL.Calendar("calid","e_gru","colname");
var cal2 = new JKL.Calendar("calid2","e_gru","colname2");
var cal3 = new JKL.Calendar("calid3","e_gru","colname3");
</script>