accounting workflows
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
<?php
|
||||
session_start();
|
||||
require '../../../assets/utils/db_auth.php';
|
||||
require '../../../assets/utils/classes/QuotationManager.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);
|
||||
try {
|
||||
$quotation = new QuotationManager($pdo2, $company_id);
|
||||
$answer['output'] = $quotation->getStats();
|
||||
$answer['success'] = 1;
|
||||
} catch (Exception $e) {
|
||||
$answer['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$answer['success'] = 1;
|
||||
$answer['output'] = $row;
|
||||
exit(json_encode($answer));
|
||||
|
||||
Reference in New Issue
Block a user