<?php
session_start();
include 'db.php';
include 'layout.php';
include 'auth.php';
require_right('View Expense Accounts');

// Check if the new columns exist
$columns_exist = false;
$result = mysqli_query($conn, "SHOW COLUMNS FROM expense_accounts LIKE 'chart_of_account_id'");
if ($result && mysqli_num_rows($result) > 0) {
    $columns_exist = true;
}
?>

<div class="page-wrapper">
    <div class="content">
        <div class="page-header">
            <div class="row">
                <div class="col-sm-12">
                    <h3 class="page-title">Expense Accounts</h3>
                    <ul class="breadcrumb">
                        <li class="breadcrumb-item"><a href="index.php">Dashboard</a></li>
                        <li class="breadcrumb-item active">Expense Accounts</li>
                    </ul>
                </div>
            </div>
        </div>

        <!-- Add Account Button -->
        <div class="row mb-3">
            <div class="col-12">
                <?php if (!$columns_exist): ?>
                    <div class="alert alert-warning alert-sm mb-2">
                        <small><i class="fa fa-exclamation-triangle"></i> Database columns not added yet. Run the SQL queries first.</small>
                    </div>
                <?php endif; ?>
                
                <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addExpenseAccountModal">
                    <i class="fa fa-plus"></i> Add Expense Account
                </button>
            </div>
        </div>

        <!-- Expense Accounts Table -->
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h4 class="card-title">Expense Accounts</h4>
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table datatable" id="expenseAccountsTable">
                                <thead>
                                    <tr>
                                        <th>Account</th>
                                        <th>Category</th>
                                        <th>Subcategory</th>
                                        <th>Chart of Account Mapping</th>
                                        <th>Mapping Status</th>
                                        <th>Financial Impact</th>
                                        <th>Actions</th>
                                    </tr>
                                </thead>
                                <tbody id="expenseAccountsTableBody">
                                    <?php if (!$columns_exist): ?>
                                        <!-- Fallback display when columns don't exist -->
                                        <?php
                                        $res = mysqli_query($conn, "
                                            SELECT ea.name, ec.name AS category, esc.name AS subcategory, ea.id
                                            FROM expense_accounts ea
                                            JOIN expense_categories ec ON ea.category_id = ec.id
                                            JOIN expense_subcategories esc ON ea.subcategory_id = esc.id
                                        ");
                                        while ($row = mysqli_fetch_assoc($res)) {
                                            echo "<tr>
                                                    <td><strong>{$row['name']}</strong></td>
                                                    <td>{$row['category']}</td>
                                                    <td>{$row['subcategory']}</td>
                                                    <td><span class='text-muted'>Database columns not added</span></td>
                                                    <td><span class='badge bg-warning'>Not Mapped</span></td>
                                                    <td><span class='text-muted'>N/A</span></td>
                                                    <td>
                                                        <button class='btn btn-sm btn-outline-primary' onclick='openMapModal({$row['id']}, \"{$row['name']}\")'>
                                                            <i class='fa fa-link'></i> Map
                                                        </button>
                                                    </td>
                                                  </tr>";
                                        }
                                        ?>
                                    <?php endif; ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Add Expense Account Modal -->
<div class="modal fade" id="addExpenseAccountModal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Add New Expense Account</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <div class="modal-body">
                <form id="addExpenseAccountForm">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="mb-3">
                                <label for="accountName" class="form-label">Account Name *</label>
                                <input type="text" class="form-control" id="accountName" name="account_name" required>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label for="categorySelect" class="form-label">Category *</label>
                                <select class="form-select" id="categorySelect" name="category_id" required>
                                    <option value="">Select Category</option>
                                    <?php
                                    $res = mysqli_query($conn, "SELECT * FROM expense_categories ORDER BY name");
                                    while ($row = mysqli_fetch_assoc($res)) {
                                        echo "<option value='{$row['id']}'>{$row['name']}</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label for="subcategorySelect" class="form-label">Subcategory *</label>
                                <select class="form-select" id="subcategorySelect" name="subcategory_id" required>
                                    <option value="">Select Subcategory</option>
                                    <?php
                                    $res = mysqli_query($conn, "SELECT * FROM expense_subcategories ORDER BY name");
                                    while ($row = mysqli_fetch_assoc($res)) {
                                        echo "<option value='{$row['id']}'>{$row['name']}</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    
                    <hr>
                    
                    <div class="row">
                        <div class="col-md-12">
                            <div class="mb-3">
                                <label for="chartAccountSelect" class="form-label">Map to Chart of Account</label>
                                <select class="form-select" id="chartAccountSelect" name="chart_of_account_id">
                                    <option value="">Select an expense account from Chart of Accounts (Optional)</option>
                                    <?php
                                    // Get expense accounts from chart of accounts
                                    $res = mysqli_query($conn, "
                                        SELECT id, account_code, account_name, account_category 
                                        FROM chart_of_accounts 
                                        WHERE account_type = 'expense' AND is_active = 1 
                                        ORDER BY account_code
                                    ");
                                    while ($row = mysqli_fetch_assoc($res)) {
                                        $category = ucwords(str_replace('_', ' ', $row['account_category']));
                                        echo "<option value='{$row['id']}' data-code='{$row['account_code']}' data-category='{$category}'>
                                            {$row['account_code']} - {$row['account_name']} ({$category})
                                        </option>";
                                    }
                                    ?>
                                </select>
                                <small class="text-muted">You can map this expense account to a chart of account now or later</small>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row mt-3" id="selectedAccountInfo" style="display: none;">
                        <div class="col-md-12">
                            <div class="alert alert-success">
                                <strong>Selected Chart Account:</strong> <span id="selectedAccountDetails"></span>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-primary" id="saveExpenseAccountBtn">Save Expense Account</button>
            </div>
        </div>
    </div>
</div>

<!-- Map to Chart of Account Modal -->
<div class="modal fade" id="mapAccountModal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Map to Chart of Account</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <div class="modal-body">
                <div class="row mb-3">
                    <div class="col-md-12">
                        <div class="alert alert-info">
                            <strong>Expense Account:</strong> <span id="expenseAccountName"></span>
                        </div>
                    </div>
                </div>
                
                <div class="row">
                    <div class="col-md-12">
                        <label for="mapChartAccountSelect" class="form-label">Select Chart of Account *</label>
                        <select class="form-select" id="mapChartAccountSelect" required>
                            <option value="">Select an expense account from Chart of Accounts</option>
                            <?php
                            // Get expense accounts from chart of accounts
                            $res = mysqli_query($conn, "
                                SELECT id, account_code, account_name, account_category 
                                FROM chart_of_accounts 
                                WHERE account_type = 'expense' AND is_active = 1 
                                ORDER BY account_code
                            ");
                            while ($row = mysqli_fetch_assoc($res)) {
                                $category = ucwords(str_replace('_', ' ', $row['account_category']));
                                echo "<option value='{$row['id']}' data-code='{$row['account_code']}' data-category='{$category}'>
                                    {$row['account_code']} - {$row['account_name']} ({$category})
                                </option>";
                            }
                            ?>
                        </select>
                        <small class="text-muted">Only expense accounts from Chart of Accounts are shown</small>
                    </div>
                </div>
                
                <div class="row mt-3" id="mapSelectedAccountInfo" style="display: none;">
                    <div class="col-md-12">
                        <div class="alert alert-success">
                            <strong>Selected Account:</strong> <span id="mapSelectedAccountDetails"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-primary" id="saveMappingBtn" disabled>Save Mapping</button>
            </div>
        </div>
    </div>
</div>

<!-- Edit Expense Account Modal -->
<div class="modal fade" id="editExpenseAccountModal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Edit Expense Account</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>
            <div class="modal-body">
                <form id="editExpenseAccountForm">
                    <input type="hidden" id="editAccountId" name="account_id">
                    
                    <div class="row">
                        <div class="col-md-12">
                            <div class="mb-3">
                                <label for="editAccountName" class="form-label">Account Name *</label>
                                <input type="text" class="form-control" id="editAccountName" name="account_name" required>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label for="editCategorySelect" class="form-label">Category *</label>
                                <select class="form-select" id="editCategorySelect" name="category_id" required>
                                    <option value="">Select Category</option>
                                    <?php
                                    $res = mysqli_query($conn, "SELECT * FROM expense_categories ORDER BY name");
                                    while ($row = mysqli_fetch_assoc($res)) {
                                        echo "<option value='{$row['id']}'>{$row['name']}</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label for="editSubcategorySelect" class="form-label">Subcategory *</label>
                                <select class="form-select" id="editSubcategorySelect" name="subcategory_id" required>
                                    <option value="">Select Subcategory</option>
                                    <?php
                                    $res = mysqli_query($conn, "SELECT * FROM expense_subcategories ORDER BY name");
                                    while ($row = mysqli_fetch_assoc($res)) {
                                        echo "<option value='{$row['id']}'>{$row['name']}</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    
                    <hr>
                    
                    <div class="row">
                        <div class="col-md-12">
                            <div class="mb-3">
                                <label for="editChartAccountSelect" class="form-label">Map to Chart of Account</label>
                                <select class="form-select" id="editChartAccountSelect" name="chart_of_account_id">
                                    <option value="">Select an expense account from Chart of Accounts (Optional)</option>
                                    <?php
                                    // Get expense accounts from chart of accounts
                                    $res = mysqli_query($conn, "
                                        SELECT id, account_code, account_name, account_category 
                                        FROM chart_of_accounts 
                                        WHERE account_type = 'expense' AND is_active = 1 
                                        ORDER BY account_code
                                    ");
                                    while ($row = mysqli_fetch_assoc($res)) {
                                        $category = ucwords(str_replace('_', ' ', $row['account_category']));
                                        echo "<option value='{$row['id']}' data-code='{$row['account_code']}' data-category='{$category}'>
                                            {$row['account_code']} - {$row['account_name']} ({$category})
                                        </option>";
                                    }
                                    ?>
                                </select>
                                <small class="text-muted">You can map this expense account to a chart of account or change existing mapping</small>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row mt-3" id="editSelectedAccountInfo" style="display: none;">
                        <div class="col-md-12">
                            <div class="alert alert-success">
                                <strong>Selected Chart Account:</strong> <span id="editSelectedAccountDetails"></span>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-primary" id="updateExpenseAccountBtn">Update Expense Account</button>
            </div>
        </div>
    </div>
</div>

<script>
let currentExpenseAccountId = null;
let columnsExist = <?php echo $columns_exist ? 'true' : 'false'; ?>;

// Load expense accounts on page load
document.addEventListener('DOMContentLoaded', function() {
    if (columnsExist) {
        loadExpenseAccounts();
    } else {
        console.log('Database columns not added yet. Using fallback display.');
    }
    
    // Initialize form event listeners
    initializeFormListeners();
});

function initializeFormListeners() {
    // Handle chart account selection in add modal
    document.getElementById('chartAccountSelect').addEventListener('change', function() {
        const selectedOption = this.options[this.selectedIndex];
        const infoDiv = document.getElementById('selectedAccountInfo');
        const detailsSpan = document.getElementById('selectedAccountDetails');
        
        if (this.value) {
            const accountCode = selectedOption.getAttribute('data-code');
            const accountName = selectedOption.text;
            const category = selectedOption.getAttribute('data-category');
            
            detailsSpan.textContent = `${accountCode} - ${accountName} (${category})`;
            infoDiv.style.display = 'block';
        } else {
            infoDiv.style.display = 'none';
        }
    });
    
    // Handle chart account selection in map modal
    document.getElementById('mapChartAccountSelect').addEventListener('change', function() {
        const selectedOption = this.options[this.selectedIndex];
        const saveBtn = document.getElementById('saveMappingBtn');
        const infoDiv = document.getElementById('mapSelectedAccountInfo');
        const detailsSpan = document.getElementById('mapSelectedAccountDetails');
        
        if (this.value) {
            const accountCode = selectedOption.getAttribute('data-code');
            const accountName = selectedOption.text;
            const category = selectedOption.getAttribute('data-category');
            
            detailsSpan.textContent = `${accountCode} - ${accountName} (${category})`;
            infoDiv.style.display = 'block';
            saveBtn.disabled = false;
        } else {
            infoDiv.style.display = 'none';
            saveBtn.disabled = true;
        }
    });
    
    // Handle chart account selection in edit modal
    document.getElementById('editChartAccountSelect').addEventListener('change', function() {
        const selectedOption = this.options[this.selectedIndex];
        const infoDiv = document.getElementById('editSelectedAccountInfo');
        const detailsSpan = document.getElementById('editSelectedAccountDetails');
        
        if (this.value) {
            const accountCode = selectedOption.getAttribute('data-code');
            const accountName = selectedOption.text;
            const category = selectedOption.getAttribute('data-category');
            
            detailsSpan.textContent = `${accountCode} - ${accountName} (${category})`;
            infoDiv.style.display = 'block';
        } else {
            infoDiv.style.display = 'none';
        }
    });
}

function loadExpenseAccounts() {
    if (!columnsExist) {
        console.log('Cannot load accounts via AJAX - columns not added yet');
        return;
    }
    
    fetch('ajax/map_expense_account.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: 'action=get_expense_accounts'
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            renderExpenseAccounts(data.data);
        } else {
            console.error('Error loading expense accounts:', data.message);
            document.getElementById('expenseAccountsTableBody').innerHTML = 
                '<tr><td colspan="6" class="text-center text-danger">Error loading accounts: ' + data.message + '</td></tr>';
        }
    })
    .catch(error => {
        console.error('Error:', error);
        document.getElementById('expenseAccountsTableBody').innerHTML = 
            '<tr><td colspan="6" class="text-center text-danger">Error loading accounts. Check console for details.</td></tr>';
    });
}

function renderExpenseAccounts(accounts) {
    const tbody = document.getElementById('expenseAccountsTableBody');
    tbody.innerHTML = '';
    
    accounts.forEach(account => {
        const row = document.createElement('tr');
        const mappingStatus = account.chart_of_account_id ? 
            `<span class="badge bg-success">Mapped</span>` : 
            `<span class="badge bg-warning">Not Mapped</span>`;
        
        const mappingInfo = account.chart_of_account_id ? 
            `<strong>${account.account_code} - ${account.chart_account_name}</strong><br>
             <small class="text-muted">Mapped on: ${new Date(account.mapped_at).toLocaleDateString()}</small>` :
            `<span class="text-muted">No mapping</span>`;
        
        // Financial Impact Information
        let financialImpact = '<span class="text-muted">N/A</span>';
        if (account.chart_of_account_id) {
            financialImpact = `
                <div class="text-success">
                    <i class="fa fa-chart-line"></i> <strong>Active</strong><br>
                    <small>Expenses will create journal entries</small>
                </div>
            `;
        } else {
            financialImpact = `
                <div class="text-warning">
                    <i class="fa fa-exclamation-triangle"></i> <strong>No Impact</strong><br>
                    <small>Expenses won't affect financial statements</small>
                </div>
            `;
        }
        
        const actionButton = account.chart_of_account_id ?
            `<button class="btn btn-sm btn-outline-primary" onclick="openEditModal(${account.id}, '${account.name}', ${account.category_id}, ${account.subcategory_id}, ${account.chart_of_account_id})">
                <i class="fa fa-edit"></i> Edit
             </button>` :
            `<button class="btn btn-sm btn-outline-primary" onclick="openEditModal(${account.id}, '${account.name}', ${account.category_id}, ${account.subcategory_id}, null)">
                <i class="fa fa-edit"></i> Edit
             </button>`;
        
        row.innerHTML = `
            <td><strong>${account.name}</strong></td>
            <td>${account.category_name}</td>
            <td>${account.subcategory_name}</td>
            <td>${mappingInfo}</td>
            <td>${mappingStatus}</td>
            <td>${financialImpact}</td>
            <td>${actionButton}</td>
        `;
        
        tbody.appendChild(row);
    });
}

function openEditModal(expenseAccountId, expenseAccountName, categoryId, subcategoryId, chartAccountId) {
    // Set form values
    document.getElementById('editAccountId').value = expenseAccountId;
    document.getElementById('editAccountName').value = expenseAccountName;
    document.getElementById('editCategorySelect').value = categoryId;
    document.getElementById('editSubcategorySelect').value = subcategoryId;
    document.getElementById('editChartAccountSelect').value = chartAccountId || '';
    
    // Show/hide selected account info
    const infoDiv = document.getElementById('editSelectedAccountInfo');
    const detailsSpan = document.getElementById('editSelectedAccountDetails');
    
    if (chartAccountId) {
        const selectedOption = document.querySelector(`#editChartAccountSelect option[value="${chartAccountId}"]`);
        if (selectedOption) {
            const accountCode = selectedOption.getAttribute('data-code');
            const accountName = selectedOption.text;
            const category = selectedOption.getAttribute('data-category');
            
            detailsSpan.textContent = `${accountCode} - ${accountName} (${category})`;
            infoDiv.style.display = 'block';
        }
    } else {
        infoDiv.style.display = 'none';
    }
    
    new bootstrap.Modal(document.getElementById('editExpenseAccountModal')).show();
}

function openMapModal(expenseAccountId, expenseAccountName) {
    currentExpenseAccountId = expenseAccountId;
    document.getElementById('expenseAccountName').textContent = expenseAccountName;
    document.getElementById('mapChartAccountSelect').value = '';
    document.getElementById('mapSelectedAccountInfo').style.display = 'none';
    document.getElementById('saveMappingBtn').disabled = true;
    
    new bootstrap.Modal(document.getElementById('mapAccountModal')).show();
}

// Handle save mapping
document.getElementById('saveMappingBtn').addEventListener('click', function() {
    if (!columnsExist) {
        Swal.fire('Error', 'Database columns not added yet. Please run the SQL queries first.', 'error');
        return;
    }
    
    const chartAccountId = document.getElementById('mapChartAccountSelect').value;
    
    if (!chartAccountId || !currentExpenseAccountId) {
        Swal.fire('Error', 'Please select a chart of account', 'error');
        return;
    }
    
    fetch('ajax/map_expense_account.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: `action=map_account&expense_account_id=${currentExpenseAccountId}&chart_of_account_id=${chartAccountId}`
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            Swal.fire('Success', data.message, 'success');
            bootstrap.Modal.getInstance(document.getElementById('mapAccountModal')).hide();
            loadExpenseAccounts();
        } else {
            Swal.fire('Error', data.message, 'error');
        }
    })
    .catch(error => {
        console.error('Error:', error);
        Swal.fire('Error', 'An error occurred while saving the mapping', 'error');
    });
});

// Handle save expense account
document.getElementById('saveExpenseAccountBtn').addEventListener('click', function() {
    const form = document.getElementById('addExpenseAccountForm');
    const formData = new FormData(form);
    
    // Validate required fields
    const accountName = formData.get('account_name');
    const categoryId = formData.get('category_id');
    const subcategoryId = formData.get('subcategory_id');
    
    if (!accountName || !categoryId || !subcategoryId) {
        Swal.fire('Error', 'Please fill in all required fields', 'error');
        return;
    }
    
    // Prepare data for AJAX
    const data = new URLSearchParams();
    data.append('action', 'add_expense_account');
    data.append('account_name', accountName);
    data.append('category_id', categoryId);
    data.append('subcategory_id', subcategoryId);
    
    const chartAccountId = formData.get('chart_of_account_id');
    if (chartAccountId) {
        data.append('chart_of_account_id', chartAccountId);
    }
    
    fetch('ajax/map_expense_account.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: data.toString()
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            Swal.fire('Success', data.message, 'success');
            bootstrap.Modal.getInstance(document.getElementById('addExpenseAccountModal')).hide();
            form.reset();
            document.getElementById('selectedAccountInfo').style.display = 'none';
            
            if (columnsExist) {
                loadExpenseAccounts();
            } else {
                location.reload();
            }
        } else {
            Swal.fire('Error', data.message, 'error');
        }
    })
    .catch(error => {
        console.error('Error:', error);
        Swal.fire('Error', 'An error occurred while saving the expense account', 'error');
    });
});

// Handle update expense account
document.getElementById('updateExpenseAccountBtn').addEventListener('click', function() {
    const form = document.getElementById('editExpenseAccountForm');
    const formData = new FormData(form);
    
    // Validate required fields
    const accountId = formData.get('account_id');
    const accountName = formData.get('account_name');
    const categoryId = formData.get('category_id');
    const subcategoryId = formData.get('subcategory_id');
    
    if (!accountId || !accountName || !categoryId || !subcategoryId) {
        Swal.fire('Error', 'Please fill in all required fields', 'error');
        return;
    }
    
    // Prepare data for AJAX
    const data = new URLSearchParams();
    data.append('action', 'update_expense_account');
    data.append('account_id', accountId);
    data.append('account_name', accountName);
    data.append('category_id', categoryId);
    data.append('subcategory_id', subcategoryId);
    
    const chartAccountId = formData.get('chart_of_account_id');
    if (chartAccountId) {
        data.append('chart_of_account_id', chartAccountId);
    }
    
    fetch('ajax/map_expense_account.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: data.toString()
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            Swal.fire('Success', data.message, 'success');
            bootstrap.Modal.getInstance(document.getElementById('editExpenseAccountModal')).hide();
            
            if (columnsExist) {
                loadExpenseAccounts();
            } else {
                location.reload();
            }
        } else {
            Swal.fire('Error', data.message, 'error');
        }
    })
    .catch(error => {
        console.error('Error:', error);
        Swal.fire('Error', 'An error occurred while updating the expense account', 'error');
    });
});
</script>

</body>
</html>


