Server IP : 43.241.58.20 / Your IP : 216.73.216.25 Web Server : Apache/2 System : Linux ns1-1556229.dragonhispeed.com 3.16.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : ratsitne ( 1130) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/ratsitne/.trash/files/admin/ |
Upload File : |
<?php include '../config.php'; include 'auth.php'; $page_title = 'Dashboard'; ob_start(); // Get total invoices $total_invoices_query = "SELECT COUNT(*) as total_invoices FROM invoices"; $total_invoices_result = mysqli_query($conn, $total_invoices_query); $total_invoices = mysqli_fetch_assoc($total_invoices_result)['total_invoices']; // Get total users $total_users_query = "SELECT COUNT(*) as total_users FROM users"; $total_users_result = mysqli_query($conn, $total_users_query); $total_users = mysqli_fetch_assoc($total_users_result)['total_users']; // Get total purchases $total_purchases_query = "SELECT COUNT(*) as total_purchases FROM purchases"; $total_purchases_result = mysqli_query($conn, $total_purchases_query); $total_purchases = mysqli_fetch_assoc($total_purchases_result)['total_purchases']; // Get latest 10 invoices $latest_invoices_query = "SELECT i.id, i.document_no, i.document_date AS issue_date, i.grand_total, c.company_name AS customer_name FROM invoices i INNER JOIN customers c ON i.customer_id = c.id ORDER BY i.document_date DESC LIMIT 10"; $latest_invoices_result = mysqli_query($conn, $latest_invoices_query); // Get latest 10 purchases $latest_purchases_query = "SELECT p.id, p.document_no, p.document_date, p.grand_total, s.company_name AS supplier_name FROM purchases p INNER JOIN suppliers s ON p.supplier_id = s.id ORDER BY p.document_date DESC LIMIT 10"; $latest_purchases_result = mysqli_query($conn, $latest_purchases_query); ?> <div class="container-fluid"> <div class="row"> <div class="col-lg-4 col-6"> <div class="small-box text-bg-info"> <div class="inner"> <h3><?php echo $total_invoices; ?></h3> <p>ใบกำกับภาษีทั้งหมด</p> </div> <svg class="small-box-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <path d="M5.625 1.5c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0016.5 9h-1.875a1.875 1.875 0 01-1.875-1.875V5.25A3.75 3.75 0 009 1.5H5.625z"></path> </svg> <a href="invoice-list.php" class="small-box-footer link-light link-underline-opacity-0 link-underline-opacity-50-hover"> More info <i class="bi bi-link-45deg"></i> </a> </div> </div> <div class="col-lg-4 col-6"> <div class="small-box text-bg-success"> <div class="inner"> <h3><?php echo $total_purchases; ?></h3> <p>ใบสั่งซื้อทั้งหมด</p> </div> <svg class="small-box-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <path d="M2.25 2.25a.75.75 0 000 1.5h1.386c.17 0 .318.114.362.278l2.558 9.592a3.752 3.752 0 00-2.806 3.63c0 .414.336.75.75.75h15.75a.75.75 0 000-1.5H5.378A2.25 2.25 0 017.5 15h11.218a.75.75 0 00.674-.421 60.358 60.358 0 002.96-7.228.75.75 0 00-.525-.965A60.864 60.864 0 005.68 4.509l-.232-.867A1.875 1.875 0 003.636 2.25H2.25zM3.75 20.25a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0zM16.5 20.25a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z"></path> </svg> <a href="purchase-list.php" class="small-box-footer link-light link-underline-opacity-0 link-underline-opacity-50-hover"> More info <i class="bi bi-link-45deg"></i> </a> </div> </div> <div class="col-lg-4 col-6"> <div class="small-box text-bg-warning"> <div class="inner"> <h3><?php echo $total_users; ?></h3> <p>ผู้ใช้ทั้งหมด</p> </div> <svg class="small-box-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <path d="M12 2.25a5.25 5.25 0 100 10.5 5.25 5.25 0 000-10.5zM3.75 12a8.25 8.25 0 0116.5 0v.75a.75.75 0 01-.75.75H4.5a.75.75 0 01-.75-.75V12zM12 15a8.25 8.25 0 00-8.25 8.25v.75a.75.75 0 00.75.75h15a.75.75 0 00.75-.75v-.75A8.25 8.25 0 0012 15z"></path> </svg> <a href="user-list.php" class="small-box-footer link-light link-underline-opacity-0 link-underline-opacity-50-hover"> More info <i class="bi bi-link-45deg"></i> </a> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="card"> <div class="card-header"> <h3 class="card-title">ใบกำกับภาษีล่าสุด</h3> <div class="card-tools"> <button type="button" class="btn btn-tool" data-lte-toggle="card-collapse"> <i data-lte-icon="expand" class="bi bi-plus-lg"></i> <i data-lte-icon="collapse" class="bi bi-dash-lg"></i> </button> <button type="button" class="btn btn-tool" data-lte-toggle="card-remove"> <i class="bi bi-x-lg"></i> </button> </div> </div> <!-- /.card-header --> <div class="card-body"> <?php if (isset($_SESSION['success_message'])): ?> <div class="alert alert-success alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <i class="bi bi-check-circle me-1"></i> <?php echo $_SESSION['success_message']; unset($_SESSION['success_message']); ?> </div> <?php endif; ?> <?php if (isset($_SESSION['error_message'])): ?> <div class="alert alert-danger alert-dismissible fade show"> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <i class="bi bi-exclamation-triangle me-1"></i> <?php echo $_SESSION['error_message']; unset($_SESSION['error_message']); ?> </div> <?php endif; ?> <div class="row"> <div class="table-responsive table-orders"> <table class="table m-0"> <thead> <tr> <th>เลขที่เอกสาร</th> <th>ลูกค้า</th> <th>วันที่เอกสาร</th> <th>มูลค่ารวม</th> <th style="width: 120px;"> </th> </tr> </thead> <tbody> <?php while ($invoice = mysqli_fetch_assoc($latest_invoices_result)): ?> <tr> <td><?php echo $invoice['document_no']; ?></td> <td><?php echo $invoice['customer_name']; ?></td> <td><?php echo date('d/m/Y', strtotime($invoice['issue_date'])); ?></td> <td class="text-end"><?php echo isset($invoice['grand_total']) ? number_format($invoice['grand_total'], 2) : '-'; ?></td> <td> <a href="<?php echo $admin_url . '/invoice-print.php?id=' . $invoice['id']; ?>" class="btn btn-info btn-sm" target="_blank"> <i class="bi bi-printer me-1"></i>พิมพ์ </a> </td> </tr> <?php endwhile; ?> </tbody> </table> </div> <!-- /.table-responsive --> </div> </div> <!-- /.card-body --> <div class="card-footer clearfix"> <a href="invoice-list.php" class="btn btn-sm btn-info float-start"> ดูใบกำกับภาษีทั้งหมด </a> </div> <!-- /.card-footer --> </div> </div> </div> </div> <?php $content = ob_get_clean(); $js_script = ''; include 'template_master.php'; ?>