Seal live dashboard event gaps

This commit is contained in:
Thanakorn S
2026-05-25 17:02:52 +07:00
parent 3c9475f3fa
commit 5c0166ae73
13 changed files with 147 additions and 17 deletions
+20
View File
@@ -34,3 +34,23 @@ function notify_node(string $event, array $data, int $company_id): void
curl_exec($ch);
curl_close($ch);
}
function gl_posted_payload(string $doc_type, int $id, string $action, array $lines): array
{
$has_revenue = false;
$has_expense = false;
foreach ($lines as $line) {
$code = (int)($line['account_code'] ?? 0);
if ($code >= 4000 && $code < 5000) $has_revenue = true;
if ($code >= 5000) $has_expense = true;
}
return [
'doc_type' => $doc_type,
'id' => $id,
'action' => $action,
'has_revenue' => $has_revenue,
'has_expense' => $has_expense,
];
}