24 lines
906 B
PHP
24 lines
906 B
PHP
<?php
|
|
session_start();
|
|
require '../../../assets/utils/db_auth.php';
|
|
require '../../../assets/utils/classes/Reports.php';
|
|
|
|
$month = $data['month'] ?? date('Y-m');
|
|
$report = new Reports($pdo2, $company_id);
|
|
|
|
$stats = $report->getDashboardStats($month);
|
|
|
|
$answer['output'] = [
|
|
'total_in' => $stats['total_in'],
|
|
'total_out' => $stats['total_out'],
|
|
'active_products' => $stats['active_products'],
|
|
'low_stock' => $report->getDashboardLowStockCount(),
|
|
'stock_movement' => $report->getStockMovementChart(12),
|
|
'most_moved' => $report->getMostMovedProducts($month),
|
|
'low_stock_items' => $report->getLowStockItems(),
|
|
'recent_activity' => $report->getRecentActivity(10),
|
|
'months' => $report->getAvailableMonths(),
|
|
];
|
|
$answer['success'] = 1;
|
|
exit(json_encode($answer));
|
|
?>
|