create setad report tables
This commit is contained in:
@@ -4,20 +4,59 @@ namespace App\Http\Controllers\Setad;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\CountryCallsReport;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeCentersStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DataTableFacade::run(
|
||||
CountryCallsReport::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
return response()->json($data);
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
SUM(route_to_teh4) as route_to_teh4,
|
||||
SUM(route_to_teh5) as route_to_teh5,
|
||||
SUM(route_to_os4) as route_to_os4,
|
||||
SUM(route_to_os5) as route_to_os5,
|
||||
SUM(answered) as answered,
|
||||
SUM(answered_over10) as answered_over10,
|
||||
SUM(missed) as missed,
|
||||
SUM(dnd) as dnd,
|
||||
SUM(transferred) as transferred,
|
||||
SUM(talked_to_operator) as talked_to_operator,
|
||||
AVG(average_calls_time) as average_calls_time,
|
||||
SUM(fails) as fails
|
||||
FROM country_calls_reports
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
0 as province_id,
|
||||
'کشور' as province_name,
|
||||
SUM(total),
|
||||
SUM(route_to_teh4),
|
||||
SUM(route_to_teh5),
|
||||
SUM(route_to_os4),
|
||||
SUM(route_to_os5),
|
||||
SUM(answered),
|
||||
SUM(answered_over10),
|
||||
SUM(missed),
|
||||
SUM(dnd),
|
||||
SUM(transferred),
|
||||
SUM(talked_to_operator),
|
||||
AVG(average_calls_time),
|
||||
SUM(fails)
|
||||
FROM country_calls_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,63 @@ namespace App\Http\Controllers\Setad;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\CountryKeypressReport;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeKeypressStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DataTableFacade::run(
|
||||
CountryKeypressReport::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
return response()->json($data);
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
SUM(key1) as key1,
|
||||
SUM(key2) as key2,
|
||||
SUM(key3) as key3,
|
||||
SUM(key4) as key4,
|
||||
SUM(key5) as key5,
|
||||
SUM(key6) as key6,
|
||||
SUM(key9) as key9,
|
||||
SUM(key4_1) as key4_1,
|
||||
SUM(key4_2) as key4_2,
|
||||
SUM(key5_1) as key5_1,
|
||||
SUM(key5_2) as key5_2,
|
||||
SUM(key2_1) as key2_1,
|
||||
SUM(key2_2) as key2_2,
|
||||
SUM(key2_3) as key2_3
|
||||
FROM country_keypress_reports
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
SUM(key1),
|
||||
SUM(key2),
|
||||
SUM(key3),
|
||||
SUM(key4),
|
||||
SUM(key5),
|
||||
SUM(key6),
|
||||
SUM(key9),
|
||||
SUM(key4_1),
|
||||
SUM(key4_2),
|
||||
SUM(key5_1),
|
||||
SUM(key5_2),
|
||||
SUM(key2_1),
|
||||
SUM(key2_2),
|
||||
SUM(key2_3)
|
||||
FROM country_keypress_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Setad;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeMessageRatingStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(total) as total,
|
||||
SUM(listens) as listens,
|
||||
SUM(not_listens) as not_listens,
|
||||
AVG(review_average) as review_average,
|
||||
SUM(action1) as action1,
|
||||
SUM(action2) as action2,
|
||||
SUM(action3) as action3,
|
||||
SUM(action4) as action4,
|
||||
SUM(action5) as action5
|
||||
FROM country_message_rating_reports
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(total),
|
||||
SUM(listens),
|
||||
SUM(not_listens),
|
||||
AVG(review_average),
|
||||
SUM(action1),
|
||||
SUM(action2),
|
||||
SUM(action3),
|
||||
SUM(action4),
|
||||
SUM(action5)
|
||||
FROM country_message_rating_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,41 @@ namespace App\Http\Controllers\Setad;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use app\Http\Traits\ApiResponse;
|
||||
use App\Models\CountryVoiceRatingReport;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CumulativeVoiceRatingStatsController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$data = DataTableFacade::run(
|
||||
CountryVoiceRatingReport::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
return response()->json($data);
|
||||
$data = DB::select("
|
||||
SELECT
|
||||
province_id,
|
||||
province_name,
|
||||
SUM(message_quality_ok) as message_quality_ok,
|
||||
SUM(message_format_ok) as message_format_ok,
|
||||
SUM(message_quality_nok) as message_quality_nok,
|
||||
SUM(message_format_nok) as message_format_nok
|
||||
FROM country_voice_rating_reports
|
||||
GROUP BY province_id, province_name
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
0 as province_id,
|
||||
'کشوری' as province_name,
|
||||
SUM(message_quality_ok),
|
||||
SUM(message_format_ok),
|
||||
SUM(message_quality_nok),
|
||||
SUM(message_format_nok)
|
||||
FROM country_voice_rating_reports
|
||||
");
|
||||
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
}
|
||||
|
||||
10
app/Models/Cdr.php
Normal file
10
app/Models/Cdr.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cdr extends Model
|
||||
{
|
||||
protected $connection = 'asterisk';
|
||||
}
|
||||
Reference in New Issue
Block a user