added generate reports

This commit is contained in:
Jagad R R
2025-01-08 15:01:42 +07:00
parent 314fefd52d
commit 4d9a17cfbd
3 changed files with 550 additions and 115 deletions
@@ -26,7 +26,7 @@
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12 mt-5">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title float-left">{{ $pageInfo['title'] }}</h4>
@@ -1,7 +1,7 @@
@extends('layouts.app')
@section('title')
Dashboard
{{ $pageInfo['title'] }}
@endsection
@section('admin-content')
@@ -9,119 +9,401 @@
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>Active Budgets</h1>
<h1>{{ $pageInfo['title'] }}</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
</li>
<li class="breadcrumb-form"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a> / </li>
<li class="breadcrumb-form active">&nbsp;{{ $pageInfo['title'] }}</li>
</ol>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 col-6">
<div class="small-box bg-info">
<div class="inner">
<h3>Rp {{ number_format(2000000, 0, ',', '.') }}</h3>
<p>Total Budget Bulan Ini</p>
</div>
<div class="icon">
<i class="fas fa-wallet"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-6">
<div class="small-box bg-success">
<div class="inner">
<h3>Rp {{ number_format(2000000, 0, ',', '.') }}</h3>
<p>Total Budget Tersedia</p>
</div>
<div class="icon">
<i class="fas fa-check-circle"></i>
</div>
</div>
</div>
<div class="col-lg-4 col-6">
<div class="small-box bg-danger">
<div class="inner">
<h3 class="text-white">Rp {{ number_format(2000000, 0, ',', '.') }}</h3>
<p class="text-white">Total Budget Terpakai</p>
</div>
<div class="icon">
<i class="fas fa-times"></i>
<div class="row mt-4">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<form action="{{ route('reports') }}" method="GET">
<div class="d-flex">
<div class="col-md-3">
<div class="form-group mb-3">
<label for="cabang">Pilih Cabang</label>
<select name="cabang" id="cabang" class="form-control">
<option value="">Semua Cabang</option>
@foreach ($cabang as $cabang)
<option value="{{ $cabang->code }}" {{ request()->cabang == $cabang->code ? 'selected' : '' }}>
{{ $cabang->name }}
</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group mb-3">
<label for="status">Start Date</label>
<input type="date" name="start_date" class="form-control" value="{{ request()->start_date }}">
</div>
</div>
<div class="col-md-3">
<div class="form-group mb-3">
<label for="status">End Date</label>
<input type="date" name="end_date" class="form-control" value="{{ request()->end_date }}">
</div>
</div>
<div class="col-md-3">
<div class="form-group mb-3">
<label for="status">Status</label>
<select name="status" id="status" class="form-control">
<option value="">Semua Status</option>
<option value="On Progress" {{ request()->status == 'On Progress' ? 'selected' : '' }}>On Progress</option>
<option value="Approved" {{ request()->status == 'Approved' ? 'selected' : '' }}>Approved</option>
<option value="Closed" {{ request()->status == 'Closed' ? 'selected' : '' }}>Closed</option>
<option value="Rejected" {{ request()->status == 'Rejected' ? 'selected' : '' }}>Rejected</option>
</select>
</div>
</div>
</div>
<div class="col-md-3">
{{-- submit button --}}
<div class="form-group">
<button type="submit" class="btn btn-primary">Filter</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</section>
@php
use App\Helpers\NextCloudHelper;
@endphp
<section class="content">
<div class="container-fluid">
<div class="card card-primary card-outline">
<div class="card-body">
<h4 class="header-title float-left">Current Active Budget</h4>
<div class="clearfix"></div>
<div class="dataTables_wrapper dt-bootstrap4 mt-2">
@include('backend.layouts.partials.messages')
<div class="table-responsive">
<table id="dataTable"
class="table table-bordered table-striped table-head-fixed dataTable dtr-inline"
style="width:100%">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Penerima</th>
<th>Cabang</th>
<th>Pengirim</th>
<th>Total</th>
<th>Keterangan</th>
<th>Periode</th>
<th>Tanggal Closing</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($data as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->receiver->name }}</td>
<td>{{ $item->cabang->name }}</td>
<td>{{ $item->sender->name }}</td>
<td>{{ number_format($item->amount, 0, ',', '.') }}</td>
<td>{{ $item->remarks }}</td>
<td>{{ strtoupper($item->periode_month) }} {{ $item->periode_year }}</td>
<td>{{ \Carbon\Carbon::parse($item->closing_at)->locale('id')->isoFormat('D MMMM Y H:mm') }}</td>
<td>
@if ($item->status == 'Unassigned')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Assigned')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
<td>
@if (auth()->user()->can('budget_control.delete'))
<form action="{{ route('budget_control.destroy', $item->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this item?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- Form Up Country Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Up Country</h4>
<div class="data-tables">
@include('backend.layouts.partials.messages')
<div class="table-responsive">
<table id="dataTable-form_up_country">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>No Expense</th>
<th>Nama</th>
<th>Cabang</th>
<th>Rayon</th>
<th>Tanggal</th>
<th>Tujuan</th>
<th>Jarak</th>
<th>Total</th>
<th>Total Approved</th>
<th>Account Number</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_up_country'] as $index => $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->expense_number }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ $item->user->cabang->cabang->name }}</td>
<td>{{ $item->rayon->code }}</td>
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $item->tujuan }}</td>
<td>{{ $item->jarak }} km</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>
@if ($item->approved_total)
{{ number_format($item->approved_total, 0, ',', '.') }}
@else
-
@endif
</td>
<td>{{ $item->account_number }}</td>
<td>
@if ($item->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Form Vehicle Running Cost Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Vehicle Running Cost</h4>
<div class="data-tables">
<div class="table-responsive">
<table id="dataTable-form_vehicle_running_cost">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Cabang</th>
<th>Tanggal</th>
<th>Liter</th>
<th>Total</th>
<th>Total Approved</th>
<th>Jarak</th>
<th>Tipe Bensin</th>
<th>Nomor Polisi</th>
<th>Bukti</th>
<th>Account Number</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_vehicle_running_cost'] as $index => $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ $item->user->cabang->cabang->name }}</td>
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('dddd, D MMMM Y HH:mm:ss') }}</td>
<td>{{ $item->liter }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
<td>{{ $item->jarak }} km</td>
<td>{{ $item->tipe_bensin }}</td>
<td>{{ $item->nopol }}</td>
<td>
@if ($item->bukti_total)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $item->account_number }}</td>
<td>
@if ($item->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Form Entertainment Presentation Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Entertainment Presentation</h4>
<div class="data-tables">
<div class="table-responsive">
<table id="dataTable-form_entertainment_presentation">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>User</th>
<th>Cabang</th>
<th>Nama Penerima</th>
<th>Tanggal</th>
<th>Jenis</th>
<th>Keterangan</th>
<th>Total</th>
<th>Total Approved</th>
<th>Bukti</th>
<th>Account Number</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_entertainment_presentation'] as $index => $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ $item->user->cabang->cabang->name }}</td>
<td>{{ $item->name }}</td>
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $item->jenis }}</td>
<td>{{ $item->keterangan }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
<td>
@if ($item->bukti_total)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $item->account_number }}</td>
<td>
@if ($item->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Form Meeting Seminar Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Meeting Seminar</h4>
<div class="data-tables">
<div class="table-responsive">
<table id="dataTable-form_meeting_seminar">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>No Expense</th>
<th>Nama</th>
<th>Cabang</th>
<th>Tanggal</th>
<th>Allowance</th>
<th>Transport Ankot</th>
<th>Hotel</th>
<th>Total</th>
<th>Total Approved</th>
<th>Account Number</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_meeting_seminar'] as $index => $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->expense_number }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ $item->user->cabang->cabang->name }}</td>
<td>{{ \Carbon\Carbon::parse($item->created_at)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ number_format($item->allowance, 0, ',', '.') }}</td>
<td>{{ number_format($item->transport_ankot, 0, ',', '.') }}</td>
<td>{{ number_format($item->hotel, 0, ',', '.') }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>{{ number_format($item->approved_total, 0, ',', '.') }}</td>
<td>{{ $item->account_number }}</td>
<td>
@if ($item->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Form Others Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<h4 class="header-title">Form Others</h4>
<div class="data-tables">
<div class="table-responsive">
<table id="dataTable-form_others">
<thead class="bg-light text-capitalize">
<tr>
<th>#</th>
<th>Nama</th>
<th>Cabang</th>
<th>Tanggal</th>
<th>Jenis</th>
<th>Keterangan</th>
<th>Total</th>
<th>Bukti Total</th>
<th>Account Number</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($forms['form_others'] as $index => $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->user->name }}</td>
<td>{{ $item->user->cabang->cabang->name }}</td>
<td>{{ \Carbon\Carbon::parse($item->tanggal)->locale('id')->isoFormat('D MMMM Y') }}</td>
<td>{{ $item->kategori->name }}</td>
<td>{{ $item->keterangan }}</td>
<td>{{ number_format($item->total, 0, ',', '.') }}</td>
<td>
@if ($item->bukti_total)
<a href="{{ NextCloudHelper::getFileUrl($item->bukti_total) }}" target="_blank">
Download
</a>
@else
-
@endif
</td>
<td>{{ $item->account_number }}</td>
<td>
@if ($item->status == 'On Progress')
<span class="badge badge-warning text-white">{{ $item->status }}</span>
@elseif ($item->status == 'Approved' || $item->status == 'Final Approved')
<span class="badge badge-success text-white">{{ $item->status }}</span>
@else
<span class="badge badge-danger text-white">{{ $item->status }}</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -130,14 +412,41 @@
@section('scripts')
<script>
$(document).ready(function () {
if ($('#dataTable').length) {
$('#dataTable').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print']
});
}
});
</script>
// Initialize DataTables for each table
if ($('#dataTable-form_up_country').length) {
$('#dataTable-form_up_country').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print', 'colvis'],
});
}
if ($('#dataTable-form_vehicle_running_cost').length) {
$('#dataTable-form_vehicle_running_cost').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print', 'colvis'],
});
}
if ($('#dataTable-form_entertainment_presentation').length) {
$('#dataTable-form_entertainment_presentation').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print', 'colvis'],
});
}
if ($('#dataTable-form_meeting_seminar').length) {
$('#dataTable-form_meeting_seminar').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print', 'colvis'],
});
}
if ($('#dataTable-form_others').length) {
$('#dataTable-form_others').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: ['excel', 'pdf', 'print', 'colvis'],
});
}
</script>
@endsection