|
@@ -669,6 +669,8 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
|
|
|
|
|
$datas = [];
|
|
$datas = [];
|
|
|
|
|
|
|
|
|
|
+ $xxx = 1;
|
|
|
|
|
+
|
|
|
$member_course_totals = $member_course->get();
|
|
$member_course_totals = $member_course->get();
|
|
|
foreach($member_course_totals as $x)
|
|
foreach($member_course_totals as $x)
|
|
|
{
|
|
{
|
|
@@ -750,7 +752,8 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
"column_14" => getColor($x->months, 8) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price),
|
|
"column_14" => getColor($x->months, 8) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price),
|
|
|
"column_15" => $x->course_id,
|
|
"column_15" => $x->course_id,
|
|
|
"column_16" => $x->id,
|
|
"column_16" => $x->id,
|
|
|
- "column_17" => $x->member_id
|
|
|
|
|
|
|
+ "column_17" => $x->member_id,
|
|
|
|
|
+ "column_18" => $xxx++
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -792,114 +795,15 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
$xx += 1;
|
|
$xx += 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (isset($_GET["order"]))
|
|
|
|
|
+ array_multisort(array_column($datas, 'column_' . ($_GET["order"][0]["column"] - 1)), $_GET["order"][0]["dir"] == "asc" ? SORT_ASC : SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
|
|
|
|
|
|
|
|
- //$member_course = $member_course->where('course_id', 999999);
|
|
|
|
|
-
|
|
|
|
|
- /*
|
|
|
|
|
-
|
|
|
|
|
- $start = 0;
|
|
|
|
|
- $limit = 100000;
|
|
|
|
|
-
|
|
|
|
|
- if (isset($_GET["start"]))
|
|
|
|
|
|
|
+ $xxx = 1;
|
|
|
|
|
+ foreach($datas as $yyy => $d)
|
|
|
{
|
|
{
|
|
|
- $start = $_GET["start"];
|
|
|
|
|
- $limit = $_GET["length"];
|
|
|
|
|
|
|
+ $datas[$yyy]["column_18"] = $xxx++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //$member_course = $member_course->offset($start)->limit($limit)->get();
|
|
|
|
|
- $member_course = $member_course->get();
|
|
|
|
|
-
|
|
|
|
|
- $datas = [];
|
|
|
|
|
-
|
|
|
|
|
- foreach($member_course as $x)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- $price = 0;
|
|
|
|
|
- $price = $x->course->price;
|
|
|
|
|
- $subPrice = $x->course->subscription_price;
|
|
|
|
|
- $records = \App\Models\Record::where('member_course_id', $x->id)->where('deleted', 0)->get();
|
|
|
|
|
- $prices = [];
|
|
|
|
|
- foreach ($records as $record)
|
|
|
|
|
- {
|
|
|
|
|
- foreach ($record->rows as $row)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- //if ($row->causal_id == $x->course->sub_causal_id || str_contains(strtolower($row->note), 'iscrizione'))
|
|
|
|
|
- if (str_contains(strtolower($row->note), 'iscrizione'))
|
|
|
|
|
- {
|
|
|
|
|
- $subPrice = $row->amount;
|
|
|
|
|
- }
|
|
|
|
|
- if ($row->causal_id == $x->course->causal_id && !str_contains(strtolower($row->note), 'iscrizione'))
|
|
|
|
|
- {
|
|
|
|
|
- $tot = sizeof(json_decode($row->when));
|
|
|
|
|
- foreach(json_decode($row->when) as $m)
|
|
|
|
|
- {
|
|
|
|
|
- $prices[$m->month] = $row->amount / $tot;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for($i=1; $i<=12; $i++)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- $cls = getColor($x->months, $i);
|
|
|
|
|
- if ($cls != 'grey')
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- if (!isset($totals[$i]))
|
|
|
|
|
- {
|
|
|
|
|
- $totals[$i]['green'] = 0;
|
|
|
|
|
- $totals[$i]['orange'] = 0;
|
|
|
|
|
- $totals[$i]['yellow'] = 0;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if ($cls == 'yellow')
|
|
|
|
|
- {
|
|
|
|
|
- $prices[$i] = 0;
|
|
|
|
|
- $totals[$i][$cls] += 1;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $p = isset($prices[$i]) ? $prices[$i] : $price;
|
|
|
|
|
- $totals[$i][$cls] += $p;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $sub = $x->subscribed ? "Y" : "N";
|
|
|
|
|
- if (isset($totalIsc[$sub]))
|
|
|
|
|
- $totalIsc[$sub] += $subPrice;
|
|
|
|
|
- else
|
|
|
|
|
- $totalIsc[$sub] = $subPrice;
|
|
|
|
|
-
|
|
|
|
|
- $datas[] = array(
|
|
|
|
|
- "column_0" => $x->member->last_name,
|
|
|
|
|
- "column_1" => $x->member->first_name,
|
|
|
|
|
- "column_2" => $x->subscribed . "§" . formatPrice($subPrice),
|
|
|
|
|
- "column_3" => getColor($x->months, 9) . "§" . formatPrice(isset($prices[9]) ? $prices[9] : $price),
|
|
|
|
|
- "column_4" => getColor($x->months, 10) . "§" . formatPrice(isset($prices[10]) ? $prices[10] : $price),
|
|
|
|
|
- "column_5" => getColor($x->months, 11) . "§" . formatPrice(isset($prices[11]) ? $prices[11] : $price),
|
|
|
|
|
- "column_6" => getColor($x->months, 12) . "§" . formatPrice(isset($prices[12]) ? $prices[12] : $price),
|
|
|
|
|
- "column_7" => getColor($x->months, 1) . "§" . formatPrice(isset($prices[1]) ? $prices[1] : $price),
|
|
|
|
|
- "column_8" => getColor($x->months, 2) . "§" . formatPrice(isset($prices[2]) ? $prices[2] : $price),
|
|
|
|
|
- "column_9" => getColor($x->months, 3) . "§" . formatPrice(isset($prices[3]) ? $prices[3] : $price),
|
|
|
|
|
- "column_10" => getColor($x->months, 4) . "§" . formatPrice(isset($prices[4]) ? $prices[4] : $price),
|
|
|
|
|
- "column_11" => getColor($x->months, 5) . "§" . formatPrice(isset($prices[5]) ? $prices[5] : $price),
|
|
|
|
|
- "column_12" => getColor($x->months, 6) . "§" . formatPrice(isset($prices[6]) ? $prices[6] : $price),
|
|
|
|
|
- "column_13" => getColor($x->months, 7) . "§" . formatPrice(isset($prices[7]) ? $prices[7] : $price),
|
|
|
|
|
- "column_14" => getColor($x->months, 8) . "§" . formatPrice(isset($prices[8]) ? $prices[8] : $price),
|
|
|
|
|
- "column_15" => $x->course_id,
|
|
|
|
|
- "column_16" => $x->id,
|
|
|
|
|
- "column_17" => $x->member_id
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
- if (isset($_GET["order"]))
|
|
|
|
|
- array_multisort(array_column($datas, 'column_' . $_GET["order"][0]["column"]), $_GET["order"][0]["dir"] == "asc" ? SORT_ASC : SORT_DESC, SORT_NATURAL|SORT_FLAG_CASE, $datas);
|
|
|
|
|
-
|
|
|
|
|
if (isset($_GET["start"]))
|
|
if (isset($_GET["start"]))
|
|
|
$datas = array_slice($datas, $_GET["start"], $_GET["length"]);
|
|
$datas = array_slice($datas, $_GET["start"], $_GET["length"]);
|
|
|
|
|
|