D7net Mini Sh3LL v1
Current File : C:/Domains/maymaytinson.com/httpdocs/lib/images/13/../10/../7/../16/../activity/../JUKI/../15/../zip_food/../18/../17/../2/../21/../20/../22/../5/../11/../7/../5/../22/../22/../20/../19/../10/../../../include/editOrder.php |
<br><h3>Chi tiết đơn hàng</h3>
<br>
<div id="editOrder">
<form method="POST">
<table>
<thead>
<th>Stt</th>
<th>Tên sản phẩm</th>
<th>Số lượng</th>
<th>Đơn giá</th>
<th>Thành tiền</th>
</thead>
<?php
$stt=1;
$status=0;
$stmt=$conn->prepare("SELECT *,payment.status AS statusPayment,product.image AS imageProduct,product.name AS nameProduct,payment.id AS idPayment FROM payment JOIN product ON payment.product=product.id WHERE payment.customer='".$_GET['id']."' AND payment.dateBuy='".$_GET['dateBuy']."'");
$stmt->execute();
$payment=$stmt->fetchAll(PDO::FETCH_ASSOC);
$array=0;
foreach ($payment as $payment) {
$array++;
$endUrl=stripos($payment['imageProduct'],".")+4;
$urlImage=substr($payment['imageProduct'],0,$endUrl);
$sumPrice=0;
$status=$payment['statusPayment'];
?>
<tr>
<input type="" name="id[]" value="<?php echo $payment['idPayment']; ?>" hidden>
<td align="center"><?php echo $stt;$stt++; ?></td>
<td align="left"><img align="center" height="100px" src="<?php echo $urlImage ?>"> <?php echo $payment['nameProduct']; ?></td>
<td align="center"><?php echo $payment['amount']; ?></td>
<td align="right"><span class="price"><?php echo number_format($payment['price'])." đ"; ?></span></td>
<td align="right"><span class="price"><?php echo number_format($payment['amount']*$payment['price'])." đ";$sumPrice+=$payment['amount']*$payment['price']; ?></span></td>
</tr>
<?php } ?>
</table>
</div>
<div id="sumOrder">Tổng số tiền: <span class="price"><?php echo number_format($sumPrice)." đ"; ?></span><br>
<button type="submit" name="complete" <?php if($status==1){ echo "disabled"; } ?>><?php if($status==1){ echo "Đã thanh toán"; }else{ echo "Hoàn tất";} ?></button>
</form>
<?php
if(isset($_POST['complete'])){
$statusNew=1;
$idPayment=$_POST['id'];
for ($i=0; $i < $array; $i++) {
$idPayment[$i];
$stmt=$conn->prepare("UPDATE payment SET status=:status WHERE id='".$idPayment[$i]."'");
$stmt->bindParam(":status",$statusNew,PDO::PARAM_INT);
$stmt->execute();
header("location:editOrder.php?id=".$_GET['id']."&dateBuy=".$_GET['dateBuy']);
}
}
?>
</div>
AnonSec - 2021 | Recode By D7net