One Hat Cyber Team
Your IP :
216.73.216.55
Server IP :
5.189.175.239
Server :
Linux panel.gemx-ai.com 5.14.0-570.19.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 4 04:00:24 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
farmersapp
/
church.farmersapp.store
/
View File Name :
tithes.php
<?php require_once 'config.php'; if (!isLoggedIn()) { redirect('index.php'); } // Handle form submission for new tithe if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_tithe'])) { $member_id = $_POST['member_id']; $amount = $_POST['amount']; $payment_date = $_POST['payment_date']; $payment_method = $_POST['payment_method']; $notes = sanitize($_POST['notes']); $receipt_number = 'T' . date('Ymd') . str_pad(rand(1, 999), 3, '0', STR_PAD_LEFT); $stmt = $pdo->prepare("INSERT INTO tithes (member_id, amount, payment_date, payment_method, receipt_number, recorded_by, notes) VALUES (?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$member_id, $amount, $payment_date, $payment_method, $receipt_number, $_SESSION['user_id'], $notes]); $success = "Tithe recorded successfully! Receipt #: " . $receipt_number; } // Handle search $search = isset($_GET['search']) ? sanitize($_GET['search']) : ''; $where = ''; $params = []; if ($search) { $where = " WHERE m.first_name LIKE ? OR m.last_name LIKE ? OR t.receipt_number LIKE ?"; $params = ["%$search%", "%$search%", "%$search%"]; } // Get all tithes $stmt = $pdo->prepare("SELECT t.*, m.first_name, m.last_name, m.member_id as mem_id FROM tithes t JOIN members m ON t.member_id = m.id $where ORDER BY t.payment_date DESC"); $stmt->execute($params); $tithes = $stmt->fetchAll(); // Get members for dropdown $members = $pdo->query("SELECT id, CONCAT(first_name, ' ', last_name) as name, member_id FROM members WHERE membership_status = 'Active' ORDER BY first_name")->fetchAll(); // Get summary $summary = $pdo->query("SELECT SUM(amount) as total, MONTH(payment_date) as month, YEAR(payment_date) as year FROM tithes WHERE YEAR(payment_date) = YEAR(CURDATE()) GROUP BY MONTH(payment_date), YEAR(payment_date) ORDER BY year DESC, month DESC LIMIT 6")->fetchAll(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tithe Management - Church MS</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> :root { --primary: #4f46e5; --primary-dark: #4338ca; --secondary: #7c3aed; --success: #10b981; --warning: #f59e0b; --danger: #ef4444; --light: #f8fafc; --dark: #1e293b; --gray: #64748b; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--light); color: var(--dark); } .dashboard-container { display: flex; min-height: 100vh; } .sidebar { width: 250px; background: white; box-shadow: 0 0 20px rgba(0,0,0,0.1); position: fixed; height: 100vh; z-index: 1000; } .sidebar-header { padding: 25px; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; text-align: center; } .sidebar-header h2 { font-size: 22px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 5px; } .user-info { font-size: 14px; opacity: 0.9; } .sidebar-menu { padding: 20px 0; } .menu-item { display: flex; align-items: center; gap: 12px; padding: 15px 25px; color: var(--gray); text-decoration: none; transition: all 0.3s ease; border-left: 4px solid transparent; } .menu-item:hover, .menu-item.active { background: var(--light); color: var(--primary); border-left-color: var(--primary); } .menu-item i { width: 20px; text-align: center; } .main-content { flex: 1; margin-left: 250px; padding: 20px; } .top-bar { background: white; padding: 20px; border-radius: 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; } .top-bar h1 { color: var(--dark); font-size: 24px; } .user-menu { display: flex; align-items: center; gap: 15px; } .logout-btn { background: var(--danger); color: white; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.3s ease; } .logout-btn:hover { background: #dc2626; transform: translateY(-2px); } .page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; } .btn { padding: 12px 24px; border-radius: 10px; border: none; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; transition: all 0.3s ease; } .btn-primary { background: var(--primary); color: white; } .btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(79, 70, 229, 0.3); } .btn-success { background: var(--success); color: white; } .btn-sm { padding: 8px 15px; font-size: 13px; } .modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center; } .modal-content { background: white; border-radius: 20px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; animation: modalSlide 0.3s ease-out; } @keyframes modalSlide { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } .modal-header { padding: 25px 30px; border-bottom: 1px solid var(--light); display: flex; justify-content: space-between; align-items: center; } .modal-header h3 { font-size: 20px; color: var(--dark); } .close-modal { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray); } .modal-body { padding: 30px; } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; color: var(--dark); font-weight: 600; font-size: 14px; } .form-control { width: 100%; padding: 12px 15px; border: 2px solid var(--light); border-radius: 10px; font-size: 15px; transition: all 0.3s ease; } .form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); } .alert { padding: 15px 20px; border-radius: 10px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; } .alert-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border-left: 4px solid var(--success); } .search-box { display: flex; gap: 10px; margin-bottom: 20px; } .search-box input { flex: 1; padding: 12px 15px; border: 2px solid var(--light); border-radius: 10px; font-size: 15px; } .search-box button { padding: 12px 20px; background: var(--primary); color: white; border: none; border-radius: 10px; cursor: pointer; } .table-container { background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); } .data-table { width: 100%; border-collapse: collapse; } .data-table th { text-align: left; padding: 15px 20px; background: var(--light); color: var(--gray); font-weight: 600; border-bottom: 2px solid var(--light); } .data-table td { padding: 15px 20px; border-bottom: 1px solid var(--light); } .data-table tr:hover { background: var(--light); } .badge { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; } .badge.success { background: rgba(16, 185, 129, 0.1); color: var(--success); } .badge.pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); } .summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; } .summary-card { background: white; padding: 20px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); text-align: center; } .summary-card h3 { color: var(--gray); font-size: 14px; margin-bottom: 10px; } .summary-card .amount { font-size: 28px; font-weight: 700; color: var(--success); } .month { font-size: 12px; color: var(--gray); } @media (max-width: 768px) { .sidebar { width: 100%; height: auto; position: relative; } .main-content { margin-left: 0; } } </style> </head> <body> <div class="dashboard-container"> <!-- Sidebar --> <div class="sidebar"> <div class="sidebar-header"> <h2><i class="fas fa-church"></i> Church MS</h2> <div class="user-info"> <p>Welcome, <?php echo $_SESSION['full_name']; ?></p> <p><?php echo $_SESSION['role']; ?></p> </div> </div> <nav class="sidebar-menu"> <a href="dashboard.php" class="menu-item"> <i class="fas fa-tachometer-alt"></i> <span>Dashboard</span> </a> <a href="members.php" class="menu-item"> <i class="fas fa-users"></i> <span>Members</span> </a> <a href="tithes.php" class="menu-item active"> <i class="fas fa-hand-holding-usd"></i> <span>Tithes</span> </a> <a href="offerings.php" class="menu-item"> <i class="fas fa-donate"></i> <span>Offerings</span> </a> <a href="cottages.php" class="menu-item"> <i class="fas fa-home"></i> <span>Cottages</span> </a> <a href="procurement.php" class="menu-item"> <i class="fas fa-shopping-cart"></i> <span>Procurement</span> </a> <a href="reports.php" class="menu-item"> <i class="fas fa-chart-bar"></i> <span>Reports</span> </a> <a href="users.php" class="menu-item"> <i class="fas fa-user-cog"></i> <span>Users</span> </a> </nav> </div> <!-- Main Content --> <div class="main-content"> <!-- Top Bar --> <div class="top-bar"> <h1>Tithe Management</h1> <div class="user-menu"> <form action="logout.php" method="POST"> <button type="submit" class="logout-btn"> <i class="fas fa-sign-out-alt"></i> Logout </button> </form> </div> </div> <div class="page-header"> <h2>Tithe Records</h2> <button class="btn btn-primary" onclick="openModal()"> <i class="fas fa-plus-circle"></i> Record New Tithe </button> </div> <?php if (isset($success)): ?> <div class="alert alert-success"> <i class="fas fa-check-circle"></i> <?php echo $success; ?> </div> <?php endif; ?> <!-- Monthly Summary --> <div class="summary-cards"> <?php foreach ($summary as $item): ?> <div class="summary-card"> <h3><?php echo date('F Y', strtotime($item['year'] . '-' . $item['month'] . '-01')); ?></h3> <div class="amount">₦<?php echo number_format($item['total'], 2); ?></div> <div class="month">Total Tithes</div> </div> <?php endforeach; ?> </div> <!-- Search Box --> <form method="GET" action="" class="search-box"> <input type="text" name="search" placeholder="Search by name or receipt number..." value="<?php echo htmlspecialchars($search); ?>"> <button type="submit"><i class="fas fa-search"></i> Search</button> <?php if ($search): ?> <a href="tithes.php" class="btn">Clear</a> <?php endif; ?> </form> <!-- Tithes Table --> <div class="table-container"> <table class="data-table"> <thead> <tr> <th>Receipt #</th> <th>Member</th> <th>Amount</th> <th>Date</th> <th>Method</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($tithes as $tithe): ?> <tr> <td><?php echo $tithe['receipt_number']; ?></td> <td><?php echo $tithe['first_name'] . ' ' . $tithe['last_name']; ?> (<?php echo $tithe['mem_id']; ?>)</td> <td><strong>₦<?php echo number_format($tithe['amount'], 2); ?></strong></td> <td><?php echo formatDate($tithe['payment_date']); ?></td> <td> <span class="badge success"><?php echo $tithe['payment_method']; ?></span> </td> <td> <button class="btn btn-sm btn-success" onclick="viewTithe(<?php echo $tithe['id']; ?>)"> <i class="fas fa-eye"></i> View </button> <button class="btn btn-sm" onclick="printReceipt(<?php echo $tithe['id']; ?>)"> <i class="fas fa-print"></i> Print </button> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <!-- Add Tithe Modal --> <div class="modal" id="addTitheModal"> <div class="modal-content"> <div class="modal-header"> <h3><i class="fas fa-hand-holding-usd"></i> Record New Tithe</h3> <button class="close-modal" onclick="closeModal()">×</button> </div> <div class="modal-body"> <form method="POST" action=""> <div class="form-group"> <label>Select Member *</label> <select name="member_id" class="form-control" required> <option value="">Select Member</option> <?php foreach ($members as $member): ?> <option value="<?php echo $member['id']; ?>"> <?php echo $member['name']; ?> (<?php echo $member['member_id']; ?>) </option> <?php endforeach; ?> </select> </div> <div class="form-group"> <label>Amount (₦) *</label> <input type="number" name="amount" step="0.01" min="0" class="form-control" required> </div> <div class="form-group"> <label>Payment Date *</label> <input type="date" name="payment_date" class="form-control" required value="<?php echo date('Y-m-d'); ?>"> </div> <div class="form-group"> <label>Payment Method *</label> <select name="payment_method" class="form-control" required> <option value="Cash">Cash</option> <option value="Mobile Money">Mobile Money</option> <option value="Bank Transfer">Bank Transfer</option> <option value="Check">Check</option> </select> </div> <div class="form-group"> <label>Notes (Optional)</label> <textarea name="notes" class="form-control" rows="3" placeholder="Any additional notes..."></textarea> </div> <div style="display: flex; gap: 10px; justify-content: flex-end;"> <button type="button" class="btn" onclick="closeModal()">Cancel</button> <button type="submit" name="add_tithe" class="btn btn-primary"> <i class="fas fa-save"></i> Save Record </button> </div> </form> </div> </div> </div> <script> function openModal() { document.getElementById('addTitheModal').style.display = 'flex'; } function closeModal() { document.getElementById('addTitheModal').style.display = 'none'; } function viewTithe(id) { window.open('view_tithe.php?id=' + id, '_blank'); } function printReceipt(id) { window.open('print_receipt.php?id=' + id, '_blank'); } // Close modal when clicking outside window.onclick = function(event) { const modal = document.getElementById('addTitheModal'); if (event.target === modal) { closeModal(); } } </script> </body> </html>