[OOP] contact,inventory,ics,dashboard
This commit is contained in:
@@ -1,36 +1,10 @@
|
||||
<?php
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
require '../../../assets/utils/db_auth.php';
|
||||
require '../../../assets/utils/classes/WarehouseManager.php';
|
||||
|
||||
$sql = "SELECT
|
||||
a.*,
|
||||
COALESCE(r.total_racks, 0) AS capacity,
|
||||
COALESCE(r.occupied_racks, 0) AS space_used,
|
||||
COALESCE(r.unique_product, 0) AS unique_product,
|
||||
c.name AS manager_name,
|
||||
c.surname AS manager_surname
|
||||
FROM md_warehouse a
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
company_id, warehouse,
|
||||
COUNT(*) AS total_racks,
|
||||
COUNT(product_sku) AS occupied_racks,
|
||||
COUNT(DISTINCT product_sku) AS unique_product
|
||||
FROM md_rack
|
||||
GROUP BY company_id, warehouse
|
||||
) r ON a.company_id = r.company_id AND a.id = r.warehouse
|
||||
LEFT JOIN wms.user c ON a.manager = c.user_id
|
||||
WHERE a.company_id = :company_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;
|
||||
$wh = new WarehouseManager($pdo2, $company_id);
|
||||
$answer['output'] = $wh->getWarehouseListAll();
|
||||
$answer['success'] = 1;
|
||||
exit(json_encode($answer));
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user