more OOP and restructure utils

This commit is contained in:
Thanakorn S
2026-04-22 15:55:18 +07:00
parent 8834d672ba
commit 35dd1a9fce
31 changed files with 1417 additions and 494 deletions
+4 -14
View File
@@ -2,22 +2,12 @@
session_start();
require '../../../assets/utils/db_auth.php';
require '../../../assets/utils/classes/Reports.php';
$report = new Reports($pdo2, $company_id);
$sql = "SELECT SUM(capacity) as total_capacity, count(*) as total_warehouse
FROM md_warehouse a
WHERE
a.company_id = :company_id
";
$sth = $pdo2->prepare($sql);
$sth->execute([
":company_id" => $company_id
]);
db_check($sth, $answer);
$output = $sth->fetch(PDO::FETCH_ASSOC);
$answer["output"] = $output;
$answer["total_capacity"] = $report->getTotalCapacity();
$answer["total_warehouse"] = $report->getTotalWarehouse();
$answer["success"] = 1;
exit(json_encode($answer));