|
|
|
รบกวนผู้รู้ครับ ต้องrefresh 1ครั้ง ถึงจะได้หน้าตาปกติ ต้องแก้ไงไม่ต้อง refresh ครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php require_once('../include/conn.php'); ?>
<?php session_start(); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_AJ = 6;
$pageNum_AJ = 0;
if (isset($_GET['pageNum_AJ'])) {
$pageNum_AJ = $_GET['pageNum_AJ'];
}
$startRow_AJ = $pageNum_AJ * $maxRows_AJ;
mysql_select_db($dbname, $connect);
$query_AJ = "SELECT * FROM addjob ORDER BY id DESC";
$query_limit_AJ = sprintf("%s LIMIT %d, %d", $query_AJ, $startRow_AJ, $maxRows_AJ);
$AJ = mysql_query($query_limit_AJ, $connect) or die(mysql_error());
$row_AJ = mysql_fetch_assoc($AJ);
if (isset($_GET['totalRows_AJ'])) {
$totalRows_AJ = $_GET['totalRows_AJ'];
} else {
$all_AJ = mysql_query($query_AJ);
$totalRows_AJ = mysql_num_rows($all_AJ);
}
$totalPages_AJ = ceil($totalRows_AJ/$maxRows_AJ)-1;
$queryString_AJ = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_AJ") == false &&
stristr($param, "totalRows_AJ") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_AJ = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_AJ = sprintf("&totalRows_AJ=%d%s", $totalRows_AJ, $queryString_AJ);
?>
<!DOCTYPE html>
<html lang="en">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="assets/css/bootstrap.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="../assets/js/html5shiv.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="assets/ico/favicon.png">
<h3 align="left"><img src="../icon/jang.png" width="300" height="75" /></h3>
<table width="100%" border="0" class="table table-bordered">
<tr class="btn-success">
<td width="6%" align="center"><strong><i class="icon-user"></i> ชื่อผู้แจ้ง</strong></td>
<td width="8%" align="center"><strong><i class="icon-calendar"></i> วันที่ :: เวลา</strong></td>
<td width="7%" align="center"><strong><i class="icon-home"></i> แผนกที่แจ้ง</strong></td>
<td width="25%" align="center"><strong><i class="icon-file"></i> รายละเอียด</strong></td>
<td width="9%" align="center"><strong><i class="icon-time"></i> สถานะ</strong></td>
<td width="23%" align="center"><strong><i class="icon-comment"></i> ความคิดเห็นช่าง</strong></td>
<td width="5%" align="center"><strong><i class="icon-print"></i> พิมพ์</strong></td>
</tr>
<?php
do {
$iLoop++;
$bgcolor = ( ($iLoop%2)==0 )? "#F5ECCE" : "#CCFFCC" ;
?>
<tr bgcolor="<?php echo $bgcolor ;?>">
<td><?php echo $row_AJ['name']; ?></td>
<td><?php echo $row_AJ['datepicker']; ?> <strong>/ </strong><?php echo $row_AJ['time']; ?></td>
<td><?php echo $row_AJ['department']; ?></td>
<td><?php echo $row_AJ['details']; ?></td>
<td><?php echo $row_AJ['status']; ?></td>
<td><?php echo $row_AJ['comment']; ?></td>
<td><a href="it_report.php?id=<?php echo $row_AJ['id']; ?>"><img src="../icon/print.png" width="20" height="20" /></a></td> <!-- ส่งค่าไปยัง print -->
</tr>
<?php } while ($row_AJ = mysql_fetch_assoc($AJ)); ?>
</table>
<div class="span5" align="center">
<table width="38%" height="46" border="0" align="center">
<tr>
<td height="42" align="center"><?php if ($pageNum_AJ > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_AJ=%d%s", $currentPage, 0, $queryString_AJ); ?>"><button type="button" class="btn btn-mini btn-success"> <i class="icon-fast-backward"></i> </button></a>
<?php } // Show if not first page ?></td>
<td align="center"><?php if ($pageNum_AJ > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_AJ=%d%s", $currentPage, max(0, $pageNum_AJ - 1), $queryString_AJ); ?>"><button type="button" class="btn btn-mini btn-success"> <i class="icon-backward"></i> </button></a>
<?php } // Show if not first page ?></td>
<td align="center"><?php if ($pageNum_AJ < $totalPages_AJ) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_AJ=%d%s", $currentPage, min($totalPages_AJ, $pageNum_AJ + 1), $queryString_AJ); ?>"><button type="button" class="btn btn-mini btn-success"> <i class=" icon-forward"></i> </button></a>
<?php } // Show if not last page ?></td>
<td align="center"><?php if ($pageNum_AJ < $totalPages_AJ) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_AJ=%d%s", $currentPage, $totalPages_AJ, $queryString_AJ); ?>"><button type="button" class="btn btn-mini btn-success"> <i class="icon-fast-forward"></i> </button></a>
<?php } // Show if not last page ?></td>
</tr>
</table>
</div>
<br/>
<br/>
<?php include("../include/en_all.php") ?>
</html>
<?php
mysql_free_result($AJ);
?>
Tag : PHP, JavaScript
|
|
|
|
|
|
Date :
2015-08-19 10:54:05 |
By :
beer2121 |
View :
929 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
หน้ารายงานครับ
Code (PHP)
<?php require_once('../include/conn.php'); ?>
<?php session_start(); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($dbname, $connect);
$query_MAR = "SELECT * FROM addjob";
$MAR = mysql_query($query_MAR, $connect) or die(mysql_error());
$row_MAR = mysql_fetch_assoc($MAR);
$totalRows_MAR = mysql_num_rows($MAR);$colname_MAR = "-1";
if (isset($_GET['id'])) {
$colname_MAR = $_GET['id'];
}
mysql_select_db($dbname, $connect);
$query_MAR = sprintf("SELECT * FROM addjob WHERE id = %s", GetSQLValueString($colname_MAR, "int"));
$MAR = mysql_query($query_MAR, $connect) or die(mysql_error());
$row_MAR = mysql_fetch_assoc($MAR);
$totalRows_MAR = mysql_num_rows($MAR);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
#wrapall {
font-family: "Angsana New";
margin: auto;
width: 800px;
}
#date_reg {
font-size: 1em;
font-weight: normal;
float: left;
width: 48%;
}
#data_no {
font-size: 1em;
font-weight: normal;
float: right;
width: 48%;
}
.data_line {
font-size: 22px;
font-weight: normal;
clear: both;
width: 98%;
padding-top: 10px;
border-bottom-width: 1px;
border-bottom-style: dotted;
border-bottom-color: #666;
}
@media print{
#wrapall{width:100%;}
#btnprint{display:none;}
}
#sig1 {
float: left;
width: 30%;
border-top-width: thin;
border-top-style: dotted;
border-top-color: #333;
}
</style>
</head>
<body>
<?
date_default_timezone_set('Asia/Bangkok');
$date = date("d-m-Y");
$time = date("H:i");
?>
<div id="wrapall">
<table width="100%" border="0">
<tr>
<td width="25%" rowspan="4" align="center"></td>
<td width="60%" align="center"><h2><strong>** ใบแจ้งงานซ่อม IT **</strong></h2></td>
<td width="15%" align="center"> <div class="data_line">
<input name="btnprint" id="btnprint" type="button" onClick="window.print()" value="พิมพ์" />
</div></td>
</tr>
<!--<tr>
<td align="center"><img src="../images/head.jpg" width="600" height="100" /></td>
</tr>-->
</table>
<div class="data_line"> <strong>วันที่แจ้ง/เวลา ::</strong> <?php echo $row_MAR['datepicker']; ?>::::<?php echo $row_MAR['time']; ?> <strong>Job ID ::</strong> IT-JOB00<?php echo $row_MAR['id']; ?></div>
<div class="data_line"> <strong>ชื่อผู้แจ้ง :: </strong><?php echo $row_MAR['name']; ?></div>
<div class="data_line"> <strong>แผนกที่แจ้ง ::</strong> <?php echo $row_MAR['department']; ?></div>
<div class="data_line"> <strong>ลำดับความสำคัญ ::</strong> <?php echo $row_MAR['piority']; ?></div>
<div class="data_line"> <strong>ปัญหาที่พบ ::</strong> <?php echo $row_MAR['problem']; ?></div>
<div class="data_line"> <strong> รายละเอียด ::</strong> <?php echo $row_MAR['details']; ?></div>
<div class="data_line"> </div>
<div class="data_line"> <strong>Status ::</strong> <?php echo $row_MAR['status']; ?></div>
<div class="data_line"> <strong>Comment ::</strong> <?php echo $row_MAR['comment']; ?></div>
<div class="data_line"> </div>
<div class="data_line"> </div>
<div class="data_line">
<p> ..................................... ...................................
</p>
<p> <strong> หัวหน้าแผนก </strong> <strong>แผนก IT</strong> </p>
<p> <strong>วัน/เวลาที่พิมพ์ ::</strong> <? echo $date." / ".$time?></p>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($MAR);
?>
|
|
|
|
|
Date :
2015-08-19 10:58:19 |
By :
beer2121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก่อนรีเฟรช
หลังรีเฟรช
|
ประวัติการแก้ไข 2015-08-19 11:09:17
|
|
|
|
Date :
2015-08-19 11:01:23 |
By :
beer2121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|