|
|
@@ -879,15 +879,19 @@ Route::get('/get_financial_movements', function () {
|
|
|
->leftJoin('causals as causals', 'causals.id', '=', 'financial_movements.causal_id')
|
|
|
->where('financial_movements.deleted', false);
|
|
|
|
|
|
+ $hasFilter = false;
|
|
|
if (!empty($filterFrom)) {
|
|
|
+ $hasFilter = true;
|
|
|
$base->whereDate('financial_movements.date', '>=', $filterFrom);
|
|
|
}
|
|
|
|
|
|
if (!empty($filterTo)) {
|
|
|
+ $hasFilter = true;
|
|
|
$base->whereDate('financial_movements.date', '<=', $filterTo);
|
|
|
}
|
|
|
|
|
|
if ($filterOrigins && $filterOrigins !== "null") {
|
|
|
+ $hasFilter = true;
|
|
|
$origins = array_filter(explode(",", $filterOrigins));
|
|
|
if (!empty($origins)) {
|
|
|
$base->whereIn('financial_movements.origin_id', $origins);
|
|
|
@@ -895,6 +899,7 @@ Route::get('/get_financial_movements', function () {
|
|
|
}
|
|
|
|
|
|
if ($filterDestinations && $filterDestinations !== "null") {
|
|
|
+ $hasFilter = true;
|
|
|
$destinations = array_filter(explode(",", $filterDestinations));
|
|
|
if (!empty($destinations)) {
|
|
|
$base->whereIn('financial_movements.destination_id', $destinations);
|
|
|
@@ -957,13 +962,19 @@ Route::get('/get_financial_movements', function () {
|
|
|
|
|
|
$draw = (int) request('draw', 0);
|
|
|
|
|
|
- return response()->json([
|
|
|
+ $data = [
|
|
|
"draw" => $draw,
|
|
|
"data" => $data,
|
|
|
"recordsTotal" => $recordsTotal,
|
|
|
"recordsFiltered" => $recordsFiltered,
|
|
|
"totals" => formatPrice($totalAmount),
|
|
|
- ]);
|
|
|
+ ];
|
|
|
+
|
|
|
+ if (!$hasFilter) {
|
|
|
+ unset($data['totals']);
|
|
|
+ }
|
|
|
+
|
|
|
+ return response()->json($data);
|
|
|
});
|
|
|
|
|
|
Route::get('/get_course_list', function () {
|