<?php
//-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*
//	自動でクラスを参照する
//	関数名	：	__autoload()
//	備考	：	参照先は./class/XXX.phpとする
//	更新	：	2012/10/19 KMK-Teraoka
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
function __autoload($className)
{
	$fPath = "./class/" . str_replace("_", "/", $className) . ".php";
	require_once $fPath;
}

//===============================================
//	DEBUG_MODE
//	備考		：	
//	更新		：	2012/10/19 KMK-Teraoka
//===============================================
define("DEBUG_MODE", "0");
Debug::setMode(DEBUG_MODE);
if (DEBUG_MODE == 1)
{
	Stopwatch::start();
}

//===============================================
//	CommonUtilities
//	備考		：	
//	更新		：	2012/11/27 KMK-Teraoka
//===============================================
$HOST = "192.168.100.153";
$DB = "ansys";
$USER = "postgres";
$PASS = "am#71ZJ*";

print "<!DOCTYPE html>";
print "<html>";
print "<head>";
print "<meta charset=\"utf-8\">";
print "<link rel=\"stylesheet\" type=\"text/css\" href=\"/ansys/common/css/style.css\">";
print "<link rel=\"shortcut icon\" href=\"/ansys/common/favicon/favicon.ico\">";
print "<title>";
print "帳票出力";
print "</title>";
print "</head>";
print "<body>";

try
{
	//================================================
	//	データベース接続
	//	備考		：	
	//	更新		：	2012/11/27 KMK-Teraoka
	//================================================
	$conn = pg_connect("
		host	=	". $HOST. "
		dbname	=	". $DB. "
		user	=	". $USER. "
		password=	". $PASS. "
	");
	if (!$conn)
	{
		throw new Exception("データベースへの接続に失敗しました");
	}
	
	//===============================================
	//	POST、GETパラメータの受け取り
	//	備考		：	
	//	更新		：	2012/11/27 KMK-Teraoka
	//===============================================
	if (DEBUG_MODE == 1)
	{
		extract($_POST);
		extract($_GET);
		Debug::writes($_POST);
	}
	if (strcmp($txtYmd, "") == 0)
		$txtYmd = date("Ymd");
	
	//print "<b>";
	//print "<center>";
	//print "コンクリート品質出力";
	//print "</center>";
	//print "</b>";
	//print "<hr />";
	
	print "<form action=\"". "./sheet.php". "\" method=\"post\" style=\"display:inline\">";
	
	print "<table border=\"0\">";
	print "<tr><td>日付</td></tr>";
	print "<tr><td><input type=\"text\" name=\"txtYmd\" value=\"". $txtYmd. "\" maxlength=\"8\" style=\"ime-mode:disabled;width:60px;\"></td></tr>";
	print "<tr><td align=\"right\"><input type=\"submit\" name=\"btnPrint\" value=\"csv出力\" id=\"submit_button\"></tr></td>";
	print "</table>";
	print "</form>";
}
catch(Exception $exc)
{
	print "<font color=\"#FF0000\">";
	print "【スクリプトエラー】<br />";
	print $exc->getMessage(). "<br />";
	print "</font>";
	
	print "<br />";
	
	print "<a href=\"". $_SERVER["PHP_SELF"]. "\">戻る</a>";
}

//===============================================
//	Postgresql終了処理
//	備考		：	
//	更新		：	2012/10/19 KMK-Teraoka
//===============================================
pg_close($conn);

print "</body>";
print "</html>";
?>
