File "work_list_d.php"
Full path: /www/haneda/qr/work_list_d.php
File size: 11.18 KiB (11446 bytes)
MIME-type: text/x-php
Charset: utf-8
<?php
//===============================================
// CommonUtilities
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
$PENTA_OCEAN = "五洋・清水特定建設工事企業体";
$TAIL_PENTA_OCEAN = "penta-ocean";
$SCRIPT_TITLE = "登録一覧";
$TOP_FORM = "./index.php";
$VIEW_FORM = "./work_list_details.php";
$HOST = "192.168.100.153";
$DB = "pntdb";
$USER = "postgres";
$PASS = "am#71ZJ*";
$WORK_TABLE = "qr.work_data";
$REGIST_TABLE = "qr.regist_data";
$PAGE_LIMIT = 30;
//===============================================
// HTML-HEAD-
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
print "<html>";
print "<head>";
print "<meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"/ansys/config/css/style.css\">";
print "<link rel=\"shortcut icon\" href=\"/ansys/config/favicon.ico\">";
print "<title>". $SCRIPT_TITLE. "</title>";
print "</head>";
//===============================================
// HTML-BODY部開始-
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//===============================================
print "<body>";
print "<center>";
print "<font size=\"3\">";
print "<b>";
print "". $SCRIPT_TITLE. "<br>";
print "【". $PENTA_OCEAN. "】";
print "</b>";
print "</font>";
print "</center>";
print "<hr />";
print "<a href='./index.php'>戻る</a><BR>";
/*
print "<style type='text/css'>";
print "table {";
print "margin-top:10;";
print "margin-left:150;";
print "}";
print "</style>";
*/
//================================================
// データベース接続
// 備考 :
// 更新 : 2012/10/18 KMK-Teraoka
//================================================
$conn = pg_connect("
host = ". $HOST. "
dbname = ". $DB. "
user = ". $USER. "
password= ". $PASS. "
");
if (!$conn)
{
throw new Exception("データベースへの接続に失敗しました");
}
//===============================================
// POST、GETパラメータの受け取り
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
/*
if (DEBUG_MODE == 1)
{
extract($_POST);
extract($_GET);
Debug::writes($_POST);
}
$selSearch = isset($_POST["selSearch"]) ? htmlspecialchars($_POST["selSearch"]) : "";
$txtSearchObj = isset($_POST["txtSearchObj"]) ? htmlspecialchars($_POST["txtSearchObj"]) : "";
$viewPage = isset($_POST["hPage"]) ? htmlspecialchars($_POST["hPage"]) : 1;
$btnSearch = isset($_POST["btnSearch"]) ? htmlspecialchars($_POST["btnSearch"]) : "";
if (strcmp($btnSearch, "クリア") == 0)
{
$txtSearchObj = "";
}
else if (strcmp($btnSearch, "検索") == 0)
{
$viewPage = 1;
}
*/
//===============================================
// WHERE句の作成
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
//最新の作業時間を抽出
$select_w = "SELECT distinct date FROM " .$WORK_TABLE ." ORDER BY date desc;";
$res_w = pg_query($conn,$select_w);
$data_ct = pg_num_rows($res_w);
//===============================================
// 見出し
// 備考 : Table内TableでBorderを細くする
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
// print $select_w ."<BR>";
//●日付用プルダウン作成
print "<form action=\"". "./work_list_csv.php". "\" method=\"post\" style=\"display:inline\">";
print "<select name=\"Date\" >";
for($iCount = 0; $iCount < $data_ct; $iCount++)
{
$rowObserve = pg_fetch_assoc($res_w, $iCount);
$selOption = "";
print "<option value=\"". $rowObserve["date"]. "\" ". $selOption. ">". date("Y-m-d" ,strtotime($rowObserve['date'])). "</option>";
}
print "</select>";
//////////////////////////////////////////
//●昼/夜用プルダウン作成
print "<select name=\"TimeZone\" >";
$selOption = "";
print "<option value=\"99\"". $selOption. ">全て</option>";
print "<option value=\"0\"". "\" ". $selOption. ">昼間</option>";
print "<option value=\"1\"". "\" ". $selOption. ">夜間</option>";
print "</select>";
//////////////////////////////////////////
//●返却プルダウン作成
print "<select name=\"HFlag\" >";
$selOption = "";
print "<option value=\"99\"". $selOption. ">全て</option>";
print "<option value=\"2\"". "\" ". $selOption. ">返却済</option>";
print "<option value=\"1\"". "\" ". $selOption. ">未返却</option>";
print "</select>";
//////////////////////////////////////////
print "<input type=\"submit\" name=\"btnPrint\" value=\"csv出力\" style=\"width:90px\">";
print "</form>";
// print "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">";
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">";
print "<tr>";
print "<td align='center' width='110' rowspan='2'>";
print "日時";
print "</td>";
print "<td align='center' colspan='4'>";
print "貸出/返却の状況";
print "</td>";
print "<tr>";
print "<td align='center' colspan='2'>";
print "昼間";
print "</td>";
print "<td align='center' colspan='2'>";
print "夜間";
print "</td>";
print "</tr>";
for($i = 0;$i < $data_ct;$i++)
{
$row_w = pg_fetch_array($res_w,$i);
$select_date = date("Y-m-d",strtotime($row_w['date']));
$new_c = 0;
for($j = 2 ;$j >= 0;$j--)
{
//昼間/夜間の作業検索
$SELECT_C = "SELECT distinct date,time_zone FROM qr.work_data WHERE date=" ." '" .$row_w['date'] ."' AND time_zone = '" .$j ."'";
$RES_C = pg_query($conn,$SELECT_C);
$C_ct = pg_num_rows($RES_C);
if($C_ct)
{
$select_r = "SELECT user_id_flag,user_dentification_flag,car_dentification_flag, car_id_flag, flag_number_flag,mark_number_flag,manual_number_flag,fire_flag FROM " .$REGIST_TABLE ;
$select_r .= " WHERE date = '" .$row_w['date'] ."' AND time_zone = '" .$j ."' AND del_flag = false ORDER BY regdatetime;";
//print $select_r ."<BR>";
$res_r = pg_query($conn,$select_r);
$flag_ct = pg_num_rows($res_r);
$flag_check = "";
$status_p = array();
for($ii =0;$ii < $flag_ct;$ii++)
{
$row_r = pg_fetch_array($res_r,$ii);
if(($row_r[0] == 1) || ($row_r[1] == 1) || ($row_r[2] == 1) || ($row_r[3] == 1) || ($row_r[4] == 1) || ($row_r[5] == 1) || ($row_r[6] == 1) || ($row_r[7] == 1))
{
//print "OK";
$flag_check = 1;
if($row_r[0] == 1) $status_p[0] = "識別票(立入者),";
if($row_r[1] == 1) $status_p[1] = "ID(立入者),";
if($row_r[2] == 1) $status_p[2] = "識別票(車両),";
if($row_r[3] == 1) $status_p[3] = "ID(車両),";
if($row_r[4] == 1) $status_p[4] = "旗,";
if($row_r[5] == 1) $status_p[5] = "マーク,";
if($row_r[6] == 1) $status_p[6] = "マニュアル,";
if($row_r[7] == 1) $status_p[7] = "火気,";
}
}
if($flag_check == 1)
{
if($i == 0)
{
if(!$new_c)
{
$status[$j] = "--------";
$align[$j] = "align='center'";
$bgcolor[$j] = "#FFFFFF";
$LinkT[$j] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
$new_c = 1;
}
else
{
$status[$j] = "未返却有:";
$status[$j] .= $status_p[0] .$status_p[1] .$status_p[2] .$status_p[3] .$status_p[4] .$status_p[5] .$status_p[6] .$status_p[7];
$status[$j] = rtrim($status[$j], ",");
$bgcolor[$j] = "#FFA500";
$LinkT[$j] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
}
}
else
{
$status[$j] = "未返却有:";
$status[$j] .= $status_p[0] .$status_p[1] .$status_p[2] .$status_p[3] .$status_p[4] .$status_p[5] .$status_p[6] .$status_p[7];
$status[$j] = rtrim($status[$j], ",");
$bgcolor[$j] = "#FFA500";
$LinkT[$j] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
}
}
else
{
if($i == 0)
{
if(!$new_c)
{
$status[$j] = "--------";
$align[$j] = "align='center'";
$bgcolor[$j] = "#FFFFFF";
$LinkT[$j] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
$new_c = 1;
}
else
{
$status[$j] ="";
$bgcolor[$j] = "#FFFFFF";
$LinkT[$j] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
}
}
else
{
$status[$j] ="";
$bgcolor[$j] = "#FFFFFF";
$LinkT[$j] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
}
}
}
else
{
$status[$j] ="";
$bgcolor[$j] = "#FFFFFF";
$LinkT[$j] = "<td width='50' align='center'><font color='#D3D3D3'></font></td>";
}
}
//Test用
if($i == 4)
{
$status_p[0] = "識別票(人),";
$status_p[1] = "ID(人),";
$status_p[2] = "識別票(車両),";
$status_p[3] = "ID(車両),";
$status_p[4] = "旗,";
$status_p[5] = "マーク,";
$status_p[6] = "マニュアル,";
$status_p[7] = "火気";
$status[0] = "未返却:";
$status[0] .= "<font size ='2'>" .$status_p[0] .$status_p[1] .$status_p[2] .$status_p[3] .$status_p[4] .$status_p[5] .$status_p[6] .$status_p[7] ."</font>";
rtrim($status[0], ",");
$bgcolor[0] = "#FFA500";
$LinkT[0] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
$status_p[0] = "識別票(人),";
$status_p[1] = "ID(人),";
$status_p[2] = "識別票(車両),";
$status_p[3] = "ID(車両),";
$status_p[4] = "旗,";
$status_p[5] = "マーク,";
$status_p[6] = "マニュアル,";
$status_p[7] = "火気";
$status[1] = "未返却:";
$status[1] .= "<font size ='2'>" .$status_p[0] .$status_p[1] .$status_p[2] .$status_p[3] .$status_p[4] .$status_p[5] .$status_p[6] .$status_p[7] ."</font>";
rtrim($status[1], ",");
$bgcolor[1] = "#FFA500";
$LinkT[1] = "<td width='50' align='center'><a href='work_list_details.php" ."?d=" .$select_date ."&t=" .$j ."'>一覧</a></td>";
}
/////////
if($i <= 4)
{
print "<tr >";
print "<td align='center'>" .$select_date ."</td>";
print $LinkT[0];
print "<td width='450' bgcolor='" .$bgcolor[0] ."'" .$align[0] .">" .$status[0] ."</td>";
print $LinkT[1];
print "<td width='450' bgcolor='" .$bgcolor[1] ."'" .$align[1] .">" .$status[1] ."</td>";
print "</tr>";
$align = array();
}
}
print "</table>";
print "<br />";
//===============================================
// Postgresql終了処理
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
pg_close($conn);
print "<a href='./index.php'>戻る</a>";
//===============================================
// HTML終了処理
// 備考 :
// 更新 : 2012/11/01 KMK-Teraoka
//===============================================
print "<hr />";
print "<font size=\"3\" color=\"#000000\" face=\"Arial\">";
print "<center>";
print "<b>";
print "<i>";
print $TAIL_PENTA_OCEAN;
print "</i>";
print "</b>";
print "</center>";
print "</font>";
print "</body>";
print "</html>";
?>