csrtechnew.ohctech.in/yearly_budget_excel.php
2025-04-14 13:28:09 +05:30

58 lines
2.1 KiB
PHP

<?php
include('includes/config/config.php');
include('includes/functions.php');
header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=excel_yearly_budget_report.xls');
?>
<html>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<table width="100%" style="margin-top: 20px;">
<tr>
<div style="font-size:12px">
<td width="25%" align="left">Run Date: <?php echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size:20px"><strong>Yearly Budget</strong></td>
<td width="25%" align="left">User: <?php echo $username; ?></td>
</tr>
</table>
<table border="1" width="100%">
<?php
$sql = base64_decode($filterkey); // Decode the filter query
//echo $sql; // Uncomment for debugging if needed
$result = mysqli_query($conn, $sql);
$count = 1; // Start counting from 1
?>
<tr bgcolor="#eeeeee">
<th width="5%">Sr No.</th>
<th width="20%">Program (Year)</th>
<th width="20%">Primary Budget</th>
<th width="12%">Additional Approved Budget</th>
<th width="12%">Total Budget</th>
<th width="12%">Available Budget</th>
</tr>
<?php
// Loop through the results
while ($row1 = mysqli_fetch_array($result)) {
extract($row1);
?>
<tr>
<td align="center"><?php echo $count++; ?></td> <!-- Increment the count on each row -->
<td align="center"><?php echo $year . '/' . ($year + 1); ?></td> <!-- Correct the year calculation -->
<td align="center"><?php echo number_format($primary_budget, 2); ?></td> <!-- Format as currency if needed -->
<td align="center"><?php echo number_format($additional_approved_budget, 2); ?></td> <!-- Format as currency if needed -->
<td align="center"><?php echo number_format($total_budget, 2); ?></td> <!-- Format as currency if needed -->
<td align="center"><?php echo number_format($available_budget, 2); ?></td> <!-- Format as currency if needed -->
</tr>
<?php
}
?>
</table>
</body>
</html>