File manager - Edit - /var/www/order.cmtc.ac.th/admin/print_invoice_1.php
Back
<?php session_start(); if(!isset($_SESSION['admin'])) { header('Location: index.php'); exit; } include('../config/db.php'); $id = intval($_GET['id']); $o = $conn->query("SELECT * FROM orders WHERE id=$id")->fetch_assoc(); $items = $conn->query("SELECT p.name, i.qty, i.price FROM order_items i JOIN products p ON i.product_id=p.id WHERE i.order_id=$id"); ?> <!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <title>ใบเสร็จรับเงิน - <?=$o['booking_no']?></title> <link href="https://fonts.googleapis.com/css2?family=Kanit:wght@400;600&display=swap" rel="stylesheet"> <style> body { font-family: 'Kanit', sans-serif; margin: 40px; } table { width:100%; border-collapse: collapse; } th,td { border:1px solid #999; padding:8px; } th { background:#eee; } .text-right { text-align:right; } .text-center { text-align:center; } .info-box { border:1px solid #ccc; padding:15px; margin-bottom:15px; border-radius:6px; } </style> </head> <body> <h2 class="text-center">ใบเสร็จรับเงิน / ใบจัดส่งสินค้า</h2> <hr> <div class="info-box"> <b>เลขที่ใบจอง:</b> <?=$o['booking_no']?><br> <b>ชื่อผู้จอง:</b> <?=$o['fullname']?><br> <b>เบอร์โทร:</b> <?=$o['phone']?><br> <b>ที่อยู่:</b> <?=$o['address']?><br> <b>รหัสไปรษณีย์:</b> <?=$o['zipcode']?><br> <b>วิธีรับสินค้า:</b> <?=$o['receive_method']?><br> </div> <table> <thead><tr><th>รายการสินค้า</th><th>จำนวน</th><th>ราคา/หน่วย</th><th>รวม</th></tr></thead> <tbody> <?php $total=0; while($r=$items->fetch_assoc()): $sum=$r['qty']*$r['price']; $total+=$sum; ?> <tr> <td><?=$r['name']?></td> <td class="text-center"><?=$r['qty']?></td> <td class="text-right"><?=number_format($r['price'],2)?></td> <td class="text-right"><?=number_format($sum,2)?></td> </tr> <?php endwhile; ?> <tr><th colspan="3" class="text-right">ยอดรวมสุทธิ</th><th class="text-right"><?=number_format($total,2)?></th></tr> </tbody> </table> <p style="margin-top:40px;text-align:right;">ลงชื่อ .......................................... ผู้รับเงิน</p> <script>window.print();</script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.84 |
proxy
|
phpinfo
|
Settings