Browse Source

update status disposal dan peminjaman

master
Gunawan19621 12 months ago
parent
commit
194ccc2c4a
  1. 77
      app/Exports/StokOpNameExport.php
  2. 9
      app/Http/Controllers/DisposalController.php
  3. 21
      app/Http/Controllers/PeminjamanController.php
  4. 8
      app/Http/Controllers/PetternLotPetiController.php
  5. 69
      app/Http/Controllers/StokOpNameController.php
  6. 9
      app/Http/Controllers/TransferController.php
  7. 10
      app/Http/Requests/ValidasiCreatePeminjaman.php
  8. 14
      app/Http/Requests/ValidasiUpdatePeminjaman.php
  9. 11
      app/Models/Peti.php
  10. 7
      app/Models/asset_status.php
  11. 2
      database/migrations/2023_11_06_122033_create_asset_statuses_table.php
  12. 2
      database/seeders/Type_Peti.php
  13. 30
      database/seeders/WarehouseSeeder.php
  14. 5
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/create.blade.php
  15. 6
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php
  16. 0
      resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/detail_peti.blade.php
  17. 4
      resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php
  18. 133
      resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php
  19. 38
      resources/views/dashboard/Peminjaman/create.blade.php
  20. 87
      resources/views/dashboard/Peminjaman/edit.blade.php
  21. 2
      resources/views/dashboard/Peminjaman/index.blade.php
  22. 2
      resources/views/dashboard/Pengembalian/edit.blade.php
  23. 4
      routes/web.php

77
app/Exports/StokOpNameExport.php

@ -0,0 +1,77 @@
<?php
namespace App\Exports;
use App\Models\Peti;
use Illuminate\Support\Carbon;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\FromCollection;
class StokOpNameExport implements FromCollection, WithHeadings
{
protected $stokOpnames;
protected $todayStokOpnames;
protected $yesterdayStokOpnames;
public function __construct($stokOpnames, $todayStokOpnames, $yesterdayStokOpnames)
{
$this->stokOpnames = $stokOpnames;
$this->todayStokOpnames = $todayStokOpnames;
$this->yesterdayStokOpnames = $yesterdayStokOpnames;
}
public function collection()
{
$data = collect();
$nomor = 1;
foreach ($this->stokOpnames as $data_StokOpname) {
$yesterdayStokOpname = $this->yesterdayStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->first();
$todayStokOpname = $this->todayStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->first();
$data->push([
'No' => $nomor++,
'Customer' => $data_StokOpname->customer->name,
'Kode' => $data_StokOpname->customer->code_customer . ' 0 ' . $data_StokOpname->tipe_peti->type,
'Ukuran Peti' => $data_StokOpname->tipe_peti->size_peti,
'Bagging Stok' => $yesterdayStokOpname ? $yesterdayStokOpname->total_petis : '-',
'Add' => $todayStokOpname ? $todayStokOpname->total_petis : '0',
'Total' => $data_StokOpname->total_petis ?? '0',
'DI ISTW' => 'Belum',
'Gudang A' => 'Belum',
'Gudang B' => 'Belum',
'Gudang C' => 'Belum',
'Stok Opname' => 'Belum',
'Total Stok' => $data_StokOpname->total_petis ?? '0',
]);
}
return $data;
}
public function headings(): array
{
return [
'No',
'Customer',
'Kode',
'Ukuran Peti',
'Bagging Stok',
'Add',
'Total',
'DI ISTW',
'Gudang A',
'Gudang B',
'Gudang C',
'Stok Opname',
'Total Stok',
];
}
}

9
app/Http/Controllers/DisposalController.php

@ -6,7 +6,6 @@ use App\Models\Peti;
use App\Models\Customer;
use App\Models\Disposal;
use App\Models\m_warehouse;
use Illuminate\Http\Request;
use Symfony\Component\Uid\Uuid;
use Illuminate\Support\Facades\Auth;
use App\Http\Requests\Disposal\ValidasiCreateDisposal;
@ -30,8 +29,14 @@ class DisposalController extends Controller
*/
public function create()
{
$petiWithStatusNotZeroOrEmptyAndActive = Peti::where(function ($query) {
$query->whereHas('assetStatuses', function ($subquery) {
$subquery->where('status', '!=', 0);
})->orWhereDoesntHave('assetStatuses');
})->where('status', 'aktif')->get();
$data = [
'peti' => Peti::get(),
'peti' => $petiWithStatusNotZeroOrEmptyAndActive,
'warehouse' => m_warehouse::get(),
'customer' => Customer::get(),
'active' => 'menu-disposal',

21
app/Http/Controllers/PeminjamanController.php

@ -34,13 +34,23 @@ class PeminjamanController extends Controller
*/
public function create()
{
$petiWithStatusNotZeroOrEmptyAndActive = Peti::where(function ($query) {
$query->whereHas('assetStatuses', function ($subquery) {
$subquery->where('status', '!=', 0);
})->orWhereDoesntHave('assetStatuses');
})->where('status', 'aktif')->get();
// $petiTransfer = Peti::where('id', $PetiId)
// ->leftJoin('category', 'product.category', '=', 'category.id')
// ->select('product.id','category.name')->first();
$data = [
'peti' => Peti::all(),
// 'peti' => Peti::all(),
'peminjaman' => asset_status::get(),
'warehouse' => m_warehouse::get(),
'peti_block' => Peti::whereNotIn('id', asset_status::where('status', 0)->pluck('peti_id')->toArray())
->where('status', 'AKTIF') // Sesuaikan dengan nama kolom yang benar
->get(),
'peti_block' => $petiWithStatusNotZeroOrEmptyAndActive,
// 'peti_block' => Peti::whereNotIn('id', asset_status::where('status', 0)->pluck('peti_id')->toArray())
// ->where('status', 'AKTIF') // Sesuaikan dengan nama kolom yang benar
// ->get(),
'customer' => Customer::get(),
'existingPeti' => asset_status::pluck('peti_id')->toArray(),
'active' => 'menu-peminjaman',
@ -53,6 +63,7 @@ class PeminjamanController extends Controller
*/
public function store(ValidasiCreatePeminjaman $request)
{
// dd($request->all());
// dd($request);
try {
$currentUser = Auth::user();
@ -89,6 +100,7 @@ class PeminjamanController extends Controller
'peti' => Peti::all(),
'peminjaman' => asset_status::find($id),
'warehouse' => m_warehouse::get(),
'customer' => Customer::get(),
'active' => 'menu-peminjaman',
];
return view('dashboard.Peminjaman.edit', $data);
@ -99,6 +111,7 @@ class PeminjamanController extends Controller
*/
public function update(ValidasiUpdatePeminjaman $request, $id)
{
// dd($request->all());
// dd($request);
try {
$peminjaman = asset_status::findOrFail($id);

8
app/Http/Controllers/PetternLotPetiController.php

@ -17,21 +17,23 @@ class PetternLotPetiController extends Controller
'peti' => Peti::get(),
'active' => 'menu-Pettern_Lot_Peti'
];
return view('dashboard.Master_Data.Report.PATTERN LOT PETI.index', $data);
return view('dashboard.Master_Data.Report.Pattern_lot_peti.index', $data);
}
public function show($id)
{
// dd('test');
$data = [
'peti' => Peti::find($id),
'assetStatus' => asset_status::where('peti_id', $id)->get(),
'active' => 'menu-Pettern_Lot_Peti'
];
return view('dashboard.Master_Data.Report.PATTERN LOT PETI.detail_peti', $data);
return view('dashboard.Master_Data.Report.Pattern_lot_peti.detail_peti', $data);
}
public function export()
{
return Excel::download(new PetternLotPetiExport, 'PATTERN LOT PETI.xlsx');
// dd('test');
return Excel::download(new PetternLotPetiExport, 'PATTERN_LOT_PETI.xlsx');
}
}

69
app/Http/Controllers/StokOpNameController.php

@ -2,16 +2,22 @@
namespace App\Http\Controllers;
use App\Models\asset_status;
use App\Exports\StokOpNameExport;
use App\Models\Peti;
use App\Models\asset_status;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
class StokOpNameController extends Controller
{
public function index()
{
// Total Peti Berdasarkan Gudang
$gudangStokOpnames = Peti::with('customer', 'tipe_peti', 'warehouse')
->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis'))
->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id')
->get();
// Total Peti Berdasarkan Tanggal Sekarang
$todayStokOpnames = Peti::with('customer', 'tipe_peti')
@ -23,61 +29,48 @@ class StokOpNameController extends Controller
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang
$yesterdayStokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->whereDate('created_at', today()->subDays(1))
->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini
->groupBy('customer_id', 'tipe_peti_id')
->get();
// Total Peti Berdasarkan Tabel asset_status
// $totalPetiAssetStatus = asset_status::select('peti_id', DB::raw('COUNT(*) as total_petis'))
// ->groupBy('peti_id')
// ->get();
$petiIds = asset_status::whereHas('peti', function ($query) {
$query->groupBy('customer_id', 'tipe_peti_id');
})
->pluck('peti_id');
// Total Peti
$stokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->groupBy('customer_id', 'tipe_peti_id')
->get();
$petis = Peti::get();
$data = [
'stokOpnames' => $stokOpnames,
'todayStokOpnames' => $todayStokOpnames, // tambahin ini di array data 'todayStokOpnames' => $todayStokOpnames,
'yesterdayStokOpnames' => $yesterdayStokOpnames, // tambahin ini di array data 'yesterdayStokOpnames' => $yesterdayStokOpnames,
'totalPetiAssetStatus' => $petiIds, // Sesuaikan dengan model dan kolom yang sesuai
'assetStatus' => asset_status::get(),
'petis' => $petis,
'gudangStokOpnames' => $gudangStokOpnames, // tambahin ini di array data 'gudangStokOpnames' => $gudangStokOpnames,
'active' => 'menu-Stok_Opname'
];
return view('dashboard.Master_Data.Report.Stok_opname.index', $data);
}
// public function index()
// {
public function export()
{
//total peti
$stokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->groupBy('customer_id', 'tipe_peti_id')
->get();
// // // Total Peti Berdasarkan Gudang
// // $gudangStokOpnames = Peti::with('customer', 'tipe_peti')
// // ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
// // ->groupBy('customer_id', 'tipe_peti_id')
// // ->get();
// Total Peti Berdasarkan Tanggal Sekarang
$todayStokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->whereDate('created_at', today())
->groupBy('customer_id', 'tipe_peti_id')
->get();
// $stokOpnames = Peti::with('customer', 'tipe_peti')
// ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
// ->groupBy('customer_id', 'tipe_peti_id')
// ->get();
// $data = [
// 'stokOpnames ' => $stokOpnames,
// // 'todayStokOpnames' => $todayStokOpnames,
// // 'yesterdayStokOpnames' => $yesterdayStokOpnames,
// // 'gudangStokOpnames' => $gudangStokOpnames,
// 'active' => 'menu-Stok_Opname'
// ];
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang
$yesterdayStokOpnames = Peti::with('customer', 'tipe_peti')
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis'))
->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini
->groupBy('customer_id', 'tipe_peti_id')
->get();
// return view('dashboard.Master_Data.Report.Stok_opname.index', $data);
// }
return Excel::download(new StokOpNameExport($stokOpnames, $todayStokOpnames, $yesterdayStokOpnames), 'stok_opname.xlsx');
}
}

9
app/Http/Controllers/TransferController.php

@ -35,10 +35,15 @@ class TransferController extends Controller
*/
public function create()
{
$petiWithStatusNotZeroOrEmptyAndActive = Peti::where(function ($query) {
$query->whereHas('assetStatuses', function ($subquery) {
$subquery->where('status', '!=', 0);
})->orWhereDoesntHave('assetStatuses');
})->where('status', 'aktif')->get();
$data = [
'customer' => Customer::get(),
'peti' => Peti::get(),
// 'warehouse' => Peti::with('warehouse_id')->get(),
'peti' => $petiWithStatusNotZeroOrEmptyAndActive,
'warehouse' => m_warehouse::get(),
'active' => 'menu-transfer',
];

10
app/Http/Requests/ValidasiCreatePeminjaman.php

@ -23,8 +23,10 @@ class ValidasiCreatePeminjaman extends FormRequest
{
return [
'peti_id' => 'required|integer', // Pastikan peti_id ada dalam tabel petis
'customer_id' => 'required|integer', // Pastikan customer_id ada dalam tabel customers
'exit_at' => 'required|date',
'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at
'warehouse_id' => 'required|integer', // Pastikan warehouse_id ada dalam tabel m_warehouses
'exit_warehouse' => 'required|integer',
];
}
@ -34,12 +36,16 @@ class ValidasiCreatePeminjaman extends FormRequest
return [
'peti_id.required' => 'Bidang Detail Peti wajib diisi.',
'peti_id.integer' => 'Bidang Detail Peti harus berupa angka.',
'customer_id.required' => 'Bidang Customer wajib diisi.',
'customer_id.integer' => 'Bidang Customer harus berupa angka.',
'exit_at.required' => 'Bidang Tanggal Peminjaman wajib diisi.',
'exit_at.date' => 'Bidang Tanggal Peminjaman harus berupa tanggal.',
'est_pengembalian.required' => 'Bidang Estimasi Tanggal Pengembalian wajib diisi.',
'est_pengembalian.date' => 'Bidang Estimasi Tanggal Pengembalian harus berupa tanggal.',
'exit_warehouse.required' => 'Bidang Asal Gudang wajib diisi.',
'exit_warehouse.integer' => 'Bidang Asal Gudang harus berupa angka.',
'warehouse_id.required' => 'Bidang Asal Gudang wajib diisi.',
'warehouse_id.integer' => 'Bidang Asal Gudang harus berupa angka.',
'exit_warehouse.required' => 'Bidang Tujuan Gudang wajib diisi.',
'exit_warehouse.integer' => 'Bidang Tujuan Gudang harus berupa angka.',
];
}
}

14
app/Http/Requests/ValidasiUpdatePeminjaman.php

@ -22,10 +22,12 @@ class ValidasiUpdatePeminjaman extends FormRequest
public function rules(): array
{
return [
'peti_id' => 'required', // Pastikan peti_id ada dalam tabel petis
'peti_id' => 'required|integer', // Pastikan peti_id ada dalam tabel petis
'customer_id' => 'required|integer', // Pastikan customer_id ada dalam tabel customers
'exit_at' => 'required|date',
'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at
'exit_warehouse' => 'required',
'warehouse_id' => 'required|integer', // Pastikan warehouse_id ada dalam tabel m_warehouses
'exit_warehouse' => 'required|integer',
];
}
@ -33,11 +35,17 @@ class ValidasiUpdatePeminjaman extends FormRequest
{
return [
'peti_id.required' => 'Bidang Detail Peti wajib diisi.',
'peti_id.integer' => 'Bidang Detail Peti harus berupa angka.',
'customer_id.required' => 'Bidang Customer wajib diisi.',
'customer_id.integer' => 'Bidang Customer harus berupa angka.',
'exit_at.required' => 'Bidang Tanggal Peminjaman wajib diisi.',
'exit_at.date' => 'Bidang Tanggal Peminjaman harus berupa tanggal.',
'est_pengembalian.required' => 'Bidang Estimasi Tanggal Pengembalian wajib diisi.',
'est_pengembalian.date' => 'Bidang Estimasi Tanggal Pengembalian harus berupa tanggal.',
'exit_warehouse.required' => 'Bidang Asal Gudang wajib diisi.',
'warehouse_id.required' => 'Bidang Asal Gudang wajib diisi.',
'warehouse_id.integer' => 'Bidang Asal Gudang harus berupa angka.',
'exit_warehouse.required' => 'Bidang Tujuan Gudang wajib diisi.',
'exit_warehouse.integer' => 'Bidang Tujuan Gudang harus berupa angka.',
];
}
}

11
app/Models/Peti.php

@ -45,4 +45,15 @@ class Peti extends Model
{
return $this->belongsTo(Kondisi_Peti::class, 'kondisipeti_id')->select('id', 'nama_kondisi', 'deskripsi_kondisi');
}
public function transfer()
{
return $this->hasOne(Transfer::class, 'peti_id');
}
// proses pengambilan data
public function assetStatuses()
{
return $this->hasMany(asset_status::class, 'peti_id');
}
}

7
app/Models/asset_status.php

@ -20,6 +20,8 @@ class asset_status extends Model
'exit_at',
'est_pengembalian',
'exit_pic',
'customer_id',
'warehouse_id',
'exit_warehouse',
'enter_at',
'enter_pic',
@ -35,6 +37,11 @@ class asset_status extends Model
return $this->belongsTo(m_asset::class, 'asset_id');
}
public function warehouseId()
{
return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address');
}
public function warehouse()
{
return $this->belongsTo(m_warehouse::class, 'exit_warehouse')->select('id', 'name', 'address');

2
database/migrations/2023_11_06_122033_create_asset_statuses_table.php

@ -18,6 +18,8 @@ return new class extends Migration
$table->date('exit_at')->nullable();
$table->date('est_pengembalian')->nullable();
$table->string('exit_pic', 200)->nullable();
$table->foreignId('customer_id')->nullable()->constrained('customers');
$table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses');
$table->foreignId('exit_warehouse')->nullable()->constrained('m_warehouses');
$table->date('enter_at')->nullable();
$table->string('enter_pic', 200)->nullable();

2
database/seeders/Type_Peti.php

@ -15,7 +15,7 @@ class Type_Peti extends Seeder
public function run(): void
{
DB::table('type_petis')->insert([
'type' => 'Bagus',
'type' => 'Baik',
'size_peti' => '2 X 2 X 2 X 2',
'description' => 'Detail Barang Bagus',
'created_by' => 'Seeder',

30
database/seeders/WarehouseSeeder.php

@ -15,18 +15,36 @@ class WarehouseSeeder extends Seeder
{
// Warehouse 1
m_warehouse::create([
'name' => 'Gudang A',
'description' => 'Gudang utama',
'address' => 'Alamat Gudang A',
'name' => 'Jakarta',
'description' => 'PT Indonesia Steel Tube Works Jakarta Office',
'address' => 'Jln. Jakarta Timur',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// Warehouse 2
m_warehouse::create([
'name' => 'Gudang B',
'description' => 'Gudang cabang',
'address' => 'Alamat Gudang B',
'name' => 'Bekasi',
'description' => 'PT Indonesia Steel Tube Works Bekasi Office',
'address' => 'Jln. Bekasi',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// Warehouse 3
m_warehouse::create([
'name' => 'Semarang',
'description' => 'PT Indonesia Steel Tube Works Semarang Office',
'address' => 'Jln. Semarang',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);
// Warehouse 4
m_warehouse::create([
'name' => 'Surabaya',
'description' => 'PT Indonesia Steel Tube Works Surabaya Office',
'address' => 'Jln. Surabaya',
'created_by' => 'Seeder',
'updated_by' => 'Seeder',
]);

5
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/create.blade.php

@ -43,8 +43,9 @@
@endforeach
</select>
<label for="kondisipeti_id" class="col-form-label">Kondisi Peti:</label>
<select class="form-control" name="kondisipeti_id" id="kondisipeti_id">
<label for="kondisipeti_id" class="col-form-label">Kondisi Peti: <span
class="text-danger">*</span></label>
<select class="form-control" name="kondisipeti_id" id="kondisipeti_id" required>
<option disabled selected>Pilih Kondisi Peti</option>
@foreach ($kondisiPeti as $data_kondisiPeti)
<option value="{{ $data_kondisiPeti->id }}">{{ $data_kondisiPeti->nama_kondisi }}</option>

6
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php

@ -39,6 +39,7 @@
<tr>
<th class="text-center" style="width: 10px">No</th>
<th><input type="checkbox" class="checkbox " id="selectAll"></th>
<th>Fix Lot</th>
<th>User</th>
<th>Customer</th>
<th>WH</th>
@ -48,7 +49,7 @@
<th>Lot No</th>
<th>Kondisi Peti</th>
<th>Packing No</th>
<th>Fix Lot</th>
<th>Status</th>
<th class="text-center">Action</th>
</tr>
</thead>
@ -60,6 +61,7 @@
<tr>
<td class="text-center">{{ $nopeti++ }}</td>
<td><input type="checkbox" class="checkbox" value="{{ $data_peti->id }}"></td>
<td>{{ $data_peti->fix_lot }}</td>
<td>{{ $data_peti->created_by }}</td>
<td>{{ $data_peti->customer->name }}</td>
<td>{{ $data_peti->warehouse->name }}</td>
@ -69,7 +71,7 @@
<td>{{ $data_peti->customer->lot_no }}</td>
<td>{{ $data_peti->kondisipeti->nama_kondisi }}</td>
<td class="text-right">{{ $data_peti->packing_no }}</td>
<td>{{ $data_peti->fix_lot }}</td>
<td>{{ $data_peti->status }}</td>
<td class="text-center">
<a href="{{ route('dashboard.peti.show', [$data_peti->id]) }}">
<i class="fa fa-eye mr-2" style="font-size: 20px"></i>

0
resources/views/dashboard/Master_Data/Report/PATTERN LOT PETI/detail_peti.blade.php → resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/detail_peti.blade.php

4
resources/views/dashboard/Master_Data/Report/PATTERN LOT PETI/index.blade.php → resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php

@ -17,9 +17,9 @@
<h5 class="m-0 font-weight-bold text-primary mt-2">Report Pettern Lot Peti</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split ml-auto" target="_blank">
{{-- <a href="#" class="btn btn-success btn-icon-split ml-auto" target="_blank">
<span class="text">Cetak PDF</span>
</a>
</a> --}}
<a href="{{ route('dashboard.Pettern_Lot_Peti.export') }}" class="btn btn-info btn-icon-split ml-auto"
target="_blank">
<span class="text">Cetak Exel</span>

133
resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php

@ -17,10 +17,10 @@
<h5 class="m-0 font-weight-bold text-primary mt-2">Report Stok Opname</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split ml-auto" target="_blank">
<span class="text">Cetak PDF</span>
{{-- <a href="#" class="btn btn-success btn-icon-split ml-auto" target="_blank">
<span class="text">Cetak PDF</span> --}}
</a>
<a href="{{ route('dashboard.Pettern_Lot_Peti.export') }}" class="btn btn-info btn-icon-split ml-auto"
<a href="{{ route('dashboard.StokOpname.export') }}" class="btn btn-info btn-icon-split ml-auto"
target="_blank">
<span class="text">Cetak Exel</span>
</a>
@ -36,18 +36,17 @@
<th rowspan="2"style="vertical-align: middle; text-align: center;">Customer</th>
<th rowspan="2"style="vertical-align: middle; text-align: center;">Kode</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Ukuran Peti</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Bagginning</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Bagginning<br>Stok</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Add</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Total</th>
<th colspan="4" style="text-align: center; vertical-align: middle;">Stock</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Stok Opname</th>
<th rowspan="2" style="vertical-align: middle; text-align: center;">Total</th>
</tr>
<tr>
<th>DI ISTW</th>
<th>Gudang A</th>
<th>Gudang B</th>
<th>Gudang C</th>
<th>Jakarta</th>
<th>Bekasi</th>
<th>Semarang</th>
<th>Surabaya</th>
</tr>
</thead>
<tbody>
@ -56,12 +55,12 @@
@endphp
@forelse ($stokOpnames as $data_StokOpname)
<tr>
<td>{{ $noreport++ }}</td>
<td class="text-center">{{ $noreport++ }}</td>
<td>{{ $data_StokOpname->customer->name }}</td>
<td>{{ $data_StokOpname->customer->code_customer }} -
{{ $data_StokOpname->tipe_peti->type }}</td>
<td>{{ $data_StokOpname->tipe_peti->size_peti }}</td>
<td>
<td class="text-center">
@php
// Temukan data dari tanggal sebelum sekarang (kemarin) berdasarkan id
$yesterdayStokOpname = $yesterdayStokOpnames
@ -73,10 +72,10 @@
@if ($yesterdayStokOpname && $yesterdayStokOpname->total_petis > 0)
{{ $yesterdayStokOpname->total_petis }}
@else
-
0
@endif
</td>
<td>
<td class="text-center">
@php
$todayStokOpname = $todayStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
@ -86,63 +85,85 @@
@if ($todayStokOpname && $todayStokOpname->total_petis > 0)
{{ $todayStokOpname->total_petis }}
@else
-
0
@endif
</td>
<td>
<td class="text-center">
@if ($data_StokOpname->total_petis > 0)
{{ $data_StokOpname->total_petis }}
@else
-
0
@endif
</td>
<td>
-
<td class="text-center">
@php
// Temukan data dari tanggal sebelum sekarang (kemarin) berdasarkan id
$gudangStokOpname = $gudangStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->where('warehouse_id', 1)
->first();
@endphp
{{-- Jumlah total peti pada tanggal sebelum sekarang (kemarin) --}}
@if ($gudangStokOpname && $gudangStokOpname->total_petis > 0)
{{ $gudangStokOpname->total_petis }}
@else
0
@endif
</td>
<td>Gudang A</td>
<td>Gudang B</td>
<td>
<td class="text-center">
@php
$totalNullableCount = 0;
// Temukan data dari tanggal sebelum sekarang (kemarin) berdasarkan id
$gudangStokOpname = $gudangStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->where('warehouse_id', 2)
->first();
@endphp
@foreach ($petis as $peti)
@php
$totalNullableCount += $assetStatus
->where('peti_id', $peti->id)
->where('enter_warehouse', '=', 0)
// ->where('customer_id', $peti->customer_id)
->count();
@endphp
@endforeach
{{ $totalNullableCount }}
{{-- @foreach ($petis as $item)
@php
$totalAsset = \App\Models\asset_status::get();
$totalAssetStatus = $totalAsset
->where('customer_id', $item->customer_id)
->where('peti_id', $item->id)
->count();
@endphp
@if ($totalAssetStatus > 0)
{{ $totalAssetStatus }}
@else
0
@endif
@endforeach --}}
{{-- Jumlah total peti pada tanggal sebelum sekarang (kemarin) --}}
@if ($gudangStokOpname && $gudangStokOpname->total_petis > 0)
{{ $gudangStokOpname->total_petis }}
@else
0
@endif
</td>
<td class="text-center">
@php
// Temukan data dari tanggal sebelum sekarang (kemarin) berdasarkan id
$gudangStokOpname = $gudangStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->where('warehouse_id', 3)
->first();
@endphp
{{-- Jumlah total peti pada tanggal sebelum sekarang (kemarin) --}}
@if ($gudangStokOpname && $gudangStokOpname->total_petis > 0)
{{ $gudangStokOpname->total_petis }}
@else
0
@endif
</td>
<td class="text-center">
@php
// Temukan data dari tanggal sebelum sekarang (kemarin) berdasarkan id
$gudangStokOpname = $gudangStokOpnames
->where('customer_id', $data_StokOpname->customer_id)
->where('tipe_peti_id', $data_StokOpname->tipe_peti_id)
->where('warehouse_id', 4)
->first();
@endphp
{{-- Jumlah total peti pada tanggal sebelum sekarang (kemarin) --}}
@if ($gudangStokOpname && $gudangStokOpname->total_petis > 0)
{{ $gudangStokOpname->total_petis }}
@else
0
@endif
</td>
<td> - </td>
<td>
<td class="text-center">
@if ($data_StokOpname->total_petis > 0)
{{ $data_StokOpname->total_petis }}
@else
-
0
@endif
</td>
</tr>

38
resources/views/dashboard/Peminjaman/create.blade.php

@ -17,18 +17,24 @@
<div class="form-group">
<label for="peti_id" class="col-form-label">Pilih Detail Peti: <span
class="text-danger">*</span></label>
<select class="form-control" name="peti_id" type="text" id="peti_id" required>
<select class="form-control" name="peti_id" id="peti_id" required>
<option disabled selected>Pilih Detail Peti</option>
@foreach ($peti_block as $data_peti)
<option value="{{ $data_peti->id }}" data-warehouse-id="{{ $data_peti->warehouse_id }}"
data-customer-name="{{ $data_peti->customer->name }}">
data-customer-id="{{ $data_peti->customer->id }}"
data-warehouse-name="{{ $data_peti->warehouse->name }}">
{{ $data_peti->fix_lot }}
</option>
@endforeach
</select>
<label for="name" class="col-form-label">Customer:<span class="text-danger">*</span></label>
<input class="form-control" name="name" type="text" id="name" placeholder="Nama Customer">
<label for="customer_id" class="col-form-label">Customer:<span class="text-danger">*</span></label>
<select class="form-control" name="customer_id" type="text" id="customer_id" required>
<option disabled selected>Pilih Nama Customer</option>
@foreach ($customer as $data)
<option value="{{ $data->id }}">{{ $data->name }}</option>
@endforeach
</select>
<label for="exit_at" class="col-form-label">Tanggal Peminjaman: <span
class="text-danger">*</span></label>
@ -39,13 +45,14 @@
class="text-danger">*</span></label>
<input class="form-control" name="est_pengembalian" type="date" id="est_pengembalian" required>
<label for="warehouse" class="col-form-label">Asal Gudang:</label>
<select class="form-control" name="warehouse" type="text" id="warehouse" required>
<label for="warehouse_id" class="col-form-label">Asal Gudang:</label>
<select class="form-control" name="warehouse_id" type="text" id="warehouse_id" required>
<option disabled selected>Pilih Asal Gudang</option>
@foreach ($warehouse as $data)
<option value="{{ $data->id }}">{{ $data->name }}</option>
@endforeach
</select>
<label for="exit_warehouse" class="col-form-label">Tujuan Gudang: <span
class="text-danger">*</span></label>
<select class="form-control" name="exit_warehouse" type="text" id="exit_warehouse" required>
@ -97,26 +104,25 @@
// Mendapatkan elemen select detail peti
const petiSelect = document.getElementById('peti_id');
// Mendapatkan elemen select asal gudang
const exitWarehouseSelect = document.getElementById('warehouse');
// Mendapatkan elemen select customer
const customerSelect = document.getElementById('customer_id');
// Mendapatkan elemen input Customer
const nameInput = document.getElementById('name');
// Mendapatkan elemen select asal gudang
const warehouseSelect = document.getElementById('warehouse_id');
// Menambahkan event listener ke select detail peti
petiSelect.addEventListener('change', function() {
// Mendapatkan data-warehouse-id dari option yang dipilih
const selectedOption = this.options[this.selectedIndex];
const warehouseId = selectedOption.getAttribute('data-warehouse-id');
// Mendapatkan data-customer-name dari option yang dipilih
const customerName = selectedOption.getAttribute('data-customer-name');
const customerId = selectedOption.getAttribute('data-customer-id');
const warehouseName = selectedOption.getAttribute('data-warehouse-name');
// Memilih asal gudang berdasarkan data-warehouse-id
exitWarehouseSelect.value = warehouseId;
warehouseSelect.value = warehouseId;
// Mengisi input Customer dengan nama pelanggan
nameInput.value = customerName;
// Memilih customer berdasarkan data-customer-id
customerSelect.value = customerId;
});
</script>

87
resources/views/dashboard/Peminjaman/edit.blade.php

@ -15,47 +15,58 @@
enctype="multipart/form-data" id="editForm">
@csrf
@method('PUT')
<div class="form-group">
<label for="peti_id" class="col-form-label">Pilih Detail Peti: <span
class="text-danger">*</span></label>
<select class="form-control" name="peti_id" id="peti_id">
<option disabled selected>Pilih Detail Peti</option>
@foreach ($peti as $data_peti)
<option value="{{ $data_peti->id }}" data-warehouse-id="{{ $data_peti->warehouse_id }}"
{{ $data_peti->id == $peminjaman->peti_id ? 'selected' : '' }}>
{{ $data_peti->fix_lot }}
</option>
@endforeach
</select>
</div>
<label for="peti_id" class="col-form-label">Pilih Detail Peti: <span class="text-danger">*</span></label>
<input type="hidden" name="peti_id" value="{{ $peminjaman->peti_id }}">
<input class="form-control" name="coba"value="{{ $peminjaman->peti->fix_lot }}" @readonly(true)>
{{-- <select class="form-control" name="peti_id" id="peti_id">
<option disabled selected>Pilih Detail Peti</option>
@foreach ($peti as $data_peti)
<option value="{{ $data_peti->id }}" data-warehouse-id="{{ $data_peti->warehouse_id }}"
{{ $data_peti->id == $peminjaman->peti_id ? 'selected' : '' }}>
{{ $data_peti->fix_lot }}
</option>
@endforeach
</select> --}}
<div class="form-group">
<label for="exit_at" class="col-form-label">Tanggal Peminjaman: <span
class="text-danger">*</span></label>
<input class="form-control" name="exit_at" type="date" id="exit_at"
value="{{ $peminjaman->exit_at }}" required>
</div>
<label for="customer_id" class="col-form-label">Customer:<span class="text-danger">*</span></label>
<select class="form-control" name="customer_id" type="text" id="customer_id" required>
<option disabled selected>Pilih Nama Customer</option>
@foreach ($customer as $data_customer)
<option value="{{ $data_customer->id }}"
@if ($data_customer->id == $peminjaman->customer_id) selected
@else @endif>
{{ $data_customer->name }}
</option>
@endforeach
</select>
<div class="form-group">
<label for="est_pengembalian" class="col-form-label">Estimasi Tanggal Pengembalian: <span
class="text-danger">*</span></label>
<input class="form-control" name="est_pengembalian" type="date" id="est_pengembalian"
value="{{ $peminjaman->est_pengembalian }}" required>
</div>
<label for="exit_at" class="col-form-label">Tanggal Peminjaman: <span class="text-danger">*</span></label>
<input class="form-control" name="exit_at" type="date" id="exit_at" value="{{ $peminjaman->exit_at }}"
required>
<label for="est_pengembalian" class="col-form-label">Estimasi Tanggal Pengembalian: <span
class="text-danger">*</span></label>
<input class="form-control" name="est_pengembalian" type="date" id="est_pengembalian"
value="{{ $peminjaman->est_pengembalian }}" required>
<label for="warehouse_id" class="col-form-label">Asal Gudang:</label>
<select class="form-control" name="warehouse_id" type="text" id="warehouse_id" required>
<option disabled selected>Pilih Asal Gudang</option>
@foreach ($warehouse as $data)
<option value="{{ $data->id }}" @if ($data->id == $peminjaman->warehouse_id) selected @else @endif>
{{ $data->name }}</option>
@endforeach
</select>
<label for="exit_warehouse" class="col-form-label">Tujuan Gudang: <span class="text-danger">*</span></label>
<select class="form-control" name="exit_warehouse" type="text" id="exit_warehouse" required>
<option disabled selected>Pilih Tujuan Gudang</option>
@foreach ($warehouse as $data)
<option value="{{ $data->id }}" @if ($data->id == $peminjaman->exit_warehouse) selected @else @endif>
{{ $data->name }}</option>
@endforeach
</select>
<div class="form-group">
<label for="exit_warehouse" class="col-form-label">Asal Gudang: <span
class="text-danger">*</span></label>
<select class="form-control" name="exit_warehouse" id="exit_warehouse" required>
<option disabled selected>Pilih Asal Gudang</option>
@foreach ($warehouse as $data)
<option value="{{ $data->id }}"
{{ $data->id == $peminjaman->exit_warehouse ? 'selected' : '' }}>
{{ $data->name }}
</option>
@endforeach
</select>
</div>
<div class="modal-footer">
<a href="{{ route('dashboard.peminjaman.index') }}" class="btn btn-secondary">Kembali</a>
<button type="submit" class="btn btn-primary" id="submitButton">Simpan</button>

2
resources/views/dashboard/Peminjaman/index.blade.php

@ -36,7 +36,7 @@
<th>Kode</th>
<th>Tgl Peminjaman</th>
<th>PJ Peminjaman</th>
<th>WH Peminjam</th>
<th>Tujuan WH Peminjam</th>
<th class="text-center">Action</th>
</tr>
</thead>

2
resources/views/dashboard/Pengembalian/edit.blade.php

@ -49,7 +49,7 @@
<option disabled selected>Pilih Tujuan Gudang</option>
@foreach ($warehouse as $data_warehouse)
<option value="{{ $data_warehouse->id }}"
@if ($data_warehouse->id == $peminjaman->enter_warehouse) selected
@if ($data_warehouse->id == $peminjaman->warehouse_id) selected
@else @endif>
{{ $data_warehouse->name }}</option>
@endforeach

4
routes/web.php

@ -198,16 +198,16 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
//halaman Report Peti
Route::controller(PetternLotPetiController::class)->group(function () {
Route::get('Pettern_Lot_Peti/export', 'export')->name('Pettern_Lot_Peti.export');
Route::get('Pettern_Lot_Peti', 'index')->name('Pettern_Lot_Peti.index');
Route::get('Pettern_Lot_Peti/{id}', 'show')->name('Pettern_Lot_Peti.show');
Route::get('Pettern_Lot_Peti/export', 'export')->name('Pettern_Lot_Peti.export');
});
//halaman Report Stok
Route::controller(StokOpNameController::class)->group(function () {
Route::get('StokOpname', 'index')->name('StokOpname.index');
// Route::get('StokOpname/{id}', 'show')->name('StokOpname.show');
// Route::get('StokOpname/export', 'export')->name('StokOpname.export');
Route::get('StokOpname/export', 'export')->name('StokOpname.export');
});
});

Loading…
Cancel
Save