1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/Controllers/ChartController.php

70 lines
2.0 KiB
PHP
Raw Normal View History

2022-01-20 02:15:33 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2022-01-20 02:15:33 +01:00
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Controllers;
use App\Http\Requests\Chart\ShowChartRequest;
2022-01-21 02:00:32 +01:00
use App\Services\Chart\ChartService;
2022-01-20 02:15:33 +01:00
class ChartController extends BaseController
{
public function __construct()
{
parent::__construct();
}
/**
2023-05-12 01:01:54 +02:00
* @param ShowChartRequest $request
2022-01-20 02:15:33 +01:00
*/
2022-01-21 02:00:32 +01:00
public function totals(ShowChartRequest $request)
2022-01-20 02:15:33 +01:00
{
2023-05-16 07:35:29 +02:00
/** @var \App\Models\User auth()->user() */
$user = auth()->user();
$cs = new ChartService($user->company(), $user, $user->isAdmin());
2022-01-20 02:15:33 +01:00
2022-01-21 07:04:01 +01:00
return response()->json($cs->totals($request->input('start_date'), $request->input('end_date')), 200);
}
public function chart_summary(ShowChartRequest $request)
{
2023-05-16 07:35:29 +02:00
/** @var \App\Models\User auth()->user() */
$user = auth()->user();
$cs = new ChartService($user->company(), $user, $user->isAdmin());
2022-01-21 07:04:01 +01:00
return response()->json($cs->chart_summary($request->input('start_date'), $request->input('end_date')), 200);
2022-01-20 02:15:33 +01:00
}
2023-05-21 12:31:55 +02:00
/**
* @param ShowChartRequest $request
*/
public function totalsV2(ShowChartRequest $request)
{
/** @var \App\Models\User auth()->user() */
$user = auth()->user();
$cs = new ChartService($user->company(), $user, $user->isAdmin());
return response()->json($cs->totals($request->input('start_date'), $request->input('end_date')), 200);
}
public function chart_summaryV2(ShowChartRequest $request)
{
/** @var \App\Models\User auth()->user() */
$user = auth()->user();
$cs = new ChartService($user->company(), $user, $user->isAdmin());
2023-06-26 07:14:58 +02:00
2023-05-21 12:31:55 +02:00
return response()->json($cs->chart_summary($request->input('start_date'), $request->input('end_date')), 200);
}
2022-01-20 02:15:33 +01:00
}