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/Backups/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/tabs/Backups/monthly_summary.php-working-live data
<?php
include 'db.php';

$tax_rate = 0.082;
$selected_month = $_GET['month'] ?? date('Y-m');

$months_result = $conn->query("SELECT DISTINCT DATE_FORMAT(date, '%Y-%m') as month FROM transactions
                               UNION
                               SELECT DISTINCT DATE_FORMAT(archived_on, '%Y-%m') as month FROM archived_transactions
                               ORDER BY month DESC");

$months = [];
while ($row = $months_result->fetch_assoc()) {
    $months[] = $row['month'];
}

// Get all customers
$customers_result = $conn->query("SELECT id, first_name, last_name FROM customers ORDER BY last_name, first_name");
$customers = [];
while ($row = $customers_result->fetch_assoc()) {
    $customers[] = $row;
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Monthly Summaries</title>
    <style>
        body { font-family: Arial, sans-serif; background: #f8f8f8; padding: 20px; }
        .container { max-width: 1000px; margin: auto; background: white; padding: 20px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
        h2 { margin-bottom: 10px; }
        select { padding: 6px; margin-bottom: 20px; }
        table { width: 100%; border-collapse: collapse; margin-top: 10px; }
        th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
        th { background: #eee; }
        a.pdf-link { text-decoration: none; color: blue; }
        .back-link { margin-top: 20px; display: inline-block; }
    </style>
</head>
<body>
<div class="container">
    <h2>Monthly Summaries</h2>
    <form method="get">
        <label for="month">Select Month:</label>
        <select name="month" id="month" onchange="this.form.submit()">
            <?php foreach ($months as $month): ?>
                <option value="<?= $month ?>" <?= $month === $selected_month ? 'selected' : '' ?>>
                    <?= date('F Y', strtotime($month . '-01')) ?>
                </option>
            <?php endforeach; ?>
        </select>
    </form>

    <table>
        <thead>
            <tr>
                <th>Customer</th>
                <th>Item Total</th>
                <th>Tax Total</th>
                <th>Total with Tax</th>
                <th>PDF</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($customers as $c): 
                $customer_id = $c['id'];
                $item_total = $tax_total = $grand_total = 0;
                $transactions = [];

                if ($selected_month === date('Y-m')) {
                    // Pull from current transactions
                    $stmt = $conn->prepare("SELECT * FROM transactions WHERE customer_id = ? AND DATE_FORMAT(date, '%Y-%m') = ?");
                    $stmt->bind_param("is", $customer_id, $selected_month);
                } else {
                    // Pull from archived
                    $stmt = $conn->prepare("SELECT * FROM archived_transactions WHERE customer_id = ? AND DATE_FORMAT(archived_on, '%Y-%m') = ?");
                    $stmt->bind_param("is", $customer_id, $selected_month);
                }

                $stmt->execute();
                $result = $stmt->get_result();

                while ($row = $result->fetch_assoc()) {
                    $line_total = $row['price'] * $row['quantity'];
                    $tax = $row['taxable'] ? $line_total * $tax_rate : 0;
                    $item_total += $line_total;
                    $tax_total += $tax;
                    $grand_total += $line_total + $tax;
                }
            ?>
                <tr>
                    <td><?= htmlspecialchars($c['first_name'] . ' ' . $c['last_name']) ?></td>
                    <td>$<?= number_format($item_total, 2) ?></td>
                    <td>$<?= number_format($tax_total, 2) ?></td>
                    <td><strong>$<?= number_format($grand_total, 2) ?></strong></td>
                    <td><a class="pdf-link" href="print_statement.php?customer_id=<?= $customer_id ?>&month=<?= $selected_month ?>" target="_blank">&#128196;</a></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

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

Youez - 2016 - github.com/yon3zu
LinuXploit