TOP900.php 7.64 KB
<?php 
//*****************************************************************************
//* 
//* プログラム名:スケジュール
//* プログラムID:TOP900.php
//* 機能				:CSV出力
//* 作成者			:K.Yoshimrua
//* 
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");

include("include/session_start.inc");
include("include/SessionChk.inc");
include('include/smarty.conf');

$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";
$objData = pg_exec($strSQL);
for($intCnt = 0; $intCnt < pg_numrows($objData) ; $intCnt++) {
		$objRecData = pg_fetch_object($objData, $intCnt);
		$strSyain[$intCnt][0]=$objRecData->syain_cd;
		$strSyain[$intCnt][1]=$objRecData->name_kj_sei.$objRecData->name_kj_mei;
		$strSyain[$intCnt][2]="";
		$strSQL = "SELECT * From syozoku_tbl Where syain_cd='".$strSyain[$intCnt][0]."' ";
		$objBumon = pg_exec($strSQL);
		for($i = 0; $i < pg_numrows($objBumon) ; $i++) {
				$objRecBumon = pg_fetch_object($objBumon, $i);
				$strSyain[$intCnt][2].=$objRecBumon->syozoku_cd."/";
		}
}

//全部門
$strSQL = "SELECT syozoku_cd,bumon_name,disp_rank From mst_bumon Where del_flg=0 Order By disp_rank";
$objBumon = pg_exec($strSQL);
for($intCnt = 0; $intCnt < pg_numrows($objBumon) ; $intCnt++) {
		$objRecBumon = pg_fetch_object($objBumon, $intCnt);
		$strBumon[$intCnt][0]=$objRecBumon->syozoku_cd;
		$strBumon[$intCnt][1]=$objRecBumon->bumon_name;
}

?>
<!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>E-グルPro</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--

//--------------------------
//  オールチェック
//--------------------------
function All_chk(intSts){
		if (document.e_gru.syain_chk.length){
				if (intSts==1){
						for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
							document.e_gru.syain_chk[i].checked=false;
						}
				}else{
						for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
							document.e_gru.syain_chk[i].checked=true;
						}
				}
		}else{
				if (intSts==1){
						document.e_gru.syain_chk.checked=false;
				}else{
						document.e_gru.syain_chk.checked=true;
				}
		}
}

//--------------------------
//  部門チェック
//--------------------------
function All_chk2(){
		if (document.e_gru.syain_chk.length){
				for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
						arr = (document.e_gru.syain_hid[i].value).split("/");
						for(j=0;j<arr.length;j++){
								if (document.e_gru.bumon.value==arr[j]){
										document.e_gru.syain_chk[i].checked=true;
										break;
								}
						}
				}
		}else{
				arr = (document.e_gru.syain_hid.value).split("/");
				for(j=0;j<arr.length;j++){
						if (document.e_gru.bumon.value==arr[j]){
								document.e_gru.syain_chk.checked=true;
								break;
						}
				}
		}
}

//--------------------------
//  CSVダウンロード
//--------------------------
function CSVDownLoad(){
		prm  = "";

		prm_list="";
		if (document.e_gru.syain_chk.length){
				for(i = 0 ; i <= document.e_gru.syain_chk.length-1; i++ ){
						if (document.e_gru.syain_chk[i].checked==true){
								prm_list+=document.e_gru.syain_chk[i].value+",";
						}
				}
		}else{
				prm_list+=document.e_gru.syain_chk.value+",";
		}
		if (prm_list==""){
				alert("社員を最低一人を選択してください。");
				return false;
		}
		prm  = "lst_data="+prm_list;
		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;
		document.e_gru.action = "TOP901.php?"+prm;
		location.href = document.e_gru.action;
}
-->
</SCRIPT>
</HEAD>
<BODY>
<form name="e_gru">
<?php 
$intLoop=date("Y")-2004+3;
?>
<br>
<TABLE width="580">
	<TR> 
		<TD>
			<TABLE cellspacing="1" cellpadding="1" width="100%" align="center" class="mainColor" border="0"> 
				<TR> 
					<TD width=95 height=25 class="toneDown"><span class=Normalfont>出力期間</span></TD> 
					<TD height=25 bgcolor="#ffffff">
						<SELECT name=st_year> 
							<option value="" selected>----</option>;
							<?php 
									for ($i = 0 ; $i <= $intLoop ; $i++) {
											$intSetValue=2004+$i;
											echo '<option value='.$intSetValue.'>'.$intSetValue.'</option>';
									}
							?>
						</SELECT>
						<SELECT name=st_mon> 
							<option value="" selected>---</option>;
							<?php 
									for ($i = 1 ; $i <= 12 ; $i++) {
											echo '<option value="'.sprintf('%02d',$i).'">'.$i.'</option>';
									}
							?>
						</SELECT>
						<SELECT name=st_day> 
							<option value="" selected>---</option>;
							<?php 
									for ($i = 1 ; $i <= 31 ; $i++) {
											echo '<option value="'.sprintf('%02d',$i).'">'.$i.'</option>';
									}
							?>
						</SELECT>
						<span class=Normalfont></span> 
						<SELECT name=ed_year> 
							<option value="">----</option>;
							<?php 
									for ($i = 0 ; $i <= $intLoop ; $i++) {
											$intSetValue=2004+$i;
											echo '<option value="'.$intSetValue.'" ';
											if (date("Y") == $intSetValue) {
													echo 'selected';
											}
											echo '>'.$intSetValue.'</option>';
									}
							?>
						</SELECT>
						<SELECT name=ed_mon> 
							<option value="">---</option>;
							<?php 
									for ($i = 1 ; $i <= 12 ; $i++) {
											echo '<option value="'.sprintf('%02d',$i).'" ';
											if (date("n") == $i) {
													echo 'selected';
											}
											echo '>'.$i.'</option>';
									}
							?>
						</SELECT>
						<SELECT name=ed_day> 
							<option value="">---</option>;
							<?php 
									for ($i = 1 ; $i <= 31 ; $i++) {
											echo '<option value="'.sprintf('%02d',$i).'" ';
											if (date("j") == $i) {
													echo 'selected';
											}
											echo '>'.$i.'</option>';
									}
							?>
						</SELECT>
						<span class=Normalfont> </span>
					</TD> 
				</TR> 
				<TR>
					<TD width=95 height=25 class="toneDown"><span class=Normalfont>出力部門</span></TD> 
					<TD height=25 bgcolor="#ffffff">
						<INPUT type="button" onclick="All_chk(0);" value="全選択">&nbsp;
						<INPUT type="button" onclick="All_chk(1);" value="全解除"><BR>
						<select name="bumon">
						<?php 	
								for($intCnt = 0; $intCnt < count($strBumon) ; $intCnt++) {	
									echo '<option value="'.$strBumon[$intCnt][0].'">'.$strBumon[$intCnt][1].'</option>';
								}
						?>
						</select>
						<INPUT type="button" onclick="All_chk2();" value="選択">&nbsp;
					</TD>
				</TR> 
				<TR>
					<TD width=95 height=25 class="toneDown"><span class=Normalfont>出力社員</span></TD> 
					<TD height=25 bgcolor="#ffffff">
						<?php 
								for($intCnt = 0; $intCnt < count($strSyain) ; $intCnt++) {
										echo '<input type="checkbox" name="syain_chk" id="'.$strSyain[$intCnt][0].'" value="'.$strSyain[$intCnt][0].'">';
										echo '<label for="'.$strSyain[$intCnt][0].'">';
										echo '<span class="Normalfont">'.$strSyain[$intCnt][1].'</span>';
										echo '</label><BR>';
										echo '<input type="hidden" name="syain_hid" value="'.$strSyain[$intCnt][2].'">';
								}
						?>
					</TD>
				</TR> 
			</TABLE>
		</TD>
	</TR> 
</TABLE>
<input type="button" onClick="CSVDownLoad();" name = "btnCsv" value="ダウンロード"> <input type="button" onClick="javascript:window.close();" name = "btnCsv" value="閉じる">
</form>
</BODY>
</HTML>