Reports
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
session_start();
|
||||
require '../../../assets/utils/db_auth.php';
|
||||
require '../../../assets/utils/classes/ReportManager.php';
|
||||
|
||||
$data = json_decode($_POST['json'] ?? '{}', true) ?: [];
|
||||
$warehouse_id = (int)($data['warehouse_id'] ?? 0);
|
||||
$from_month = $data['from_month'] ?? '';
|
||||
$to_month = $data['to_month'] ?? '';
|
||||
|
||||
if (!$warehouse_id || !$from_month || !$to_month) {
|
||||
$answer['message'] = 'warehouse_id, from_month, and to_month are required.';
|
||||
exit(json_encode($answer));
|
||||
}
|
||||
|
||||
if ($from_month > $to_month) [$from_month, $to_month] = [$to_month, $from_month];
|
||||
|
||||
$report = new ReportManager($pdo2, $company_id);
|
||||
|
||||
$answer['output'] = $report->getStockMovementSummary($warehouse_id, $from_month, $to_month);
|
||||
$answer['success'] = 1;
|
||||
exit(json_encode($answer));
|
||||
?>
|
||||
Reference in New Issue
Block a user