27 lines
769 B
PHP
27 lines
769 B
PHP
<?php
|
|
session_start();
|
|
|
|
require '../../../assets/utils/db_auth.php';
|
|
|
|
$sql = "SELECT a.*, IFNULL(COUNT(DISTINCT b.product_sku), 0) AS unique_product,
|
|
c.name AS manager_name, c.surname AS manager_surname
|
|
FROM md_warehouse a
|
|
LEFT JOIN warehouse_balance b ON
|
|
a.company_id = b.company_id AND
|
|
a.id = b.warehouse_id
|
|
LEFT JOIN wms.user c ON
|
|
a.manager = c.user_id
|
|
WHERE
|
|
a.company_id = :company_id
|
|
GROUP BY a.id";
|
|
$sth = $pdo2->prepare($sql);
|
|
$sth->execute([
|
|
":company_id" => $company_id
|
|
]);
|
|
db_check($sth, $answer);
|
|
|
|
$answer["output"] = $sth->fetchAll(PDO::FETCH_ASSOC);
|
|
$answer["success"] = 1;
|
|
exit(json_encode($answer));
|
|
|
|
?>
|