Initial commit - expense
Deploy to VPS (PAT over HTTPS) / deploy (push) Has been cancelled

This commit is contained in:
root
2026-06-01 15:01:03 +07:00
parent 9e9fab4a3f
commit 1c1418f3e0
123 changed files with 18622 additions and 10376 deletions
@@ -5,272 +5,272 @@
@endsection
@section('admin-content')
<section class="content-header">
<div class="container-fluid">
<div class="row">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-3">
<div class="col-sm-6">
<h1>{{ $pageInfo['title'] }}</h1>
<h1 class="fw-bold">{{ $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">&nbsp;{{ $pageInfo['title'] }}</li>
<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item 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
<div class="row mt-4">
<div class="col-12">
<div class="card shadow-sm" style="border-radius: 15px;">
<div class="card-body">
<div class="row">
<div class="col-md-8">
<ul class="list-unstyled">
<li><b>Cabang:</b> {{ $cabang->name }}</li>
<li>
<b>Periode:</b> {{ ucfirst($month) }} {{ $year }}
<span class="ml-4"><b>Periode Accounting:</b> {{ request()->accounting_period ?? '-' }}</span>
</li>
<li><b>Cost Centre:</b> {{ $cabang->cost->code }}</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@php
/**
* PEMBARUAN LOGIKA:
* 1. Building Maintenance Dihapus
* 2. Presentation Ditambahkan di urutan ke-7
* 3. Account Number disesuaikan dengan image_01e273.png
*/
$configJurnal = [
['name' => 'Telp./ Fax / Email', 'account' => '800 104 00'],
['name' => 'Listrik', 'account' => '800 105 00'],
['name' => 'Postages / Courier', 'account' => '800 107 00'],
['name' => 'Office Supplies / Bank Changes / Interest', 'account' => '800 108 00'],
['name' => 'Relokasi', 'account' => '800 111 00'],
['name' => 'Meeting / Seminar', 'account' => '800 201 00'],
['name' => 'Presentation', 'account' => '800 304 00'], // Urutan ke-7
['name' => 'Up Country', 'account' => '800 305 00'],
['name' => 'Vehicle Running Cost', 'account' => '800 306 00'],
['name' => 'Field Force', 'account' => '800 308 00'],
['name' => 'Entertainment', 'account' => '800 309 00'],
['name' => 'Rumah Tangga', 'account' => '800 213 00'],
];
$totalDr = 0;
$totalCr = 0;
$counter = 1;
// Mencari ID Kategori berdasarkan nama untuk mengambil nilai dari array $nominals
$kategoriCollection = collect($kategori);
@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
$drValue = $nominals[$item->id] ?? 0;
$drFormatted = $drValue == 0 ? '' : number_format($drValue, 0, ',', ',');
$totalDr += $drValue;
@endphp
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card shadow-sm" style="border-radius: 15px;">
<div class="card-body">
<div class="table-responsive">
@include('backend.layouts.partials.messages')
<table id="dataTable-table" class="table table-hover w-100">
<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>
{{-- 1 - 12: Loop berdasarkan config yang sudah diurutkan --}}
@foreach ($configJurnal as $conf)
@php
// Ambil objek kategori dari database yang namanya cocok
$katObj = $kategoriCollection->where('name', $conf['name'])->first();
$drValue = $katObj ? ($nominals[$katObj->id] ?? 0) : 0;
$totalDr += $drValue;
@endphp
<tr>
<td>{{ $counter++ }}</td>
<td>{{ $conf['name'] }}</td>
<td>{{ $conf['account'] }}</td>
<td class="text-right">{{ $drValue == 0 ? '' : number_format($drValue, 0, ',', '.') }}</td>
<td></td>
</tr>
@endforeach
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->name }}</td>
<td>{{ $item->account_number }}</td>
<td>{{ $drFormatted }}</td>
<td></td>
</tr>
{{-- 13: Cash in Bank BCA --}}
@php
$cashInBankValue = $pettyCashAmount - $totalKategori;
@endphp
<tr>
<td>{{ $counter++ }}</td>
<td>Cash in Bank BCA</td>
<td>170 600 00</td>
@if ($cashInBankValue >= 0)
@php $totalDr += $cashInBankValue; @endphp
<td class="text-right">{{ $cashInBankValue == 0 ? '' : number_format($cashInBankValue, 0, ',', '.') }}</td>
<td></td>
@else
@php $totalCr += abs($cashInBankValue); @endphp
<td></td>
<td class="text-right">{{ number_format(abs($cashInBankValue), 0, ',', '.') }}</td>
@endif
</tr>
@endforeach
{{-- 14: Petty Cash --}}
<tr>
<td>{{ $counter++ }}</td>
<td>Petty Cash</td>
<td></td>
<td></td>
<td class="text-right">
@php $totalCr += $pettyCashAmount; @endphp
{{ $pettyCashAmount == 0 ? '' : number_format($pettyCashAmount, 0, ',', '.') }}
</td>
</tr>
<!-- Cash in Bank BCA -->
@php
$cashInBankValue = $pettyCashAmount - $totalKategori;
$rowIndex = $kategori->count() + 1;
@endphp
<tr>
<td>{{ $rowIndex }}</td>
<td>Cash in Bank BCA</td>
<td>{{ $kategori_bca->account_number }}</td>
@if ($cashInBankValue >= 0)
@php
$totalDr += $cashInBankValue;
@endphp
<td>{{ $cashInBankValue == 0 ? '' : number_format($cashInBankValue, 0, ',', ',') }}</td>
<td></td>
@else
@php
$totalCr += abs($cashInBankValue);
@endphp
<td></td>
<td>{{ number_format(abs($cashInBankValue), 0, ',', ',') }}</td>
@endif
</tr>
{{-- 15: Cash Advance (Opening) --}}
<tr>
<td>{{ $counter++ }}</td>
<td>Cash Advance (Opening Balance)</td>
<td>170 600 00</td>
<td></td>
<td class="text-right">
@php $totalCr += 500000; @endphp
{{ number_format(500000, 0, ',', '.') }}
</td>
</tr>
<!-- petty cash -->
<tr>
<td>{{ $rowIndex + 1 }}</td>
<td>Petty Cash</td>
<td></td>
<td></td>
<td>
@php
$totalCr += $pettyCashAmount;
echo $pettyCashAmount == 0 ? '' : number_format($pettyCashAmount, 0, ',', ',');
@endphp
</td>
</tr>
{{-- Static Rows --}}
<tr>
<td>{{ $rowIndex + 2 }}</td>
<td>Cash Advance (Opening Balance)</td>
<td>{{ $kategori_bca->account_number }}</td>
<td></td>
<td>
@php
$totalCr += 500000;
@endphp
{{ number_format(500000, 0, ',', ',') }}
</td>
</tr>
<tr>
<td>{{ $rowIndex + 3 }}</td>
<td>Cash Advance (Ending Balance)</td>
<td>{{ $kategori_bca->account_number }}</td>
<td>
@php
$totalDr += 500000;
@endphp
{{ number_format(500000, 0, ',', ',') }}
</td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3" class="text-right"><strong>Total</strong></td>
<td>{{ number_format($totalDr, 0, ',', '.') }}</td>
<td>{{ number_format($totalCr, 0, ',', '.') }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{{-- 16: Cash Advance (Ending) --}}
<tr>
<td>{{ $counter++ }}</td>
<td>Cash Advance (Ending Balance)</td>
<td>170 600 00</td>
<td class="text-right">
@php $totalDr += 500000; @endphp
{{ number_format(500000, 0, ',', '.') }}
</td>
<td></td>
</tr>
</tbody>
<tfoot class="bg-light">
<tr>
<td colspan="3" class="text-right"><strong>Total</strong></td>
<td class="text-right"><strong>{{ number_format($totalDr, 0, ',', '.') }}</strong></td>
<td class="text-right"><strong>{{ number_format($totalCr, 0, ',', '.') }}</strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
@endsection
@section('scripts')
<script>
if ($('#dataTable-table').length) {
$('#dataTable-table').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: [
{
extend: 'excel',
text: 'Export Excel',
customize: function (xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var styles = xlsx.xl['styles.xml'];
var cellXfs = $(styles).find('cellXfs');
// Add number format style for thousands separator
var numFmtId = 3; // Built-in ID for thousands separator
var xfCount = cellXfs.children().length;
cellXfs.append(`
<xf numFmtId="${numFmtId}" xfId="0" applyNumberFormat="1">
<alignment horizontal="right"/>
</xf>
`);
var xfIndex = xfCount; // Index of the new style
// Add additional info and blank row
var sheetData = $(sheet).find('sheetData');
var existingRows = sheetData.children();
existingRows.last().after(`
<row><c t="inlineStr"><is><t></t></is></c></row>
<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>
`);
// Update total row with number formatting
var totalRow = sheetData.find("row:last");
var totalDr = {{ $totalDr }};
var totalCr = {{ $totalCr }};
totalRow.find("c:nth-child(4)").attr({
't': 'n', // Set type to number
's': xfIndex // Apply the thousands separator style
}).html('<v>' + totalDr + '</v>');
totalRow.find("c:nth-child(5)").attr({
't': 'n',
's': xfIndex
}).html('<v>' + totalCr + '</v>');
},
},
{
extend: 'csv',
text: 'Export CSV',
customize: function (csv) {
// Add header information to the CSV
var additionalInfo = `
Cabang: {{ $cabang->name }}
Periode: {{ ucfirst($month) }} {{ $year }}
Cost Centre: {{ $cabang->cost->code }}
`;
return additionalInfo + csv;
$(document).ready(function() {
if ($('#dataTable-table').length) {
$('#dataTable-table').DataTable({
responsive: false,
dom: 'Blfrtip',
paging: false,
info: false,
buttons: [
{
extend: 'excelHtml5',
text: '<i class="fas fa-file-excel mr-1"></i> Export Excel',
className: 'btn-success',
title: 'Generate Reports For Jurnal',
exportOptions: {
columns: [0, 1, 2, 3, 4],
format: {
body: function (data, row, column, node) {
// Bersihkan titik ribuan agar jadi angka murni di Excel
if (column === 3 || column === 4) {
return data ? data.replace(/[.]/g, '') : '';
}
return data;
}
}
},
{
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'
});
customize: function (xlsx) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var numrows = 5; // Jumlah baris yang akan ditambahkan di atas
var clRow = $('row', sheet);
// Update index baris yang sudah ada
clRow.each(function () {
var attr = $(this).attr('r');
var ind = parseInt(attr);
$(this).attr('r', ind + numrows);
});
// Update referensi cell (A1 -> A6, dsb)
$('row c', sheet).each(function () {
var attr = $(this).attr('r');
var pre = attr.substring(0, 1);
var ind = parseInt(attr.substring(1));
$(this).attr('r', pre + (ind + numrows));
});
// Fungsi untuk membuat baris XML baru
function createRow(index, value) {
return '<row r="' + index + '"><c r="A' + index + '" t="inlineStr"><is><t>' + value + '</t></is></c></row>';
}
},
{
extend: 'print',
text: 'Print'
},
{
extend: 'colvis',
text: 'Column Visibility'
// Tambahkan data informasi di baris atas
var r1 = createRow(1, 'Cabang: {{ $cabang->name }}');
var r2 = createRow(2, 'Periode: {{ ucfirst($month) }} {{ $year }}');
var r3 = createRow(3, 'Periode Accounting: {{ request()->accounting_period ?? "-" }}');
var r4 = createRow(4, 'Cost Centre: {{ $cabang->cost->code }}');
var r5 = createRow(5, ''); // Baris kosong sebagai pemisah
var sheetData = $(sheet).find('sheetData');
sheetData.prepend(r1 + r2 + r3 + r4 + r5);
}
],
paging: false,
info: false,
pageLength: -1
});
}
},
{
extend: 'pdfHtml5',
text: '<i class="fas fa-file-pdf mr-1"></i> Export PDF',
className: 'btn-danger',
orientation: 'landscape',
pageSize: 'A4',
title: 'Generate Reports For Jurnal',
exportOptions: { columns: [0, 1, 2, 3, 4] },
customize: function (doc) {
// Menambahkan metadata di atas tabel PDF
doc.content.splice(0, 0, {
margin: [0, 0, 0, 12],
alignment: 'left',
text: [
{ text: 'Cabang: {{ $cabang->name }}\n', bold: true },
{ text: 'Periode: {{ ucfirst($month) }} {{ $year }}\n' },
{ text: 'Periode Accounting: {{ request()->accounting_period ?? "-" }}\n' },
{ text: 'Cost Centre: {{ $cabang->cost->code }}\n' }
]
});
}
},
{ extend: 'print', text: 'Print', className: 'btn-dark' },
'colvis'
]
});
}
});
</script>
@endsection
@endsection