|
 |
|
รบกวนพี่ๆ ช่วยหน่อยค่ะ เรื่อง sql มัน ไม่ยอมแสดงข้อมูลค่ะ |
|
 |
|
|
 |
 |
|
อันนี้โค๊ดหน้า vieworderBill ค่ะ
Code (PHP)
<?php
session_start();
include_once "../../config.php";
include_once "../../script/function.php";
import_request_variables("pG","p_");
$myClass = new MyClass();
$total = 0;
$sql = "Select * From tb_orderlist ol left join tb_vender vd on ol.order_vd = vd.vd_id Order By order_sn";
$rec = $myClass->selQuery($sql);
if($rec != null){
?>
<?php
$sql = "Select ol.order_sn ,ol.order_date, ol.order_vd, vd.vd_name , vd.vd_tel ,ol.order_price From tb_orderlist ol, tb_itemorderlist iol , tb_vender vd
where ol.order_sn = iol.order_sn
and ol.order_vd = vd.vd_id
and ol.order_sn = '".$p_txtOR."'";
?>
<!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" />
<title>ใบสั่งซื้อสินค้าเข้าร้าน</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css" media="print">
.linkx{
color:#FFFFFF;
}
</style>
<style type="text/css" media="screen">
.linkx{
color:#000;
text-decoration: none;
}
.linkx:hover{
font-weight: bold;
}
</style>
</head>
<body>
<div id="content" style="width: 95%; min-height: 1024px; background-color:#FFFFFF" align="left">
<div style="color: #9D0000;font-size:1.5em;font-weight: bold;" align="right"><?=$CONFIG["shop"]?></div>
<div align="right"><?=$CONFIG["shopAddr"]?></div>
<br>
<div class="titleText"><strong>รหัสใบสั่งซื้อ</strong></div><div style="height:25px;line-hieght: 25px;" align="left"><?=$rec[0]['order_sn']?></div><div class="clear"></div>
<div class="titleText"><strong>ชื่อบริษัทจำหน่าย</strong></div><div style="hight:25px;line-hight: 25px;" algn="left"><?=$rec[0]['vd_name']?></div><div class="clear"></div>
<div class="titleText"><strong>วันที่สั่งซื้อเข้าร้าน</strong></div><div style="hieght:25px;line-hight: 25px;" align="left"><?=date("dt, M Y", $rec[0]['order_date']);?></div><div class="clear"></div>
<div align="left"><br/><br>
<table border="1" bordercolor="#626262" cellpadding="3" cellspacing="0" width="98%">
<tr algn="center" valign="middle" height="25">
<td width="12%"><strong><center>รหัสสินค้า</center></strong></td>
<td width="20%"><strong><center>ชื่อสินค้า</center></strong></td>
<td width="15%"><strong><center>หมวดหมู่</center></strong></td>
<td><strong><center>ชื่อยี่ห้อ</center></strong></td>
<td><strong><center>จำนวน</center></strong></td>
<td><strong><center>ราคา</center></strong></td>
<td><strong><center>รวมราคา</center></strong></td>
</tr>
<?php
$sqlit = "Select * From tb_product pd Left Join tb_category cate on pd.cate_id = cate.cate_id Left Join tb_itemorderlist iodl on iodl.prod_id = pd.prod_id
where iodl.order_sn '".$rec[0]['order_sn']."'";
/*"Select * From tb_itemlist itl
left join tb_paylist pl
on itl.pay_sn=pl.pay_sn
Where itl.pay_sn = '".$rec[0]['pay_sn']."'";
"Select * From tb_user usr
Left Join tb_usertype utype On usr.utype_id = utype.utype_id
Left Join tb_province prov On usr.prov_id = prov.prov_id";*/
echo $sqlit;
$rsit = $myClass->selQuery($sqlit);
//mysql_db_query($dbname,$sqlit) or die(mysql_error());
//$num= sizeof($rsit);
if($rsit!=null){
$count = 1;
$sumPrice = 0;
$total_price = 0;
foreach($rsit as $key){
$total_price = $key['prod_cost']*$key['list_qty'];
$sum_price += $total_price;
echo '<tr valign="middle" height="20">
<td> '.$key['prod_id'].'</td>
<td>'.$key['prod_title'].'</td>
<td> '.$key['cate_name'].'</td>
<td> '.$key['prod_brand'].'</td>
<td align="center">'.$key['list_qty'].'</td>
<td align="right">฿'.number_format($key['prod_cost']).' </td>
<td align="right">฿'.number_format($total_price).' </td>
</tr>';
$count++;
echo $sqlit;
}
}
echo'$num';
?>
</table>
<div style="margin-top: 10px; margin-bottom: 10px" align="left">
<strong>ราคารวม : <?=number_format($sum_price)?> บาท</strong>
</div>
<div align="center"><a href="javascript: window.print();" class="linkx">[ พิมพ์ ]</a> <a href="javascript: window.close();" class="linkx">[ ปิด ]</a></div>
</div>
</div>
</body>
</html>
<?php
}
?>

Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-04-02 23:04:46 |
By :
hikarujun |
View :
905 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
where ไม่มี =
|
 |
 |
 |
 |
Date :
2012-04-03 01:11:34 |
By :
เน็ตช๊าช้า |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|