Files
wms-app/app/revenue/api/engine/quotation_stats.php
T
2026-05-13 15:11:24 +07:00

20 lines
512 B
PHP

<?php
session_start();
require '../../../assets/utils/db_auth.php';
$sql = "SELECT
COUNT(*) AS total,
SUM(status = 0) AS draft,
SUM(status = 1) AS sent,
SUM(status = 2) AS accepted,
SUM(status = 3) AS rejected
FROM ac_quotation
WHERE company_id = :cid";
$sth = $pdo2->prepare($sql);
$sth->execute([':cid' => $company_id]);
$row = $sth->fetch(PDO::FETCH_ASSOC);
$answer['success'] = 1;
$answer['output'] = $row;
exit(json_encode($answer));