31 lines
824 B
PHP
31 lines
824 B
PHP
<?php
|
|
|
|
include "db.php";
|
|
|
|
$Years = array('2020/2021','2021/2022','2022/2023','2023/2024');
|
|
|
|
for ($i = 0; $i < count($Years); $i++) {
|
|
$school_year = $Years[$i];
|
|
|
|
$annual = 0;
|
|
|
|
$query = "SELECT payment_method, substring(payment_date,1,7) AS month, sum(amount_paid) AS total " .
|
|
"FROM invoice_header " .
|
|
"WHERE school_year = '$school_year' " .
|
|
"AND payment_method = 'PayPal' " .
|
|
"AND status = 'Paid' " .
|
|
"GROUP BY 1,2";
|
|
$results = db_query($query);
|
|
|
|
echo("$school_year\n");
|
|
while ($row = db_fetch_assoc($results)) {
|
|
extract($row);
|
|
$annual += $total;
|
|
if ($total > 0) printf(" %s %10s\n",$month,'$'.number_format($total,2));
|
|
}
|
|
if ($annual > 0) printf(" %10s\n",'$'.number_format($annual,2));
|
|
echo("\n");
|
|
}
|
|
|
|
?>
|