67 lines
3.0 KiB
PHP
67 lines
3.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/db/config.php';
|
|
require_once __DIR__ . '/includes/auth_helper.php';
|
|
Auth::requireLogin();
|
|
|
|
$tenant_id = (int)$_SESSION['tenant_id'];
|
|
|
|
// Fetch company settings to get fiscal year end
|
|
$stmt = db()->prepare("SELECT fiscal_year_end FROM company_settings WHERE id = 1");
|
|
$stmt->execute();
|
|
$settings = $stmt->fetch();
|
|
|
|
$fiscal_year_end = $settings['fiscal_year_end'] ?? null;
|
|
|
|
// Determine possible years based on data
|
|
$years = [];
|
|
$res = db()->query("SELECT DISTINCT YEAR(entry_date) as y FROM labour_entries UNION SELECT DISTINCT YEAR(entry_date) as y FROM expenses ORDER BY y DESC");
|
|
while($row = $res->fetch()) {
|
|
$years[] = (int)$row['y'];
|
|
}
|
|
if (empty($years)) $years[] = (int)date('Y');
|
|
|
|
$pageTitle = "SR&ED Claim Report Selector";
|
|
include __DIR__ . '/includes/header.php';
|
|
?>
|
|
|
|
<div class="container py-5">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-6">
|
|
<div class="card border-0 shadow-sm">
|
|
<div class="card-body p-5 text-center">
|
|
<i class="bi bi-file-earmark-bar-graph text-primary mb-4" style="font-size: 3rem;"></i>
|
|
<h2 class="fw-bold mb-3">SRED Claim Report</h2>
|
|
<p class="text-muted mb-4">Generate a comprehensive Scientific Research and Experimental Development (SR&ED) claim report for a specific fiscal year.</p>
|
|
|
|
<form action="sred_claim_report.php" method="GET">
|
|
<div class="mb-4 text-start">
|
|
<label class="form-label fw-bold small text-uppercase">Select Fiscal Year</label>
|
|
<select name="year" class="form-select form-select-lg">
|
|
<?php foreach($years as $y): ?>
|
|
<option value="<?= $y ?>" <?= $y == date('Y') ? 'selected' : '' ?>><?= $y ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<?php if ($fiscal_year_end): ?>
|
|
<div class="form-text mt-2">
|
|
Your fiscal year ends on: <strong><?= date('F jS', strtotime($fiscal_year_end)) ?></strong>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="form-text mt-2 text-warning">
|
|
<i class="bi bi-exclamation-triangle"></i> Fiscal year end not set in <a href="company_settings.php">Company Preferences</a>.
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary btn-lg w-100">
|
|
Generate Report <i class="bi bi-arrow-right ms-2"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|