|
|
@@ -59,6 +59,37 @@ Route::get('/receipt/{id}', function($id){
|
|
|
);*/
|
|
|
});
|
|
|
|
|
|
+Route::get('/receipt/mail/{id}', function($id){
|
|
|
+ $receipt = \App\Models\Receipt::findOrFail($id);
|
|
|
+ if ($receipt->status == 99)
|
|
|
+ sendReceiptDeleteEmail($receipt);
|
|
|
+ else
|
|
|
+ sendReceiptEmail($receipt);
|
|
|
+ /*
|
|
|
+ $pdf = PDF::loadView('receipt', array('receipt' => $receipt));
|
|
|
+ $pdfName = "ricevuta_" . $receipt->number . "_" . $receipt->year . ".pdf";
|
|
|
+ Storage::put('public/pdf/' . $pdfName, $pdf->output());
|
|
|
+ $email = \App\Models\Member::findOrFail($receipt->member_id)->email;
|
|
|
+ if ($email != '')
|
|
|
+ {
|
|
|
+ Mail::to($email)->send(new \App\Mail\ReceipEmail([
|
|
|
+ 'name' => 'Luca',
|
|
|
+ 'pdf' => 'public/pdf/' . $pdfName,
|
|
|
+ 'number' => $receipt->number . "/" . $receipt->year
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ */
|
|
|
+
|
|
|
+ return true;
|
|
|
+ //return $pdf->stream();
|
|
|
+ /*return response()->streamDownload(
|
|
|
+ fn () => print($pdf),
|
|
|
+ "ricevuta_" . $receipt->number . "_" . $receipt->year . ".pdf"
|
|
|
+ );*/
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
Route::get('/nations', function(){
|
|
|
if (isset($_GET["q"]))
|
|
|
$datas = \App\Models\Nation::where('name', 'like', $_GET["q"] . '%')->orderBy('name')->get();
|
|
|
@@ -133,31 +164,63 @@ Route::get('/get_members', function(){
|
|
|
$x = $x->where('birth_date', '>', date("Y-m-d", strtotime("-" . $_GET["toYear"] . " year", time())));
|
|
|
}
|
|
|
|
|
|
- $certs = [];
|
|
|
+ $ids = [];
|
|
|
|
|
|
if ($_GET["chkCertificateNormal"] != "")
|
|
|
{
|
|
|
$normal = \App\Models\MemberCertificate::where('type', 'N')->pluck('member_id');
|
|
|
- $x = $x->whereIn('id', $normal);;
|
|
|
+ $ids = array_merge($ids, $normal->toArray());
|
|
|
+ //$x = $x->whereIn('id', $normal);;
|
|
|
}
|
|
|
if ($_GET["chkCertificateAgonistico"] != "")
|
|
|
{
|
|
|
$agonistic = \App\Models\MemberCertificate::where('type', 'A')->pluck('member_id');
|
|
|
- $x = $x->whereIn('id', $agonistic);
|
|
|
+ $ids = array_merge($ids, $agonistic->toArray());
|
|
|
+ //$x = $x->whereIn('id', $agonistic);
|
|
|
}
|
|
|
if ($_GET["chkCertificateScaduti"] != "")
|
|
|
{
|
|
|
$scaduto = \App\Models\MemberCertificate::where('expire_date', '<', date("Y-m-d"))->pluck('member_id');
|
|
|
- $x = $x->whereIn('id', $scaduto);
|
|
|
+ $ids = array_merge($ids, $scaduto->toArray());
|
|
|
+ //$x = $x->whereIn('id', $scaduto);
|
|
|
}
|
|
|
if ($_GET["chkCertificateScadenza"] != "")
|
|
|
{
|
|
|
$scadenza = \App\Models\MemberCertificate::whereBetween('expire_date', [date("Y-m-d"), date("Y-m-d", strtotime("+1 month"))])->pluck('member_id');
|
|
|
- $x = $x->whereIn('id', $scadenza);
|
|
|
+ $ids = array_merge($ids, $scadenza->toArray());
|
|
|
+ //$x = $x->whereIn('id', $scadenza);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //$filterStatus = isset($_GET["status"]) ? $_GET["status"] : -1;
|
|
|
+ $chkStatus = [];
|
|
|
+ $chkStatus0 = isset($_GET["chkStatus0"]) ? $_GET["chkStatus0"] : 0;
|
|
|
+ if($chkStatus0 > 0)
|
|
|
+ $chkStatus[] = 0;
|
|
|
+ $chkStatus1 = isset($_GET["chkStatus1"]) ? $_GET["chkStatus1"] : 0;
|
|
|
+ if($chkStatus1 > 0)
|
|
|
+ $chkStatus[] = 1;
|
|
|
+ $chkStatus2 = isset($_GET["chkStatus2"]) ? $_GET["chkStatus2"] : 0;
|
|
|
+ if($chkStatus2 > 0)
|
|
|
+ $chkStatus[] = 2;
|
|
|
+
|
|
|
+ if (sizeof($chkStatus))
|
|
|
+ {
|
|
|
+ $members = \App\Models\Member::all();
|
|
|
+ foreach($members as $m)
|
|
|
+ {
|
|
|
+
|
|
|
+ $state = $m->isActive();
|
|
|
+
|
|
|
+ if (in_array($state["status"], $chkStatus))
|
|
|
+ $ids[] = $m->id;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
- if (sizeof($certs) > 0)
|
|
|
+
|
|
|
+ if (sizeof($ids) > 0)
|
|
|
{
|
|
|
- $x = $x->whereIn('id', $certs);
|
|
|
+ $x = $x->whereIn('id', $ids);
|
|
|
}
|
|
|
|
|
|
$count = $x->count();
|
|
|
@@ -167,65 +230,55 @@ Route::get('/get_members', function(){
|
|
|
else
|
|
|
$x = $x->get();
|
|
|
|
|
|
- $filterStatus = isset($_GET["status"]) ? $_GET["status"] : -1;
|
|
|
-
|
|
|
foreach($x as $idx => $r)
|
|
|
{
|
|
|
+
|
|
|
$status = $r->getStatus();
|
|
|
$status = $status["status"];
|
|
|
|
|
|
$state = $r->isActive();
|
|
|
|
|
|
- $procede = true;
|
|
|
- if ($filterStatus >= 0)
|
|
|
- {
|
|
|
- if ($state["status"] != $filterStatus)
|
|
|
- $procede = false;
|
|
|
- }
|
|
|
-
|
|
|
- if ($procede)
|
|
|
- {
|
|
|
- $class = $status > 0 ? ($status == 2 ? 'active' : 'suspended') : 'due';
|
|
|
- $text = $status > 0 ? ($status == 2 ? 'Tesserato' : 'Sospeso') : 'Non tesserato';
|
|
|
+ $class = $status > 0 ? ($status == 2 ? 'active' : 'suspended') : 'due';
|
|
|
+ $text = $status > 0 ? ($status == 2 ? 'Tesserato' : 'Sospeso') : 'Non tesserato';
|
|
|
|
|
|
|
|
|
- $x = $state["status"] > 0 ? ($state["status"] == 2 ? 'active' : 'suspended') : '';
|
|
|
- $x .= "|";
|
|
|
- $x .= $state["status"] > 0 ? ($state["status"] == 2 ? 'Attivo' : 'Sospesa') : '';
|
|
|
- $x .= "|";
|
|
|
- $x .= $state["status"] ? 'Scadenza : ' : ($state["date"] != '' ? 'Scaduto : ' : '');
|
|
|
- $x .= "|";
|
|
|
- $x .= $state["date"] != '' ? date("d/m/Y", strtotime($state["date"])) : '';
|
|
|
+ $x = $state["status"] > 0 ? ($state["status"] == 2 ? 'active' : 'suspended') : '';
|
|
|
+ $x .= "|";
|
|
|
+ $x .= $state["status"] > 0 ? ($state["status"] == 2 ? 'Attivo' : 'Sospesa') : '';
|
|
|
+ $x .= "|";
|
|
|
+ $x .= $state["status"] ? 'Scadenza : ' : ($state["date"] != '' ? 'Scaduto : ' : '');
|
|
|
+ $x .= "|";
|
|
|
+ $x .= $state["date"] != '' ? date("d/m/Y", strtotime($state["date"])) : '';
|
|
|
|
|
|
- $has_certificate = $r->hasCertificate();
|
|
|
- $y = '';
|
|
|
- if($has_certificate["date"] != '')
|
|
|
- {
|
|
|
- if($has_certificate["date"] < date("Y-m-d"))
|
|
|
- $y .= '0';
|
|
|
+ $has_certificate = $r->hasCertificate();
|
|
|
+ $y = '';
|
|
|
+ if($has_certificate["date"] != '')
|
|
|
+ {
|
|
|
+ if($has_certificate["date"] < date("Y-m-d"))
|
|
|
+ $y .= '0';
|
|
|
|
|
|
- if($has_certificate["date"] >= date("Y-m-d") && $has_certificate["date"] < date("Y-m-d", strtotime("+1 month")))
|
|
|
- $y .= '1';
|
|
|
+ if($has_certificate["date"] >= date("Y-m-d") && $has_certificate["date"] < date("Y-m-d", strtotime("+1 month")))
|
|
|
+ $y .= '1';
|
|
|
|
|
|
- if($has_certificate["date"] >= date("Y-m-d", strtotime("+1 month")))
|
|
|
- $y .= '2';
|
|
|
- $y .= '|';
|
|
|
- $y .= $has_certificate["date"] != '' ? date("d/m/Y", strtotime($has_certificate["date"])) : '';
|
|
|
- }
|
|
|
-
|
|
|
- $datas[] = array(
|
|
|
- //'c' => $idx + 1,
|
|
|
- 'id' => "ID" . str_pad($r->id, 5, "0", STR_PAD_LEFT),
|
|
|
- 'first_name' => $r->first_name . "|" . $r->id,
|
|
|
- 'last_name' => $r->last_name . "|" . $r->id,
|
|
|
- 'phone' => $r->phone,
|
|
|
- 'age' => $r->getAge(),
|
|
|
- 'status' => $class . "|" . $text,
|
|
|
- 'state' => $x,
|
|
|
- 'certificate' => $y,
|
|
|
- 'action' => $r->id
|
|
|
- );
|
|
|
+ if($has_certificate["date"] >= date("Y-m-d", strtotime("+1 month")))
|
|
|
+ $y .= '2';
|
|
|
+ $y .= '|';
|
|
|
+ $y .= $has_certificate["date"] != '' ? date("d/m/Y", strtotime($has_certificate["date"])) : '';
|
|
|
}
|
|
|
+
|
|
|
+ $datas[] = array(
|
|
|
+ //'c' => $idx + 1,
|
|
|
+ 'id' => "ID" . str_pad($r->id, 5, "0", STR_PAD_LEFT),
|
|
|
+ 'first_name' => $r->first_name . "|" . $r->id,
|
|
|
+ 'last_name' => $r->last_name . "|" . $r->id,
|
|
|
+ 'phone' => $r->phone,
|
|
|
+ 'age' => $r->getAge(),
|
|
|
+ 'status' => $class . "|" . $text,
|
|
|
+ 'state' => $x,
|
|
|
+ 'certificate' => $y,
|
|
|
+ 'action' => $r->id
|
|
|
+ );
|
|
|
+ }
|
|
|
/*
|
|
|
$r->age = $r->getAge();
|
|
|
$active = $r->isActive();
|
|
|
@@ -233,7 +286,7 @@ Route::get('/get_members', function(){
|
|
|
$r->date = $active["date"] . "|" . $r->hasCertificate()["date"];
|
|
|
$r->state = $r->getStatus()["status"];
|
|
|
$r->action = '';*/
|
|
|
- }
|
|
|
+
|
|
|
/*
|
|
|
if ($this->sortAsc)
|
|
|
$this->records = $this->records->sortBy($this->sortField);
|
|
|
@@ -333,7 +386,7 @@ Route::get('/get_record_in', function(){
|
|
|
'total' => formatPrice($r->getTotal()),
|
|
|
'first_name' => $r->first_name,
|
|
|
'last_name' => $r->last_name,
|
|
|
- 'commercial' => $r->commercial ? 'SI' : 'NO',
|
|
|
+ 'commercial' => $r->financial_movement ? 'Movimento finanziario' : ($r->commercial ? 'SI' : 'NO'),
|
|
|
'causals' => $causals,
|
|
|
'payment' => $r->payment_method->name,
|
|
|
'status' => $r->deleted ? 'Annullato' : '',
|