|
|
|
@ -233,10 +233,8 @@ function getChildCareReport(): Report {
|
|
|
|
|
$Strings->get("Count", false)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$results = $database->select("adults", 'child_care', ["child_care[!]" => null]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$report->setHeader($header);
|
|
|
|
|
|
|
|
|
|
$ages = [];
|
|
|
|
@ -266,6 +264,47 @@ function getChildCareReport(): Report {
|
|
|
|
|
return $report;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a report of the families who still owe money.
|
|
|
|
|
* @global type $database
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function getPaymentDueReport(): Report {
|
|
|
|
|
global $database, $Strings;
|
|
|
|
|
|
|
|
|
|
$report = new Report($Strings->get("Payments Due", false));
|
|
|
|
|
$filter = ["ORDER" => ["familyname" => "ASC"]];
|
|
|
|
|
|
|
|
|
|
$join = [];
|
|
|
|
|
$where = [];
|
|
|
|
|
|
|
|
|
|
$header = [
|
|
|
|
|
$Strings->get("Family", false),
|
|
|
|
|
$Strings->get("Total", false),
|
|
|
|
|
$Strings->get("Paid", false),
|
|
|
|
|
$Strings->get("Due", false),
|
|
|
|
|
$Strings->get("First Names", false)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$payments = $database->select("payments", ['familyid', 'paymentid (id)', 'amount', 'amountpaid']);
|
|
|
|
|
|
|
|
|
|
foreach ($payments as $p) {
|
|
|
|
|
$familynames = $database->select('people', 'lastname', ['familyid' => $p['familyid']]);
|
|
|
|
|
$firstnames = $database->select('people', 'firstname', ['familyid' => $p['familyid']]);
|
|
|
|
|
$report->addDataRow([
|
|
|
|
|
implode(", ", array_unique($familynames)),
|
|
|
|
|
number_format($p["amount"], 2),
|
|
|
|
|
number_format($p["amountpaid"], 2),
|
|
|
|
|
number_format($p["amount"] - $p["amountpaid"], 2),
|
|
|
|
|
implode(", ", $firstnames)
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$report->setHeader($header);
|
|
|
|
|
|
|
|
|
|
return $report;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getReport($type): Report {
|
|
|
|
|
switch ($type) {
|
|
|
|
|
case "campers":
|
|
|
|
@ -283,6 +322,9 @@ function getReport($type): Report {
|
|
|
|
|
case "childcare":
|
|
|
|
|
return getChildCareReport();
|
|
|
|
|
break;
|
|
|
|
|
case "paymentsdue":
|
|
|
|
|
return getPaymentDueReport();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return new Report("error", ["ERROR"], ["Invalid report type."]);
|
|
|
|
|
}
|
|
|
|
|