403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wcfs/tabs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/tabs/view_credits.php.-b4 fixing NAO
<?php
include 'protect.php';
include 'db.php';

$tax_rate = 0.082;

// Get current month boundaries
$start_date = date('Y-m-01');
$end_date = date('Y-m-t');

// Query to get total per customer (archived + current)
$stmt = $conn->prepare("
    SELECT customer_id, first_name, last_name, SUM(total_with_tax) AS net_total FROM (
        SELECT t.customer_id, c.first_name, c.last_name,
               (t.quantity * t.price + CASE WHEN t.taxable = 1 THEN t.quantity * t.price * ? ELSE 0 END) AS total_with_tax
        FROM transactions t
        JOIN customers c ON t.customer_id = c.id
        WHERE t.date BETWEEN ? AND ?
        
        UNION ALL
        
        SELECT a.customer_id, c.first_name, c.last_name,
               (a.quantity * a.price + CASE WHEN a.taxable = 1 THEN a.quantity * a.price * ? ELSE 0 END) AS total_with_tax
        FROM archived_transactions a
        JOIN customers c ON a.customer_id = c.id
        WHERE a.original_date BETWEEN ? AND ?
    ) AS combined
    GROUP BY customer_id, first_name, last_name
    HAVING net_total < 0
    ORDER BY last_name, first_name
");

$stmt->bind_param("dssdss", $tax_rate, $start_date, $end_date, $tax_rate, $start_date, $end_date);
$stmt->execute();
$result = $stmt->get_result();
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Customers with Credit</title>
    <style>
        body { font-family: 'Segoe UI', sans-serif; padding: 30px; background: #f7f7f7; }
        .container { background: #fff; padding: 30px; max-width: 800px; margin: auto; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
        h2 { margin-top: 0; }
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        th, td { padding: 12px; border: 1px solid #ccc; text-align: left; }
        th { background: #eee; }
        .red { color: red; }
        .back-link {
            display: inline-block;
            margin-top: 20px;
            text-decoration: none;
            color: #2196F3;
        }
        .back-link:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>Customers with Credit (Negative Balance)</h2>

    <?php if ($result->num_rows > 0): ?>
        <table>
            <thead>
                <tr>
                    <th>Customer</th>
                    <th>Amount</th>
                </tr>
            </thead>
            <tbody>
                <?php while ($row = $result->fetch_assoc()): ?>
                    <tr>
                        <td>
                            <a href="view_account.php?customer_id=<?= $row['customer_id'] ?>">
                                <?= htmlspecialchars($row['last_name'] . ', ' . $row['first_name']) ?>
                            </a>
                        </td>
                        <td class="red">- $<?= number_format(abs($row['net_total']), 2) ?></td>
                    </tr>
                <?php endwhile; ?>
            </tbody>
        </table>
    <?php else: ?>
        <p><em>No customers with credit for the selected period.</em></p>
    <?php endif; ?>

    <a class="back-link" href="index.php">&larr; Back to Dashboard</a>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit