ICS modules
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
require '../../../assets/utils/db_auth.php';
|
||||
|
||||
$id = (int)$data['id'];
|
||||
$warehouse = (int)$data["warehouse"];
|
||||
|
||||
// get warehouse name
|
||||
$sql = "SELECT warehouse_name
|
||||
FROM md_warehouse
|
||||
WHERE
|
||||
company_id = :company_id and
|
||||
id = :warehouse
|
||||
";
|
||||
|
||||
$sth = $pdo2->prepare($sql);
|
||||
$sth->execute([
|
||||
":company_id" => $company_id,
|
||||
":warehouse" => $warehouse
|
||||
]);
|
||||
db_check($sth, $answer);
|
||||
|
||||
$warehouse = $sth->fetchColumn();
|
||||
|
||||
if(!$warehouse) {
|
||||
$answer["message"] = "Warehouse not found";
|
||||
exit(json_encode($answer));
|
||||
}
|
||||
|
||||
$table = "td_stock_" . $warehouse;
|
||||
|
||||
$sql = "SELECT a.* , ROUND(a.in,2) as quantity,
|
||||
b.product_name
|
||||
FROM `{$table}` a
|
||||
LEFT JOIN md_product b ON
|
||||
a.company_id = b.company_id and
|
||||
a.product_sku = b.sku
|
||||
WHERE
|
||||
a.company_id = {$company_id} and
|
||||
a.type = 'transfer' and
|
||||
a.out > 0
|
||||
ORDER BY a.date DESC";
|
||||
$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));
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user