TIM001.inc 4.73 KB
<script type="text/javascript" src="xmlhttp.js"></script>
<script language="javascript">
function disp_main(){
	prm = "sid="+document.e_gru.syain.value;
	prm += "&y="+document.e_gru.selY.value;
	prm += "&m="+document.e_gru.selM.value;

	document.getElementById("time_base").innerHTML = "";
	loadHTMLFile("TIM002.php", prm);
	function loadHTMLFile(fName, prm){
		httpObj = createXMLHttpRequest(displayData);
		if (httpObj)
		{
			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))
		{
			document.getElementById("time_base").innerHTML = httpObj.responseText;
			document.getElementById("sts").innerHTML = "";
		}else{
			document.getElementById("sts").innerHTML = "<b>Loading...</b>";
		}
	}
}

function chk(pstr){
	prm = "mode=" + pstr;
	prm += "&sid=" + document.e_gru.syain.value;
	prm += "&y="+document.e_gru.selY.value;
	prm += "&m="+document.e_gru.selM.value;
	if(pstr == "999"){ 
		for(i=0;i<document.e_gru.elements["sH[]"].length;i++){
			if(suchi_chk("時間",document.e_gru.elements["sH[]"][i].value) == false){
				return false;
			}
			if(suchi_chk("時間",document.e_gru.elements["sM[]"][i].value) == false){
				return false;
			}
			if(suchi_chk("時間",document.e_gru.elements["eH[]"][i].value) == false){
				return false;
			}
			if(suchi_chk("時間",document.e_gru.elements["eM[]"][i].value) == false){
				return false;
			}
			if(script_chk("備考",document.e_gru.elements["com[]"][i].value) == false){
				return false;
			}
			prm += "&sH[]="+document.e_gru.elements["sH[]"][i].value;
			prm += "&sM[]="+document.e_gru.elements["sM[]"][i].value;
			prm += "&eH[]="+document.e_gru.elements["eH[]"][i].value;
			prm += "&eM[]="+document.e_gru.elements["eM[]"][i].value;
			prm += "&com[]="+encodeURIComponent(document.e_gru.elements["com[]"][i].value);
		}
	}else{
		if(suchi_chk("時間",document.e_gru.elements["sH[]"][pstr-1].value) == false){
			return false;
		}
		if(suchi_chk("時間",document.e_gru.elements["sM[]"][pstr-1].value) == false){
			return false;
		}
		if(suchi_chk("時間",document.e_gru.elements["eH[]"][pstr-1].value) == false){
			return false;
		}
		if(suchi_chk("時間",document.e_gru.elements["eM[]"][pstr-1].value) == false){
			return false;
		}
		if(script_chk("備考",document.e_gru.elements["com[]"][pstr-1].value) == false){
			return false;
		}
		prm += "&sH="+document.e_gru.elements["sH[]"][pstr-1].value;
		prm += "&sM="+document.e_gru.elements["sM[]"][pstr-1].value;
		prm += "&eH="+document.e_gru.elements["eH[]"][pstr-1].value;
		prm += "&eM="+document.e_gru.elements["eM[]"][pstr-1].value;
		prm += "&com="+encodeURIComponent(document.e_gru.elements["com[]"][pstr-1].value);
	}

	//選択と表示が同じかチェック
	if(document.e_gru.syain.value != document.e_gru.disp_sid.value){
		alert("問題が発生したため、更新処理を中断します。\nはじめからやり直してください。");
		disp_main();
		exit;
	}

	loadHTMLFileCHK("TIM900.php", prm);
	function loadHTMLFileCHK(fName, prm){
		httpObjCHK = createXMLHttpRequest(displayDataCHK);
		if (httpObjCHK)
		{
			httpObjCHK.open("POST",fName,true);
			httpObjCHK.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			httpObjCHK.send(prm);
		}
	}
	function displayDataCHK()
	{
		if ((httpObjCHK.readyState == 4) && (httpObjCHK.status == 200))
		{
//alert(httpObjCHK.responseText);
			alert("更新しました");
			document.getElementById("sts").innerHTML = "";
		}else{
			document.getElementById("sts").innerHTML = "<b>Loading...</b>";
		}
	}
}

function chg(flg){
	DD = new Date();
	prm = "flg="+flg;
	loadHTMLFileCHG("TIM901.php", prm);
	function loadHTMLFileCHG(fName, prm){
		httpObjCHG = createXMLHttpRequest(displayDataCHG);
		if (httpObjCHG)
		{
			httpObjCHG.open("POST",fName,true);
			httpObjCHG.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			httpObjCHG.send(prm);
		}
	}
	function displayDataCHG()
	{
		if ((httpObjCHG.readyState == 4) && (httpObjCHG.status == 200))
		{
//alert(httpObjCHG.responseText);
			alert("更新しました");
			disp_main();
			//document.getElementById("sts").innerHTML = "";
		}else{
			document.getElementById("sts").innerHTML = "<b>Loading...</b>";
		}
	}


}

function print_tim() { 
	prm = "?sid="+document.e_gru.syain.value;
	prm += "&y="+document.e_gru.selY.value;
	prm += "&m="+document.e_gru.selM.value;
	window.open("TIM003.php"+prm,null,"width=600,height=800,left=200,top=200,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,favorites=no,resizable=yes");
} 

function csv_tim() { 
	window.open("TIM004.php",null,"width=600,height=600,left=200,top=200,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,favorites=no,resizable=yes");
} 

</script>