feature: Initial commit

This commit is contained in:
Keith Solomon
2025-02-08 11:53:31 -06:00
commit a28cf6a713
14 changed files with 1970 additions and 0 deletions

31
includes/bill.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
class Bill {
public static function getAll() {
$db = DB::connect();
return $db->query("SELECT * FROM bills ORDER BY billDate DESC");
}
public static function add($data) {
$db = DB::connect();
$stmt = $db->prepare("INSERT INTO bills
(billDate, billName, amount, paymentId, year)
VALUES (?, ?, ?, ?, ?)");
return $stmt->execute([
$data['date'],
$data['billName'],
$data['amount'],
$data['paymentId'],
$data['year']
]);
}
public static function getYearlyTotals() {
$db = DB::connect();
return $db->query("SELECT year, billName, SUM(amount) as total
FROM bills GROUP BY year, billName");
}
}