'allModels' => [],
'pagination' => ['pageSize' => 100],
]);
-
if (!empty($filters['plan_date'])) {
- $service = new AutoPlannogrammaService();
+ $planDateParts = explode('-', $filters['plan_date']);
+ if (count($planDateParts) === 2) {
+ [$month, $year] = $planDateParts;
+ $filters['plan_date'] = "$year-$month-01";
+ }
+ $service = new AutoPlannogrammaService();
$data = $service->getMonthCategoryShareOrWriteOff($filters['plan_date'], $filters, null, $filters['type']);
+
$flatData = [];
foreach ($data as $storeId => $categories) {
foreach ($categories as $row) {
$flatData[] = [
- 'store_id' => (string)$storeId, // фильтрация по ID, а не имени
+ 'store_id' => (string)$storeId,
'category' => $row['category'] ?? null,
'total_sum' => $row['total_sum'] ?? null,
'share_of_total' => $row['share_of_total'] ?? null,
if (!empty($filters['plan_date'])) {
+ $planDateParts = explode('-', $filters['plan_date']);
+ if (count($planDateParts) === 2) {
+ [$month, $year] = $planDateParts;
+ $filters['plan_date'] = "$year-$month-01";
+ }
$service = new AutoPlannogrammaService();
$monthCategoryShare = $service->getMonthCategoryShareOrWriteOff($filters['plan_date'], $filters);
if (!empty($filters['plan_date'])) {
+ $planDateParts = explode('-', $filters['plan_date']);
+ if (count($planDateParts) === 2) {
+ [$month, $year] = $planDateParts;
+ $filters['plan_date'] = "$year-$month-01";
+ }
$service = new AutoPlannogrammaService();
$data = $service->getMonthSubcategoryShareOrWriteOff($filters['plan_date'], $filters, null, $filters['type']);
if (!empty($filters['plan_date'])) {
+ $planDateParts = explode('-', $filters['plan_date']);
+ if (count($planDateParts) === 2) {
+ [$month, $year] = $planDateParts;
+ $filters['plan_date'] = "$year-$month-01";
+ }
+
$service = new AutoPlannogrammaService();
+
$monthCategoryShare = $service->getMonthCategoryShareOrWriteOff(
date('Y-m-d', strtotime($filters['plan_date'] . ' -12 months')),
$filters
]);
- if (!empty($filters['plan_date'])) {
+ if (!empty($filters['plan_date'])) { $planDateParts = explode('-', $filters['plan_date']);
+ if (count($planDateParts) === 2) {
+ [$month, $year] = $planDateParts;
+ $filters['plan_date'] = "$year-$month-01";
+ }
+
$service = new AutoPlannogrammaService();
+
$data = $service->getMonthSpeciesShareOrWriteOff(
date('Y-m-d', strtotime($filters['plan_date'] . ' -3 months')),
$filters,
if (!empty($filters['plan_date'])) {
+ $planDateParts = explode('-', $filters['plan_date']);
+ if (count($planDateParts) === 2) {
+ [$month, $year] = $planDateParts;
+ $filters['plan_date'] = "$year-$month-01";
+ }
+
$service = new AutoPlannogrammaService();
+
$monthCategoryShare = $service->getMonthCategoryShareOrWriteOff(
date('Y-m-d', strtotime($filters['plan_date'] . ' -12 months')),
$filters