????????????????????
??????????????????
ÿØÿà
 JFIF      ÿÛ C      


!"$"$ÿÛ C    
ÿÂ p 
" ÿÄ     
         ÿÄ             ÿÚ 
   ÕÔË®

(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

adadasdasdasasdasdas


.....................................................................................................................................????????????????????
??????????????????
ÿØÿà
 JFIF      ÿÛ C      


!"$"$ÿÛ C    
ÿÂ p 
" ÿÄ     
         ÿÄ             ÿÚ 
   ÕÔË®

(%	aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥	BQ¤¢ X«)X…€¤   @  

adadasdasdasasdasdas


.....................................................................................................................................<?php
// Simple check to see what's in the fees table
include 'connection.php';

echo "<h2>Simple Fee Data Check</h2>";

// Check basic connection
if ($conn) {
    echo "<p style='color:green;'>✓ Database connected successfully</p>";
} else {
    echo "<p style='color:red;'>✗ Database connection failed</p>";
    exit;
}

// List all tables in the database
echo "<h3>Available Tables:</h3>";
$show_tables = "SHOW TABLES";
$tables_result = $conn->query($show_tables);

if ($tables_result) {
    echo "<ul>";
    while ($table = $tables_result->fetch_array()) {
        echo "<li>" . $table[0] . "</li>";
    }
    echo "</ul>";
} else {
    echo "<p style='color:red;'>Error getting tables: " . $conn->error . "</p>";
}

// Check if fees table exists
$check_fees = "SHOW TABLES LIKE 'fees'";
$fees_exists = $conn->query($check_fees);

if ($fees_exists && $fees_exists->num_rows > 0) {
    echo "<p style='color:green;'>✓ Fees table exists</p>";
    
    // Get fees table structure
    echo "<h3>Fees Table Structure:</h3>";
    $describe_fees = "DESCRIBE fees";
    $structure_result = $conn->query($describe_fees);
    
    if ($structure_result) {
        echo "<table border='1' cellpadding='5'>";
        echo "<tr><th>Field</th><th>Type</th><th>Null</th><th>Key</th><th>Default</th></tr>";
        while ($row = $structure_result->fetch_assoc()) {
            echo "<tr>";
            echo "<td>" . $row['Field'] . "</td>";
            echo "<td>" . $row['Type'] . "</td>";
            echo "<td>" . $row['Null'] . "</td>";
            echo "<td>" . $row['Key'] . "</td>";
            echo "<td>" . $row['Default'] . "</td>";
            echo "</tr>";
        }
        echo "</table>";
    }
    
    // Count records
    $count_query = "SELECT COUNT(*) as total FROM fees";
    $count_result = $conn->query($count_query);
    
    if ($count_result) {
        $count = $count_result->fetch_assoc()['total'];
        echo "<p><strong>Total records in fees table:</strong> $count</p>";
        
        if ($count > 0) {
            // Show first few records
            echo "<h3>Sample Records from Fees Table:</h3>";
            $sample_query = "SELECT * FROM fees ORDER BY id DESC LIMIT 5";
            $sample_result = $conn->query($sample_query);
            
            if ($sample_result && $sample_result->num_rows > 0) {
                echo "<table border='1' cellpadding='5' style='font-size: 12px;'>";
                echo "<tr>";
                echo "<th>ID</th><th>MR No</th><th>Admission No</th><th>Student Name</th>";
                echo "<th>Course</th><th>Total Fee</th><th>Due Amount</th>";
                echo "<th>Paid Amount</th><th>Received Amount</th><th>Payment Date</th>";
                echo "</tr>";
                
                while ($row = $sample_result->fetch_assoc()) {
                    echo "<tr>";
                    echo "<td>" . ($row['id'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['mr_no'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['admission_no'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['student_name'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['course_name'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['total_fee'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['due_amount'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['paid_amount'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['received_amount'] ?? 'NULL') . "</td>";
                    echo "<td>" . ($row['payment_date'] ?? 'NULL') . "</td>";
                    echo "</tr>";
                }
                echo "</table>";
            } else {
                echo "<p style='color:red;'>Error fetching sample records: " . $conn->error . "</p>";
            }
        } else {
            echo "<p style='color:orange;'><strong>ISSUE FOUND:</strong> The fees table exists but has 0 records!</p>";
            echo "<p>You need to create some fee records first.</p>";
            echo "<p><a href='create-fee.php' style='background:#007bff;color:white;padding:10px;text-decoration:none;border-radius:5px;'>Create Fee Record</a></p>";
        }
    } else {
        echo "<p style='color:red;'>Error counting records: " . $conn->error . "</p>";
    }
    
} else {
    echo "<p style='color:red;'>✗ Fees table does not exist!</p>";
    echo "<p>The fees table needs to be created first.</p>";
}

// Check accounts table too
echo "<hr>";
$check_accounts = "SHOW TABLES LIKE 'accounts'";
$accounts_exists = $conn->query($check_accounts);

if ($accounts_exists && $accounts_exists->num_rows > 0) {
    echo "<p style='color:green;'>✓ Accounts table exists</p>";
    
    $count_accounts = "SELECT COUNT(*) as total FROM accounts";
    $accounts_count_result = $conn->query($count_accounts);
    
    if ($accounts_count_result) {
        $accounts_count = $accounts_count_result->fetch_assoc()['total'];
        echo "<p><strong>Total records in accounts table:</strong> $accounts_count</p>";
    }
} else {
    echo "<p style='color:orange;'>⚠ Accounts table does not exist (this is optional)</p>";
}

$conn->close();
?>

<style>
    body { font-family: Arial, sans-serif; margin: 20px; }
    table { border-collapse: collapse; margin: 10px 0; }
    th { background-color: #f2f2f2; }
    pre { background: #f8f8f8; padding: 10px; border: 1px solid #ddd; }
</style>

<hr>
<p><strong>Quick Links:</strong></p>
<ul>
    <li><a href="fee-report.php">Fee Report</a></li>
    <li><a href="create-fee.php">Create Fee</a></li>
    <li><a href="debug_fee_report.php">Detailed Debug</a></li>
</ul>