TOP021.php 4.73 KB
<?php 
//*****************************************************************************
//* 
//* プログラム名:簡易在席一覧
//* プログラムID:TOP021.php
//* 機能        :
//* 作成者      :
//* 
//*****************************************************************************
include("include/session_start.inc");
include("include/SessionChk.inc");
include("include/STRING.inc");

$strDBinc="include/dbcon.inc";
include($strDBinc);

$strSQL="SELECT syain_cd,name_kj_sei,name_kj_mei FROM syain_tbl Where del_flg=true Order by disp_rank";
$objRec = pg_exec($strSQL);
if($objRec==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
for ($intCnt = 0; $intCnt < pg_numrows($objRec) ; $intCnt++){
		$objData = pg_fetch_object($objRec, $intCnt);
		$strSyain[$intCnt][0] = $objData->name_kj_sei." ".$objData->name_kj_mei;

		$strSyain[$intCnt][1]="未設定";
		$strSQL = "SELECT * FROM kojin_data_tbl WHERE seq = 16 AND syain_cd ='".$objData->syain_cd."'";
		$objState = pg_exec($strSQL);
		if($objState == false){
				echo("SQL実行に失敗しました(SELECR)");
				exit;
		}
/*
		if(pg_numrows($objState) > 0){
				$objStateData = pg_fetch_object($objState,0);
				switch ($objStateData->memo) {
				case "0":
					$strSyain[$intCnt][1]="未設定";
					break;
				case "1":
					$strSyain[$intCnt][1]="<font color=#ff0000><b>不在</b></font>";
					break;
				case "2":
					$strSyain[$intCnt][1]="<font color=#0000ff>在席</font>";
					break;
				case "3":
					$strSyain[$intCnt][1]="<font color=#00ff00>一時退席</font>";
					break;
				}
		}
*/
		$strSyain[$intCnt][2]="";

		if(pg_numrows($objState) > 0){

				//20100427
				$objStateData = pg_fetch_object($objState,0);
				$inttemp = (int)$objStateData->memo;

				$strCHK = "";
				$strSQL2 = "SELECT * FROM mst_common_word Where seq = $inttemp And type = 1 order by seq";
				$rsRecset2 = pg_exec($pg_con,$strSQL2);
				if($rsRecset2==false){
				echo("SQL実行に失敗しました(SELECT)");
				exit;
				}

			if(pg_numrows($rsRecset2) > 0){

					$zaiseki_name=pg_result($rsRecset2,0,"memo1");
					$collar=(int)pg_result($rsRecset2,0,"memo2");

					$strSQL3 = "SELECT * FROM mst_common_word Where seq = $collar And type = 2 order by seq";
					$rsRecset3 = pg_exec($pg_con,$strSQL3);
					if($rsRecset3==false){
					echo("SQL実行に失敗しました(SELECT)");
					exit;
					}

					$zaiseki_collar=pg_result($rsRecset3,0,"memo1");

					$strSyain[$intCnt][1]= "<font color='".$zaiseki_collar."'><b>".$zaiseki_name."</b></font>";

					//更新日時
					$strSQL = "SELECT * FROM kojin_data_tbl WHERE seq = 17 AND syain_cd ='".$objData->syain_cd."'";
					$objState = pg_exec($strSQL);
					if($objState == false){
							echo("SQL実行に失敗しました(SELECR)");
							exit;
					}
					if(pg_numrows($objState) > 0){
							$objStateData = pg_fetch_object($objState,0);
							$strSyain[$intCnt][2]=$objStateData->memo;
					}
			}
		}

}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=EUC-JP">
<META http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="basefont.css">
<TITLE>簡易在席一覧</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
	// this page's own script
	function printer(){
			window.print();
	}
-->
</SCRIPT>
</head>
<body>
<form name="zaiseki_lst">
	<div align="center">
	<span class="Normalfont"><b><?php  echo Date("Y/m/d H:i"); ?> </b>現在の在席状況</span>
	<TABLE class="mainColor" width="402" border="0" cellspacing="1" cellpadding="1">
		<tr><td>
			<TABLE width="400" border="0" cellspacing="1" cellpadding="1">
				<TR class="toneDown">
					<TD width="200" height="25" align="center"><span class="Flowfont">名前</span></TD>
					<TD width="100" height="25" align="center"><span class="Flowfont">状態</span></TD>
					<TD width="100" height="25" align="center"><span class="Flowfont">実施日時</span></TD>
				</TR>
				<?php 	for ($intCnt = 0; $intCnt < count($strSyain); $intCnt++) {	?>
					<TR bgcolor ="#ffffff">
							<TD width="200" height="25" align="left"><span class="Flowfont"><?php  echo $strSyain[$intCnt][0]; ?></span></TD>
							<TD width="100" height="25" align="center"><span class="Flowfont"><?php  echo $strSyain[$intCnt][1]; ?></span></TD>
							<TD width="100" height="25" align="center"><span class="Flowfont"><?php  echo $strSyain[$intCnt][2]; ?></span></TD>
					</TR>
				<?php 	}	?>
			</TABLE>
		</td>
		</TR>
	</TABLE>
	<BR>
	<TABLE cellSpacing="0" cellPadding="0" width="400" border="0" class="needless">
		<TR>
			<TD align="center">
				<INPUT TYPE="button" VALUE=" 印刷する " onClick="printer()">  
				<INPUT TYPE="button" VALUE=" 画面更新 " onClick="location.reload()">  
				<INPUT TYPE="button" VALUE=" 閉じる " onClick="window.close()">
			</TD>
		</TR>
	</TABLE>
	</div>
</form>
</body>
</html>