|
 |
|
สอบถามเรื่องการ วนลูปตารางเฉพาะเดือนหน่อยครับผม ตอนนี้ทำออกแบบวันได้แล้วครับ ช่วยแนะนำวิธีการทำแบบเดือนหน่อยครับผม |
|
 |
|
|
 |
 |
|
ต้องการให้ตารางออกเฉพาะของเดือนใครเดือนมันครับ ช่วยแนะนำทีผม ขอบคุณครับ
Code (PHP)
<div class="page-header">
<h3>รายงานยอดขายแบ่งตารางตามวัน</h3>
<p>ตั้งแต่วันที่ : <?php echo thaidatem($_GET['stdate']); ?> ถึงวันที่ : <?php echo thaidatem($_GET['endate']); ?></p>
</div>
<?php while (strtotime($stdate) <= strtotime($_GET['endate'])) {
$where=' where orders_date="'.$stdate.'" ';
$query = sprintf('select * from orders %s ',$where);
$result = mysqli_query($con,$query);
if (mysqli_num_rows($result)>0) {
?>
<table class="table table-bordered">
<p>วัน : <?php echo thaidatem($stdate); ?></p>
<thead>
<tr>
<th>#</th>
<th>ชื่อลูกค้า</th>
<th>การรับสินค้า</th>
<th>รวมเป็นเงิน</th>
<th>สถานะ</th>
</tr>
</thead>
<?php
$where=' where orders_date="'.$stdate.'" ';
$query = sprintf('select * from orders %s ',$where);
$result = mysqli_query($con,$query);
if (mysqli_num_rows($result)>0) {
for ($i=1;$i<=mysqli_num_rows($result);$i++) {
$rs = mysqli_fetch_array($result);
$query2 = 'select * from orders_detail where orders_id='.$rs['orders_id'];
$result2 = mysqli_query($con,$query2);
for ($j=1;$j<=mysqli_num_rows($result2);$j++) {$rs2 = mysqli_fetch_array($result2);
$query3 = 'select * from product where pro_no="'.$rs2['pro_no'].'"';
$result3 = mysqli_query($con,$query3);
$rs3 = mysqli_fetch_array($result3);
$sum='';
$sum +=$rs2['pro_amount'] * $rs3['pro_price'];
}
$query4 = sprintf('select * from branch where br_id=%s',$rs['branch_id']);
$result4 = mysqli_query($con,$query4);
$rs4 = mysqli_fetch_array($result4); ?>
<tbody>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $rs['cus_name']; ?></td>
<td><?php echo 'รับที่ '.$rs4['br_name'].'<br> วันที่ : '.thaidate($rs['rec_date']).' - '.$rs['rec_time']; ?></td>
<td><?php echo number_format($sum,2); ?></td>
<td>
<?php if ($rs['orders_status']==1) {echo 'ยังไม่ชำระเงิน';}
else if ($rs['orders_status']==2) { echo 'รอการตรวจสอบ'; }
else if ($rs['orders_status']==3) { echo 'รอจัดส่งสินค้า'; }
else {echo 'รับสินค้าเรียบร้อย';} ?>
</td>
</tr>
<?php }} ?>
</tbody>
<tr>
<td colspan="5"><h5 class="pull-right">จำนวน <?php echo $i-1; ?> รายการ <br><br>รวม <?php echo number_format($val,2); ?> บาท</h5></td>
</tr>
<?php } $stdate = date ("Y-m-d", strtotime("+1 day", strtotime($stdate)));}?>
</table>
Tag : PHP

|
ประวัติการแก้ไข 2016-09-28 10:10:44 2016-09-28 10:11:21
|
 |
 |
 |
 |
Date :
2016-09-28 10:09:06 |
By :
DisconnectOver |
View :
806 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไปดูบทความเรื่อง Between ครับ
|
 |
 |
 |
 |
Date :
2016-09-28 10:55:55 |
By :
dudesaranyu |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|