|
|
@@ -350,9 +350,6 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
->leftJoin('payment_methods', 'records.payment_method_id', '=', 'payment_methods.id')
|
|
|
->where('records.type', 'IN');
|
|
|
|
|
|
- $y = \App\Models\Record::select('records.*', \DB::raw('members.first_name as first_name'), \DB::raw('members.last_name as last_name')) // , \DB::raw('SUM(records.id) As total'))
|
|
|
- ->leftJoin('members', 'records.member_id', '=', 'members.id')->leftJoin('records_rows', 'records.id', '=', 'records_rows.record_id')->where('records.type', 'IN');
|
|
|
-
|
|
|
if (isset($_GET["search"]["value"]))
|
|
|
{
|
|
|
$v = str_replace("'", "\'", stripcslashes($_GET["search"]["value"]));
|
|
|
@@ -360,10 +357,6 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
$query->where('first_name', 'like', '%' . $v . '%')
|
|
|
->orWhere('last_name', 'like', '%' . $v . '%');
|
|
|
});
|
|
|
- $y = $y->where(function ($query) use ($v) {
|
|
|
- $query->where('first_name', 'like', '%' . $v . '%')
|
|
|
- ->orWhere('last_name', 'like', '%' . $v . '%');
|
|
|
- });
|
|
|
//where('first_name', 'like', '%' . $_GET["search"]["value"] . '%');
|
|
|
}
|
|
|
|
|
|
@@ -374,23 +367,19 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
if ($_GET["filterCommercial"] == 1)
|
|
|
{
|
|
|
$x = $x->where('commercial', true );
|
|
|
- $y = $y->where('commercial', true );
|
|
|
}
|
|
|
if ($_GET["filterCommercial"] == 2)
|
|
|
{
|
|
|
$x = $x->where('commercial', false);
|
|
|
- $y = $y->where('commercial', false);
|
|
|
}
|
|
|
if ($_GET["filterMember"] > 0)
|
|
|
{
|
|
|
$x = $x->where('member_id', $_GET["filterMember"]);
|
|
|
- $y = $y->where('member_id', $_GET["filterMember"]);
|
|
|
}
|
|
|
if ($_GET["filterPaymentMethod"] != "null")
|
|
|
{
|
|
|
$payments = explode(",", $_GET["filterPaymentMethod"]);
|
|
|
$x = $x->whereIn('payment_method_id', $payments);
|
|
|
- $y = $y->whereIn('payment_method_id', $payments);
|
|
|
}
|
|
|
if ($_GET["filterCausals"] != "null")
|
|
|
{
|
|
|
@@ -398,17 +387,14 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
//$causals = \App\Models\RecordRow::where('causal_id', $_GET["filterCausals"])->pluck('record_id');
|
|
|
$causals = \App\Models\RecordRow::whereIn('causal_id', $causals)->pluck('record_id');
|
|
|
$x = $x->whereIn('records.id', $causals);
|
|
|
- $y = $y->whereIn('records.id', $causals);
|
|
|
}
|
|
|
if ($_GET["filterFrom"] != '')
|
|
|
{
|
|
|
$x = $x->where('date', '>=', $_GET["filterFrom"]);
|
|
|
- $y = $y->where('date', '>=', $_GET["filterFrom"]);
|
|
|
}
|
|
|
if ($_GET["filterTo"] != '')
|
|
|
{
|
|
|
$x = $x->where('date', '<=', $_GET["filterTo"]);
|
|
|
- $y = $y->where('date', '<=', $_GET["filterTo"]);
|
|
|
}
|
|
|
|
|
|
//});
|
|
|
@@ -443,23 +429,24 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
$moneysCausal = \App\Models\Causal::where('money', true)->pluck('id')->toArray();
|
|
|
|
|
|
$total = 0;
|
|
|
-
|
|
|
- foreach($y->get() as $r)
|
|
|
+ /*
|
|
|
+ foreach($x->get() as $r)
|
|
|
{
|
|
|
|
|
|
if (!in_array($r->payment_method_id, $moneys))
|
|
|
{
|
|
|
-
|
|
|
- if ((!in_array($r->member_id, $exclude_from_records) || in_array($r->causal_id, $moneysCausal)) && (!$r->deleted || $r->deleted == null) && (!in_array($r->causal_id, $excludeCausals) || in_array($r->causal_id, $moneysCausal)) && (!$r->financial_movement || $r->financial_movement == null) && (!$r->corrispettivo_fiscale || $r->corrispettivo_fiscale == null))
|
|
|
+ foreach($r->rows as $rr)
|
|
|
+ {
|
|
|
+ if ((!in_array($rr->member_id, $exclude_from_records) || in_array($r->causal_id, $moneysCausal)) && (!$r->deleted || $r->deleted == null) && (!in_array($rr->causal_id, $excludeCausals) || in_array($r->causal_id, $moneysCausal)) && (!$r->financial_movement || $r->financial_movement == null) && (!$r->corrispettivo_fiscale || $r->corrispettivo_fiscale == null))
|
|
|
{
|
|
|
- $total += $r->amount;
|
|
|
- if ($r->vat_id > 0)
|
|
|
- $total += getVatValue($r->amount, $r->vat_id);
|
|
|
+ $total += $rr->amount;
|
|
|
+ if ($rr->vat_id > 0)
|
|
|
+ $total += getVatValue($rr->amount, $rr->vat_id);
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ */
|
|
|
$count = $x->count();
|
|
|
|
|
|
|
|
|
@@ -506,7 +493,7 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
'causals' => $causals,
|
|
|
'payment' => $r->payment_method->name,
|
|
|
'status' => $r->deleted ? 'Annullato' : '',
|
|
|
- 'action' => $r->id . "||" . ($r->deleted ? 'x' : '')
|
|
|
+ 'action' => $r->id . "|" . formatPrice($total) . "|" . ($r->deleted ? 'x' : '')
|
|
|
);
|
|
|
|
|
|
|
|
|
@@ -525,7 +512,7 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
'action' => ''
|
|
|
);*/
|
|
|
|
|
|
- return json_encode(array("data" => $datas, "recordsTotal" => $count, "recordsFiltered" => $count, "totals" => formatPrice($total)));
|
|
|
+ return json_encode(array("data" => $datas, "recordsTotal" => $count, "recordsFiltered" => $count));
|
|
|
|
|
|
});
|
|
|
|
|
|
@@ -698,8 +685,8 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
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'))
|
|
|
+ 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;
|
|
|
}
|
|
|
@@ -774,7 +761,7 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
$count = $member_course->count();
|
|
|
|
|
|
$js = '';
|
|
|
- $xx = 2;
|
|
|
+ $xx = 3;
|
|
|
$str = '';
|
|
|
if ($count > 0)
|
|
|
{
|
|
|
@@ -782,22 +769,22 @@ Route::group(['middleware' => 'auth'],function(){
|
|
|
$str .= "<a style='width:100%;float:right; text-align:right; display:block;' class=orange><small>" . (isset($totalIsc["N"]) ? formatPrice($totalIsc["N"]) : 0) . "</small></a><br>";
|
|
|
$str .= "<a style='width:100%;float:right; text-align:right; display:block;' class=yellow><small>0</small></a><br>";
|
|
|
}
|
|
|
- $js .= "§§" . $str . "_";
|
|
|
+ $js .= $xx . "§" . $str . "_";
|
|
|
$str = "";
|
|
|
foreach($totals as $z => $t)
|
|
|
{
|
|
|
- if ($z == 1) $xx = 7;
|
|
|
- if ($z == 2) $xx = 8;
|
|
|
- if ($z == 3) $xx = 9;
|
|
|
- if ($z == 4) $xx = 10;
|
|
|
- if ($z == 5) $xx = 11;
|
|
|
- if ($z == 6) $xx = 12;
|
|
|
- if ($z == 7) $xx = 13;
|
|
|
- if ($z == 8) $xx = 14;
|
|
|
- if ($z == 9) $xx = 3;
|
|
|
- if ($z == 10) $xx = 4;
|
|
|
- if ($z == 11) $xx = 5;
|
|
|
- if ($z == 12) $xx = 6;
|
|
|
+ if ($z == 1) $xx = 8;
|
|
|
+ if ($z == 2) $xx = 9;
|
|
|
+ if ($z == 3) $xx = 10;
|
|
|
+ if ($z == 4) $xx = 11;
|
|
|
+ if ($z == 5) $xx = 12;
|
|
|
+ if ($z == 6) $xx = 13;
|
|
|
+ if ($z == 7) $xx = 14;
|
|
|
+ if ($z == 8) $xx = 15;
|
|
|
+ if ($z == 9) $xx = 4;
|
|
|
+ if ($z == 10) $xx = 5;
|
|
|
+ if ($z == 11) $xx = 6;
|
|
|
+ if ($z == 12) $xx = 7;
|
|
|
$str = '';
|
|
|
foreach($t as $x => $c)
|
|
|
{
|
|
|
@@ -1149,3 +1136,28 @@ Route::get('/seed', function()
|
|
|
// Call and Artisan command from within your application.
|
|
|
Artisan::call('db:seed');
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+Route::get('/updateCourseCausal', function(){
|
|
|
+
|
|
|
+ $member_courses = \App\Models\MemberCourse::all();
|
|
|
+ foreach($member_courses as $x)
|
|
|
+ {
|
|
|
+
|
|
|
+ $records = \App\Models\Record::where('member_course_id', $x->id)->get();
|
|
|
+
|
|
|
+ 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'))
|
|
|
+ {
|
|
|
+ $row->causal_id = $x->course->sub_causal_id;
|
|
|
+ $row->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+});
|