|
|
|
ช่วยหน่อยครับ คิด algorithm แสดงผลไม่ได้ รบกวนทุกท่านช่วยดูหน่อย |
|
|
|
|
|
|
|
จากการแสดงผลแบบนี้
และรูปแบบ code
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>แสดงข้อมูล รายงานการตรวจนับสินทรัพย์ถาวร</title>
</head>
<body>
<?php
include ("config.php");
if (($_POST["segment"]=="0") AND ($_POST["location"]=="0") AND ($_POST["type"]=="0")){
$strSQL = "SELECT * FROM ast_item ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else if(($_POST["segment"]!="0") AND ($_POST["location"]=="0") AND ($_POST["type"]=="0")){
$strSQL = "SELECT * FROM ast_item WHERE segment_num = '".$_POST["segment"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else if(($_POST["segment"]=="0") AND ($_POST["location"]!="0") AND ($_POST["type"]=="0")){
$strSQL = "SELECT * FROM ast_item WHERE location_id = '".$_POST["location"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else if(($_POST["segment"]=="0") AND ($_POST["location"]=="0") AND ($_POST["type"]!="0")){
$strSQL = "SELECT * FROM ast_item WHERE type_id = '".$_POST["type"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else if(($_POST["segment"]!="0") AND ($_POST["location"]!="0") AND ($_POST["type"]=="0")){
$strSQL = "SELECT * FROM ast_item WHERE segment_num = '".$_POST["segment"]."' ";
$strSQL .= "AND location_id = '".$_POST["location"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else if(($_POST["segment"]!="0") AND ($_POST["location"]=="0") AND ($_POST["type"]!="0")){
$strSQL = "SELECT * FROM ast_item WHERE segment_num = '".$_POST["segment"]."' ";
$strSQL .= "AND type_id = '".$_POST["type"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else if(($_POST["segment"]=="0") AND ($_POST["location"]!="0") AND ($_POST["type"]!="0")){
$strSQL = "SELECT * FROM ast_item WHERE type_id = '".$_POST["type"]."' ";
$strSQL .= "AND location_id = '".$_POST["location"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
else{
$strSQL = "SELECT * FROM ast_item WHERE type_id = '".$_POST["type"]."' ";
$strSQL .= "AND location_id = '".$_POST["location"]."' AND segment_num = '".$_POST["segment"]."' ORDER BY segment_num,location_id,type_id,item_main_id ASC";
}
$objQuery = mysql_query($strSQL);
$listQuery = mysql_query($strSQL);
$numrow = mysql_num_rows($objQuery);
$readyline = 0;
while($rs = mysql_fetch_assoc($listQuery)){
$listtype[] = $rs["type_id"];
}
print_r ($listtype);
while($result = mysql_fetch_array($objQuery)){
$typequery = mysql_query ("SElECT ast_type.type_name,ast_item.type_id FROM ast_type,ast_item WHERE ast_type.type_id = '".$result["type_id"]."' ");
$contactquery = mysql_query ("SELECT ast_contactnum.contactnum_name,ast_item.item_contact_id FROM ast_contactnum,ast_item WHERE ast_contactnum.contactnum_id ='".$result["item_contact_id"]."' ");
$wbsquery = mysql_query ("SELECT ast_wbs.wbs_name,ast_item.wbs_id FROM ast_wbs,ast_item WHERE ast_wbs.wbs_id = '".$result["wbs_id"]."'");
$locationquery = mysql_query ("SELECT ast_location.location_name,ast_item.location_id FROM ast_location,ast_item WHERE ast_location.location_id = '".$result["location_id"]."' ");
$resultwbs = mysql_fetch_array ($wbsquery);
$resultlocation = mysql_fetch_array ($locationquery);
$resultcontact = mysql_fetch_array($contactquery);
$typename = mysql_fetch_array($typequery);
echo "ประเภทสินทรัพย์ : ".$result["type_id"]." ".$typename["type_name"]."<BR>";
?>
<div style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><table width="100%" border="1" cellpadding="1" cellspacing="1" style="border-color: #000000; border-style: solid; background-color: #ffffff;">
<tr valign="top">
<td colspan=2 height="19" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">รหัสสินทรัพย์</span></p>
</td>
<td colspan=3 height="19" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">รายละเอียด</span></p>
</td>
<td rowspan=2 width="79" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">จำนวน</span></p>
</td>
<td rowspan=2 width="40" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">หน่วยนับ</span></p>
</td>
<td rowspan=2 width="88" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ราคาทุน</span></p>
</td>
<td rowspan=2 width="77" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">วันขึ้นสินทรัพย์</span></p>
</td>
<td colspan=4 height="19" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style="font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ผลการตรวจนับ</span></p>
</td>
<td rowspan=2 width="86" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">หมายเหตุ</span></p>
</td>
</tr>
<tr valign="top">
<td width="105" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">หลัก</span></p>
</td>
<td width="60" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ย่อย</span></p>
</td>
<td width="147" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">เลขที่สัญญา</span></p>
</td>
<td width="50" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ห้อง/ชั้น</span></p>
</td>
<td width="133" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">WBS</span></p>
</td>
<td width="68" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ใช้งาน</span></p>
</td>
<td width="66" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ไม่ใช้งาน</span></p>
</td>
<td width="68" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ไม่พบ</span></p>
</td>
<td width="59" height="8" style="border-color : #000000 #000000 #000000 #000000; border-style: solid;"><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; font-style: normal; font-weight: normal; color: #000000; background-color: transparent; ">ชำรุด</span></p>
</td>
</tr>
</table>
</div>
<BR>
<div style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><table width="0%" border="0" cellpadding="0" cellspacing="0" style="border-color: #ffffff; border-style: solid; background-color: #ffffff;">
<tr valign="top">
<td width="113" height="19" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$result["item_main_id"];?></span></p>
</td>
<td width="68" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$result["item_sub_id"];?></span></p>
</td>
<td colspan=3 height="19" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt;"><?=$result["item_detail"];?></span></p>
</td>
<td colspan=4 width="284" style="border-color : #000000 #000000 #000000 #000000; "><br/>
</td>
<td colspan=4 height="19" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt;"></span></p>
</td>
<td width="86" style="border-color : #000000 #000000 #000000 #000000; "><br />
</td>
</tr>
<tr valign="top">
<td colspan=2 width="181" height="8" style="border-color : #000000 #000000 #000000 #000000; "><br />
</td>
<td width="147" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$resultcontact["contactnum_name"];?></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$result["item_where"];?></span></p>
</td>
<td width="140" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$resultwbs["wbs_name"];?></span></p>
</td>
<td width="90" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt;"><?=number_format($result["item_total"],3);?></span></p>
</td>
<td width="45" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$result["item_unit"];?></span></p>
</td>
<td width="100" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=number_format($result["item_price"],2);?></span></p>
</td>
<td width="83" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$result["item_date"];?></span></p>
</td>
<?
if($result["item_usable"]==0){ ?>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<?}
else if($result["item_usable"]==1){ ?>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1" checked></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<?}
else if($result["item_usable"]==2){ ?>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1" checked></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<?}
else if($result["item_usable"]==3){?>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1" checked></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<?}
else{?>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1"></span></p>
</td>
<td width="75" height="8" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><input name=<?=$result["item_main_id"];?> type="radio" value="1" checked></span></p>
</td>
<?}?>
<td width="75" style="border-color : #000000 #000000 #000000 #000000; "><p style=" text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;"><span style=" font-size: 10pt; "><?=$result["item_comment"];?></span></p>
</td>
</tr>
</table>
</div>
<div style=" text-align: left; "><table width="0%" border="0" cellpadding="0" cellspacing="0" background-color: #ffffff;">
<tr valign="top">
<td width="168" ><br />
</td>
<td width="351" ><p style=" text-align: left; "><span style=" font-style: normal; font-weight: normal;">**ยอดรวมตามประเภทสินทรัพย์:<?=$result["type_id"]." ".$typename["type_name"];?></span></p>
</td>
<td width="92" ><p style=" text-align: left; "><span style=" font-style: normal; font-weight: normal; "><?=number_format($totalunit,3);?></span></p>
</td>
<td width="92" ><p style=" text-align: left; "><span style=" font-style: normal; font-weight: normal; ">หน่วย</span></p>
</td>
<td width="92" ><p style=" text-align: left; "><span style=" font-style: normal; font-weight: normal; "><?=number_format($totalmoney,2);?></span></p>
</td>
<td width="92" ><p style=" text-align: left; "><span style=" font-style: normal; font-weight: normal; ">บาท</span></p>
</td>
</tr></table><BR>
<?}?>
</body>
</html>
ผมอยากจะให้ข้อมูลชุุดเดียวกันปริ้นออกมาโดยที่ไม่ต้องวาดตารางใหม่ผมต้องแก้โค้ดตรงไหนบ้าง
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-03-21 09:11:25 |
By :
Chayakorn_jj |
View :
914 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|