write webservice for get answer when panjareh vahed get answer

This commit is contained in:
2025-08-27 17:07:32 +03:30
parent 440420d22b
commit 7eef833e44
4 changed files with 15 additions and 11 deletions

View File

@@ -90,7 +90,7 @@ class OperatorService
return DB::select("
WITH edareh_data AS (
SELECT
e.id AS edareh_id,
e.id AS edare_id,
a.id AS axis_type_id,
COALESCE(SUM(t.step = 1), 0) AS s1,
COALESCE(SUM(t.step = 2), 0) AS s2,
@@ -105,21 +105,21 @@ class OperatorService
GROUP BY e.id, a.id
)
SELECT
edareh_id,
edare_id,
axis_type_id,
s1,
s2,
s3,
COALESCE(
SUM(s1 + s2 + s3)
OVER (PARTITION BY edareh_id), 0
OVER (PARTITION BY edare_id), 0
) AS total_sum
FROM edareh_data
UNION ALL
SELECT
-1 AS edareh_id,
-1 AS edare_id,
axis_type_id,
COALESCE(SUM(s1), 0) AS s1,
COALESCE(SUM(s2), 0) AS s2,
@@ -130,7 +130,7 @@ class OperatorService
FROM edareh_data
GROUP BY axis_type_id
ORDER BY edareh_id , axis_type_id
ORDER BY edare_id , axis_type_id
", [
'provinceId' => $province_id,
'infoId' => $info_id,