accounting workflows

This commit is contained in:
Thanakorn S
2026-05-20 10:17:02 +07:00
parent 04a683bd02
commit 7396db6ffc
199 changed files with 23539 additions and 5345 deletions
@@ -13,7 +13,7 @@ class DepartmentManager
public function getAll(): array
{
$sth = $this->pdo->prepare(
"SELECT * FROM ac_department
"SELECT * FROM md_department
WHERE company_id = :cid
ORDER BY dept_code ASC"
);
@@ -24,7 +24,7 @@ class DepartmentManager
public function getById(int $id): ?array
{
$sth = $this->pdo->prepare(
"SELECT * FROM ac_department
"SELECT * FROM md_department
WHERE company_id = :cid AND id = :id LIMIT 1"
);
$sth->execute([':cid' => $this->companyId, ':id' => $id]);
@@ -35,7 +35,7 @@ class DepartmentManager
public function create(array $data): int
{
$sth = $this->pdo->prepare(
"INSERT INTO ac_department (company_id, dept_code, dept_name, description, status)
"INSERT INTO md_department (company_id, dept_code, dept_name, description, status)
VALUES (:cid, :code, :name, :desc, :status)"
);
$sth->execute([
@@ -51,7 +51,7 @@ class DepartmentManager
public function update(int $id, array $data): void
{
$sth = $this->pdo->prepare(
"UPDATE ac_department SET
"UPDATE md_department SET
dept_code = :code,
dept_name = :name,
description = :desc,
@@ -71,7 +71,7 @@ class DepartmentManager
public function delete(int $id): void
{
$sth = $this->pdo->prepare(
"UPDATE ac_department SET status = 0
"UPDATE md_department SET status = 0
WHERE company_id = :cid AND id = :id"
);
$sth->execute([':cid' => $this->companyId, ':id' => $id]);
@@ -83,7 +83,7 @@ class DepartmentManager
"SELECT COUNT(*) AS total,
SUM(status = 1) AS active,
SUM(status = 0) AS inactive
FROM ac_department WHERE company_id = :cid"
FROM md_department WHERE company_id = :cid"
);
$sth->execute([':cid' => $this->companyId]);
return $sth->fetch(PDO::FETCH_ASSOC) ?: [];