Jelajahi Sumber

Aggiunto flag nella causale per blocco visualizzazione in report

ferrari 4 bulan lalu
induk
melakukan
30d6a8345e

+ 1 - 1
app/Http/Livewire/Causal.php

@@ -8,7 +8,7 @@ use App\Http\Middleware\TenantMiddleware;
 
 class Causal extends Component
 {
-    public $recordsIn, $recordsOut, $parent_id,  $name, $enabled, $corrispettivo_fiscale, $no_receipt, $money, $user_status, $no_first, $no_records, $type, $dataId, $update = false, $add = false;
+    public $recordsIn, $recordsOut, $parent_id,  $name, $enabled, $corrispettivo_fiscale, $no_receipt, $money, $user_status, $no_first, $no_records, $no_reports, $type, $dataId, $update = false, $add = false;
 
     public $corrispettivo_causal_id = 0;
 

+ 4 - 0
app/Http/Livewire/Reports.php

@@ -261,6 +261,10 @@ class Reports extends Component
             'causals.parent_id',
             DB::raw('SUM(records_rows.amount) as total_amount')
         )
+            ->where(function ($query) {
+                $query->where('causals.no_reports', '=', '0')
+                    ->orWhereNull('causals.no_reports');
+            })
             ->groupBy('causals.id', 'causals.name', 'causals.parent_id')
             ->orderBy('total_amount', 'desc')
             ->limit($limit)

+ 2 - 1
app/Models/Causal.php

@@ -20,7 +20,8 @@ class Causal extends Model
         'user_status',
         'no_first',
         'no_records',
-        'enabled'
+        'enabled',
+        'no_reports',
     ];
 
 

+ 32 - 0
database/migrations/2025_09_24_131918_add_no_reports_to_causals_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('causals', function (Blueprint $table) {
+            $table->boolean('no_reports')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('causals', function (Blueprint $table) {
+            $table->dropColumn('no_reports');
+        });
+    }
+};

+ 7 - 0
resources/views/livewire/causal.blade.php

@@ -221,6 +221,13 @@
                             </div>
                         </div>
 
+                        <div class="form--item mb-3">
+                            <div class="form-check form-check-inline" style="padding-left:28px !important;">
+                                <input class="form-check-input form-control" style="width:22px; height:22px;" type="checkbox" id="no_reports" wire:model="no_reports">
+                                <label class="form-check-label" for="no_reports">Escludi da reports</label>
+                            </div>
+                        </div>
+
                         <!-- // inline input field -->
 
                         <div class="form--item">