update tgl 25
This commit is contained in:
parent
6703fcf78d
commit
02c22275e7
|
@ -9,8 +9,12 @@ class GajiController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
// Ambil semua data gaji dari database
|
||||
$gajiKaryawan = GajiModel::all(); // Anda bisa menambahkan filter atau pagination jika diperlukan
|
||||
return view('Gaji', compact('gajiKaryawan')); // Kirim data ke view
|
||||
// Ambil hanya data yang memiliki nilai gaji dan tidak null
|
||||
$gajiKaryawan = GajiModel::whereNotNull('gaji')
|
||||
->where('gaji', '>', 0)
|
||||
->select('nama_karyawan', 'gaji') // Ambil kolom nama_karyawan dan gaji
|
||||
->get();
|
||||
|
||||
return view('Gaji', compact('gajiKaryawan'));
|
||||
}
|
||||
}
|
|
@ -35,9 +35,8 @@ public function store(Request $request)
|
|||
'kode' => $kode,
|
||||
'kategori' => $validated['kategori'],
|
||||
'nama_karyawan' => $validated['nama_karyawan'],
|
||||
'keterangan' => null,
|
||||
'uang_masuk' => 0,
|
||||
'uang_keluar' => 0,
|
||||
'uang_masuk' => null,
|
||||
'uang_keluar' => null,
|
||||
'gaji' => $gaji,
|
||||
]);
|
||||
|
||||
|
|
|
@ -3,11 +3,19 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\LaporanModel;
|
||||
|
||||
class LaporanController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Laporan'); // This will return the home view
|
||||
$laporan = LaporanModel::orderBy('Tanggal', 'desc')->get();
|
||||
$totalUangMasuk = LaporanModel::sum('uang_masuk');
|
||||
$totalUangKeluar = LaporanModel::sum('uang_keluar');
|
||||
$totalGaji = LaporanModel::sum('gaji');
|
||||
$totalKredit = $totalUangKeluar + $totalGaji;
|
||||
$saldo = $totalUangMasuk - $totalKredit;
|
||||
|
||||
return view('Laporan', compact('laporan', 'totalUangMasuk', 'totalUangKeluar', 'totalGaji', 'totalKredit', 'saldo'));
|
||||
}
|
||||
}
|
|
@ -35,9 +35,9 @@ public function store(Request $request)
|
|||
'kode' => $kode,
|
||||
'kategori' => $validated['kategori'],
|
||||
'keterangan' => $validated['keterangan'],
|
||||
'uang_masuk' => 0,
|
||||
'uang_masuk' => null,
|
||||
'uang_keluar' => $uang_keluar,
|
||||
'gaji' => 0,
|
||||
'gaji' => null,
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'Data berhasil disimpan!');
|
||||
|
|
|
@ -29,15 +29,15 @@ public function store(Request $request)
|
|||
// Tentukan kode berdasarkan kategori
|
||||
$kode = $this->generateKode($validated['kategori']);
|
||||
|
||||
// Simpan data
|
||||
// Simpan data dengan nilai null untuk uang_keluar dan gaji
|
||||
UangMasukModel::create([
|
||||
'Tanggal' => $validated['Tanggal'],
|
||||
'kode' => $kode,
|
||||
'kategori' => $validated['kategori'],
|
||||
'keterangan' => $validated['keterangan'],
|
||||
'uang_masuk' => $uang_masuk,
|
||||
'uang_keluar' => 0,
|
||||
'gaji' => 0,
|
||||
'uang_keluar' => null, // Mengizinkan null
|
||||
'gaji' => null, // Mengizinkan null
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'Data berhasil disimpan!');
|
||||
|
|
|
@ -27,6 +27,7 @@ class GajiModel extends Model
|
|||
'kode',
|
||||
'kategori',
|
||||
'keterangan',
|
||||
'nama_karyawan',
|
||||
'uang_masuk',
|
||||
'uang_keluar',
|
||||
'gaji'
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LaporanModel extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// Nama tabel yang digunakan
|
||||
protected $table = 'laporan_transaksis'; // Ganti dengan nama tabel yang sesuai
|
||||
|
||||
// Primary key
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
// Menentukan apakah primary key adalah auto-increment
|
||||
public $incrementing = true;
|
||||
|
||||
// Tipe data primary key
|
||||
protected $keyType = 'int';
|
||||
|
||||
// Kolom yang dapat diisi
|
||||
protected $fillable = [
|
||||
'Tanggal',
|
||||
'kode',
|
||||
'kategori',
|
||||
'keterangan',
|
||||
'nama_karyawan',
|
||||
'uang_masuk',
|
||||
'uang_keluar',
|
||||
'gaji'
|
||||
];
|
||||
|
||||
// Timestamps
|
||||
public $timestamps = true;
|
||||
|
||||
// Jika Anda ingin mengubah nama kolom timestamps
|
||||
const CREATED_AT = 'created_at';
|
||||
const UPDATED_AT = 'updated_at';
|
||||
|
||||
protected $casts = [
|
||||
'Tanggal' => 'date',
|
||||
'uang_masuk' => 'decimal:2',
|
||||
'uang_keluar' => 'decimal:2',
|
||||
'gaji' => 'decimal:2',
|
||||
];
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Laporan_transaksi extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateNullableFieldsInLaporanTransaksis extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('laporan_transaksis', function (Blueprint $table) {
|
||||
// Ubah kolom-kolom menjadi nullable
|
||||
$table->string('keterangan')->nullable()->change();
|
||||
$table->string('nama_karyawan')->nullable()->change();
|
||||
$table->decimal('uang_masuk', 10, 2)->default(0)->change();
|
||||
$table->decimal('uang_keluar', 10, 2)->default(0)->change();
|
||||
$table->decimal('gaji', 10, 2)->default(0)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('laporan_transaksis', function (Blueprint $table) {
|
||||
// Kembalikan kolom-kolom menjadi tidak nullable
|
||||
$table->string('keterangan')->nullable(false)->change();
|
||||
$table->string('nama_karyawan')->nullable(false)->change();
|
||||
$table->decimal('uang_masuk', 10, 2)->nullable(false)->change();
|
||||
$table->decimal('uang_keluar', 10, 2)->nullable(false)->change();
|
||||
$table->decimal('gaji', 10, 2)->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
|
@ -12,30 +12,29 @@
|
|||
<!-- Filter Keterangan -->
|
||||
<div class="flex flex-wrap gap-4 px-6 py-4 border-b border-gray-200">
|
||||
<div class="flex items-center">
|
||||
<label class="mr-2 text-sm font-medium text-gray-600">Keterangan:</label>
|
||||
<input type="text" id="filterKeterangan" placeholder="Masukkan keterangan" class="border rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" onkeyup="filterTable()">
|
||||
<button class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">
|
||||
<label class="mr-2 text-sm font-medium text-gray-600">Nama Karyawan:</label>
|
||||
<input type="text" id="filterKeterangan" placeholder="Masukkan nama karyawan" class="border rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" onkeyup="filterTable()">
|
||||
<button class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors ml-2">
|
||||
<i class="fas fa-search mr-2"></i>Filter
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-lg shadow-lg p-6">
|
||||
<!-- Tabel Keterangan Gaji Karyawan -->
|
||||
<div class="overflow-x-auto">
|
||||
<table id="gajiTable" class="min-w-full bg-white border border-gray-300">
|
||||
<thead>
|
||||
<tr>
|
||||
<tr class="bg-gray-50">
|
||||
<th class="py-2 px-4 border-b text-left">No</th>
|
||||
<th class="py-2 px-4 border-b text-left">Keterangan</th>
|
||||
<th class="py-2 px-4 border-b text-left">Nominal</th>
|
||||
<th class="py-2 px-4 border-b text-left">Aksi</th>
|
||||
<th class="py-2 px-4 border-b text-left">Nama Karyawan</th>
|
||||
<th class="py-2 px-4 border-b text-left">Nominal Gaji</th>
|
||||
<th class="py-2 px-4 border-b text-center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($gajiKaryawan as $index => $gaji)
|
||||
@forelse($gajiKaryawan as $index => $gaji)
|
||||
<tr>
|
||||
<td class="py-2 px-4 border-b">{{ $index + 1 }}</td>
|
||||
<td class="py-2 px-4 border-b">{{ $gaji->keterangan }}</td>
|
||||
<td class="py-2 px-4 border-b">{{ $gaji->nama_karyawan }}</td>
|
||||
<td class="py-2 px-4 border-b">Rp {{ number_format($gaji->gaji, 0, ',', '.') }}</td>
|
||||
<td class="py-3 px-4 text-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
|
@ -48,7 +47,13 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="py-4 px-4 text-center text-gray-500">
|
||||
Tidak ada data gaji karyawan
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -24,18 +24,25 @@
|
|||
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
|
||||
<div class="bg-white p-4 rounded-lg shadow">
|
||||
<h3 class="text-gray-500 text-sm">Total Pendapatan</h3>
|
||||
<p class="text-2xl font-bold text-green-600">Rp 5.000.000</p>
|
||||
<p class="text-sm text-gray-400">+15% dari bulan lalu</p>
|
||||
<p class="text-2xl font-bold text-green-600">Rp {{ number_format($totalUangMasuk, 0, ',', '.') }}</p>
|
||||
<p class="text-sm text-gray-400">Data realtime keuangan</p>
|
||||
</div>
|
||||
<div class="bg-white p-4 rounded-lg shadow">
|
||||
<h3 class="text-gray-500 text-sm">Total Pengeluaran</h3>
|
||||
<p class="text-2xl font-bold text-red-600">Rp 3.200.000</p>
|
||||
<p class="text-sm text-gray-400">-5% dari bulan lalu</p>
|
||||
<p class="text-2xl font-bold text-red-600">Rp {{ number_format($totalKredit, 0, ',', '.') }}</p>
|
||||
<p class="text-sm text-gray-400">Data realtime keuangan</p>
|
||||
</div>
|
||||
<div class="bg-white p-4 rounded-lg shadow">
|
||||
<h3 class="text-gray-500 text-sm">Laba Bersih</h3>
|
||||
<p class="text-2xl font-bold text-blue-600">Rp 1.800.000</p>
|
||||
<p class="text-sm text-gray-400">+25% dari bulan lalu</p>
|
||||
<p class="text-2xl font-bold text-blue-600">Rp {{ number_format($saldo, 0, ',', '.') }}</p>
|
||||
|
||||
@if(isset($persentasePeningkatan))
|
||||
<p class="text-sm {{ $persentasePeningkatan >= 0 ? 'text-green-500' : 'text-red-500' }}">
|
||||
{{ $persentasePeningkatan >= 0 ? '+' : '' }}{{ number_format($persentasePeningkatan, 0) }}% dari bulan lalu
|
||||
</p>
|
||||
@else
|
||||
<p class="text-sm text-gray-400">Data realtime keuangan</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="bg-white p-4 rounded-lg shadow">
|
||||
<h3 class="text-gray-500 text-sm">Saldo Kas</h3>
|
||||
|
@ -99,37 +106,61 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="tableBody">
|
||||
<!-- Example data with more accounting details -->
|
||||
<tr class="border-b border-gray-200 hover:bg-gray-50">
|
||||
<td class="py-3 px-4">1</td>
|
||||
<td class="py-3 px-4">2024-02-20</td>
|
||||
<td class="py-3 px-4">411</td>
|
||||
<td class="py-3 px-4">Penjualan</td>
|
||||
<td class="py-3 px-4">Pendapatan dari penjualan produk A</td>
|
||||
<td class="py-3 px-4 text-right text-green-600">Rp 5.000.000</td>
|
||||
<td class="py-3 px-4 text-right text-red-600">-</td>
|
||||
<td class="py-3 px-4 text-right font-medium">Rp 5.000.000</td>
|
||||
<td class="py-3 px-4 text-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
<button class="text-blue-600 hover:text-blue-800" title="Edit">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
<button class="text-green-600 hover:text-green-800" title="Detail">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
<button class="text-red-600 hover:text-red-800" title="Hapus">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Looping data dari database -->
|
||||
@php
|
||||
$no = 1;
|
||||
$runningSaldo = 0;
|
||||
@endphp
|
||||
|
||||
@foreach($laporan as $item)
|
||||
@php
|
||||
$debit = $item->uang_masuk;
|
||||
$kredit = $item->uang_keluar + $item->gaji;
|
||||
$runningSaldo += $debit - $kredit;
|
||||
@endphp
|
||||
<tr class="border-b border-gray-200 hover:bg-gray-50">
|
||||
<td class="py-3 px-4">{{ $no++ }}</td>
|
||||
<td class="py-3 px-4">{{ $item->Tanggal->format('Y-m-d') }}</td>
|
||||
<td class="py-3 px-4">{{ $item->kode }}</td>
|
||||
<td class="py-3 px-4">{{ $item->kategori }}</td>
|
||||
<td class="py-3 px-4">{{ $item->keterangan }}</td>
|
||||
<td class="py-3 px-4 text-right text-green-600">
|
||||
@if($debit > 0)
|
||||
Rp {{ number_format($debit, 0, ',', '.') }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-3 px-4 text-right text-red-600">
|
||||
@if($kredit > 0)
|
||||
Rp {{ number_format($kredit, 0, ',', '.') }}
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td class="py-3 px-4 text-right font-medium">Rp {{ number_format($runningSaldo, 0, ',', '.') }}</td>
|
||||
<td class="py-3 px-4 text-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
<button class="text-blue-600 hover:text-blue-800" title="Edit">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
<button class="text-green-600 hover:text-green-800" title="Detail">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
<button class="text-red-600 hover:text-red-800" title="Hapus">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="bg-gray-50 font-bold">
|
||||
<td colspan="5" class="py-3 px-4 text-right">Total:</td>
|
||||
<td class="py-3 px-4 text-right text-green-600">Rp 5.000.000</td>
|
||||
<td class="py-3 px-4 text-right text-red-600">Rp 0</td>
|
||||
<td class="py-3 px-4 text-right">Rp 5.000.000</td>
|
||||
<td class="py-3 px-4 text-right text-green-600">Rp {{ number_format($totalUangMasuk, 0, ',', '.') }}</td>
|
||||
<td class="py-3 px-4 text-right text-red-600">Rp {{ number_format($totalKredit, 0, ',', '.') }}</td>
|
||||
<td class="py-3 px-4 text-right">Rp {{ number_format($saldo, 0, ',', '.') }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
@ -149,10 +180,7 @@
|
|||
<i class="fas fa-print mr-2"></i>Print
|
||||
</button>
|
||||
</div>
|
||||
<button class="btn bg-blue-500 text-white hover:bg-blue-600">
|
||||
<i class="fas fa-plus mr-2"></i>Tambah Transaksi
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Pagination (same as before) -->
|
||||
<!-- Modal (same as before) -->
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
Route::get('/uang-keluar', [UangKeluarController::class, 'index'])->name('uang-keluar.index');
|
||||
Route::post('/uang-keluar', [UangKeluarController::class, 'store'])->name('uangkeluar.store');
|
||||
Route::get('/input-gaji', [InputGajiController::class, 'index'])->name('input-gaji.index');
|
||||
Route::post('/input-gaji', [InputGajiController::class, 'store'])->name('input-gaji.store');
|
||||
// Route::post('/input-gaji', [InputGajiController::class, 'store'])->name('input-gaji.store');
|
||||
|
||||
//untuk Uang Gaji
|
||||
Route::get('/gaji', [GajiController::class, 'index'])->name('gaji.index');
|
||||
|
|
Loading…
Reference in New Issue