2025-01-14 14:15:32 +07:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
|
|
@section('title')
|
|
|
|
|
{{ $pageInfo['title'] }}
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section('admin-content')
|
|
|
|
|
<section class="content-header">
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-sm-6">
|
|
|
|
|
<h1>{{ $pageInfo['title'] }}</h1>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-6">
|
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
|
|
|
|
<li class="breadcrumb-form"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a> / </li>
|
|
|
|
|
<li class="breadcrumb-form active"> {{ $pageInfo['title'] }}</li>
|
|
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row mt-4">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<ul>
|
|
|
|
|
<li><b>Cabang:</b> {{ $cabang->name }}</li>
|
|
|
|
|
<li><b>Periode:</b> {{ ucfirst($month) }} {{ $year }}</li>
|
|
|
|
|
<li><b>Cost Centre</b> {{ $cabang->cost->code }}</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
@php
|
|
|
|
|
use App\Helpers\FormHelper;
|
|
|
|
|
@endphp
|
|
|
|
|
|
|
|
|
|
<section class="content">
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<!-- All Forms Table -->
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class="data-tables">
|
|
|
|
|
@include('backend.layouts.partials.messages')
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
<table id="dataTable-table">
|
|
|
|
|
<thead class="bg-light text-capitalize">
|
|
|
|
|
<tr>
|
|
|
|
|
<th>#</th>
|
|
|
|
|
<th>Type</th>
|
|
|
|
|
<th>Account Number</th>
|
|
|
|
|
<th>Dr</th>
|
|
|
|
|
<th>Cr</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<!-- Dynamic Rows -->
|
|
|
|
|
@php
|
|
|
|
|
$totalDr = 0;
|
|
|
|
|
$totalCr = 0;
|
|
|
|
|
@endphp
|
|
|
|
|
@foreach ($kategori as $item)
|
|
|
|
|
@php
|
2025-01-15 22:29:07 +07:00
|
|
|
$drValue = $nominals[$item->id] ?? 0;
|
2025-03-05 13:44:58 +07:00
|
|
|
$drFormatted = $drValue == 0 ? '' : number_format($drValue, 0, ',', ',');
|
2025-01-14 14:15:32 +07:00
|
|
|
$totalDr += $drValue;
|
|
|
|
|
@endphp
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{ $loop->iteration }}</td>
|
|
|
|
|
<td>{{ $item->name }}</td>
|
|
|
|
|
<td>{{ $item->account_number }}</td>
|
|
|
|
|
<td>{{ $drFormatted }}</td>
|
|
|
|
|
<td></td>
|
|
|
|
|
</tr>
|
|
|
|
|
@endforeach
|
|
|
|
|
|
2025-01-15 22:29:07 +07:00
|
|
|
|
2025-01-14 14:15:32 +07:00
|
|
|
<tr>
|
|
|
|
|
<td>{{ $kategori->count() + 1 }}</td>
|
|
|
|
|
<td>Petty Cash</td>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td>
|
|
|
|
|
@php
|
|
|
|
|
$crValue = $budget && $budget->amount != 0 ? $budget->amount : 0;
|
|
|
|
|
$totalCr += $crValue;
|
2025-03-05 13:44:58 +07:00
|
|
|
echo $crValue == 0 ? '' : number_format($crValue, 0, ',', ',');
|
2025-01-14 14:15:32 +07:00
|
|
|
@endphp
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
{{-- Static Rows --}}
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{ $kategori->count() + 2 }}</td>
|
|
|
|
|
<td>Cash Advance (Opening Balance)</td>
|
|
|
|
|
<td>{{ $kategori_bca->account_number }}</td>
|
|
|
|
|
<td></td>
|
|
|
|
|
<td>
|
|
|
|
|
@php
|
|
|
|
|
$totalCr += 500000;
|
|
|
|
|
@endphp
|
2025-03-05 13:44:58 +07:00
|
|
|
{{ number_format(500000, 0, ',', ',') }}
|
2025-01-14 14:15:32 +07:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{ $kategori->count() + 3 }}</td>
|
|
|
|
|
<td>Cash Advance (Ending Balance)</td>
|
|
|
|
|
<td>{{ $kategori_bca->account_number }}</td>
|
|
|
|
|
<td>
|
|
|
|
|
@php
|
|
|
|
|
$totalDr += 500000;
|
|
|
|
|
@endphp
|
2025-03-05 13:44:58 +07:00
|
|
|
{{ number_format(500000, 0, ',', ',') }}
|
2025-01-14 14:15:32 +07:00
|
|
|
</td>
|
|
|
|
|
<td></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
<tfoot>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="3" class="text-right"><strong>Total</strong></td>
|
2025-03-05 13:44:58 +07:00
|
|
|
<td>{{ number_format($totalDr, 0, ',', ',') }}</td>
|
|
|
|
|
<td>{{ number_format($totalCr, 0, ',', ',') }}</td>
|
2025-01-14 14:15:32 +07:00
|
|
|
</tr>
|
|
|
|
|
</tfoot>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section('scripts')
|
|
|
|
|
<script>
|
2025-01-15 20:33:51 +07:00
|
|
|
if ($('#dataTable-table').length) {
|
|
|
|
|
$('#dataTable-table').DataTable({
|
|
|
|
|
responsive: false,
|
|
|
|
|
dom: 'Bfrtip',
|
2025-01-18 15:26:50 +07:00
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
extend: 'excel',
|
|
|
|
|
text: 'Export Excel',
|
2025-01-19 14:57:01 +07:00
|
|
|
customize: function (xlsx) {
|
2025-01-19 15:39:31 +07:00
|
|
|
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
2025-01-19 14:57:01 +07:00
|
|
|
|
2025-01-19 15:39:31 +07:00
|
|
|
// Add a blank row for spacing
|
|
|
|
|
var blankRow = `<row><c t="inlineStr"><is><t></t></is></c></row>`;
|
|
|
|
|
|
|
|
|
|
// Bold text using Excel XML structure
|
|
|
|
|
var additionalInfo = `
|
|
|
|
|
<row>
|
|
|
|
|
<c t="inlineStr" s="2"><is><t>Cabang: {{ $cabang->name }}</t></is></c>
|
|
|
|
|
</row>
|
|
|
|
|
<row>
|
|
|
|
|
<c t="inlineStr" s="2"><is><t>Periode: {{ ucfirst($month) }} {{ $year }}</t></is></c>
|
|
|
|
|
</row>
|
|
|
|
|
<row>
|
|
|
|
|
<c t="inlineStr" s="2"><is><t>Cost Centre: {{ $cabang->cost->code }}</t></is></c>
|
|
|
|
|
</row>
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
// Locate the sheet data and append the blank row and additional information
|
|
|
|
|
var sheetData = $(sheet).find('sheetData');
|
|
|
|
|
var existingRows = sheetData.children();
|
|
|
|
|
existingRows.last().after(blankRow + additionalInfo);
|
|
|
|
|
|
|
|
|
|
// Add bold style to the sheet
|
|
|
|
|
var styles = xlsx.xl['styles.xml'];
|
|
|
|
|
var cellXfs = $(styles).find('cellXfs');
|
|
|
|
|
cellXfs.append(`
|
|
|
|
|
<xf xfId="0" applyFont="1">
|
|
|
|
|
<alignment horizontal="left"/>
|
|
|
|
|
<font>
|
|
|
|
|
<b/>
|
|
|
|
|
<sz val="11"/>
|
|
|
|
|
<name val="Calibri"/>
|
|
|
|
|
<family val="2"/>
|
|
|
|
|
</font>
|
|
|
|
|
</xf>
|
|
|
|
|
`);
|
|
|
|
|
}
|
2025-01-18 15:26:50 +07:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'csv',
|
|
|
|
|
text: 'Export CSV',
|
|
|
|
|
customize: function (csv) {
|
|
|
|
|
// Add header information to the CSV
|
|
|
|
|
var additionalInfo = `
|
2025-01-19 14:57:01 +07:00
|
|
|
Cabang: {{ $cabang->name }}
|
|
|
|
|
Periode: {{ ucfirst($month) }} {{ $year }}
|
|
|
|
|
Cost Centre: {{ $cabang->cost->code }}
|
|
|
|
|
`;
|
2025-01-18 15:26:50 +07:00
|
|
|
return additionalInfo + csv;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'pdf',
|
|
|
|
|
text: 'Export PDF',
|
|
|
|
|
customize: function (doc) {
|
|
|
|
|
// Add additional information to the PDF
|
|
|
|
|
doc.content.splice(0, 0, {
|
|
|
|
|
margin: [0, 0, 0, 12],
|
|
|
|
|
alignment: 'left',
|
|
|
|
|
table: {
|
|
|
|
|
widths: ['*'],
|
|
|
|
|
body: [
|
|
|
|
|
[{ text: 'Cabang: {{ $cabang->name }}', style: 'header' }],
|
|
|
|
|
[{ text: 'Periode: {{ ucfirst($month) }} {{ $year }}', style: 'header' }],
|
|
|
|
|
[{ text: 'Cost Centre: {{ $cabang->cost->code }}', style: 'header' }]
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
layout: 'noBorders'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'print',
|
|
|
|
|
text: 'Print'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'colvis',
|
|
|
|
|
text: 'Column Visibility'
|
|
|
|
|
}
|
|
|
|
|
],
|
2025-01-15 20:33:51 +07:00
|
|
|
paging: false,
|
|
|
|
|
info: false,
|
|
|
|
|
pageLength: -1
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2025-01-14 14:15:32 +07:00
|
|
|
@endsection
|