Merged in izzati-feat-laporan-baki-lelong (pull request #103)

tambah laporan baki lelong belum tuntut
This commit is contained in:
izzati zulkifli
2025-06-11 04:32:01 +00:00
10 changed files with 1376 additions and 0 deletions
@@ -0,0 +1,79 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
class BakiLelongBelumTuntutExport implements WithMultipleSheets
{
public $cawangan_detail;
public $query;
public $lelongan;
public $summary_lelongan;
protected $lelongan_full_data;
public function __construct($data)
{
$this->cawangan_detail = $data['cawangan_detail'];
$this->query = $data['query'];
$this->lelongan = $data['lelongan'];
$this->summary_lelongan = $data['summary_lelongan'];
}
public function sheets(): array
{
$sheets = [];
// Sheet summary (group by teller)
$data = $this->lelongan;
$teller_with_lelongan_summary_data = array_reduce(array_keys($data), function ($accumulator, $key) use ($data) {
$accumulator[] = [
'teller' => $key,
'summary_lelongan_teller' => $data[$key]['summary_lelongan_teller'],
];
return $accumulator;
}, []);
$sheets[] = new BakiLelongSummaryExport(
$this->cawangan_detail,
$this->query,
$teller_with_lelongan_summary_data,
$this->summary_lelongan
);
// Sheet untuk setiap teller
foreach ($this->lelongan as $teller => $data) {
$teller_with_lelongan_data = [
'teller' => $teller,
'data' => $data,
];
$sheets[] = new BakiLelongPerTellerExport(
$this->cawangan_detail,
$this->query,
$teller_with_lelongan_data
);
}
// Sheet untuk senarai penuh lelongan (gabung semua teller)
$full_lelongan_data = [];
foreach ($this->lelongan as $teller => $data) {
if (isset($data['lelongan']) && is_array($data['lelongan'])) {
foreach ($data['lelongan'] as $item) {
$item['teller'] = $teller; // optional: simpan info teller
$full_lelongan_data[] = $item;
}
}
}
$sheets[] = new BakiLelongFullExport(
$this->cawangan_detail,
$this->query,
$full_lelongan_data
);
return $sheets;
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class BakiLelongFullExport implements FromView, ShouldAutoSize, WithTitle, WithColumnFormatting
{
protected $cawangan_detail;
protected $query;
protected $lelongan_full_data;
public function __construct($cawangan_detail, $query, $lelongan_full_data)
{
$this->cawangan_detail = $cawangan_detail;
$this->query = $query;
$this->lelongan_full_data = $lelongan_full_data;
}
public function view(): View
{
return view('exports.bakilelong.full', [
'cawangan_detail' => $this->cawangan_detail,
'query' => $this->query,
'lelongan_data' => $this->lelongan_full_data,
]);
}
public function title(): string
{
return 'SENARAI LELONGAN PENUH';
}
public function columnFormats(): array
{
return [
'E' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, // Berat
'F' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, // Nilai Marhun
'G' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, // Pinjaman
'H' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, // Keuntungan
'I' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, // caj lelong
'J' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, // baki
];
}
}
+122
View File
@@ -0,0 +1,122 @@
<?php
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithColumnWidths;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use Maatwebsite\Excel\Concerns\WithTitle;
class BakiLelongPerTellerExport extends DefaultValueBinder implements FromView, ShouldAutoSize, WithCustomValueBinder, WithColumnWidths, WithEvents, WithColumnFormatting, WithTitle
{
public $cawangan_detail;
public $query;
public $teller_with_lelongan_data;
public function __construct($cawangan_detail, $query, $teller_with_lelongan_data)
{
$this->cawangan_detail = $cawangan_detail;
$this->query = $query;
$this->teller_with_lelongan_data = $teller_with_lelongan_data;
}
public function title(): string
{
return sprintf("TELLER %s", $this->teller_with_lelongan_data['teller']);
}
public function bindValue(Cell $cell, $value)
{
if (is_numeric($value)) {
$cell->setValueExplicit($value, DataType::TYPE_NUMERIC);
return true;
}
// else return default behavior
return parent::bindValue($cell, $value);
}
public function columnWidths(): array
{
return [
'A' => 20.5,
'B' => 42,
'C' => 14.18,
'D' => 14.18,
'E' => 9.19,
'F' => 27.5,
];
}
public function columnFormats(): array
{
return [
'E' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'F' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'G' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'H' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'I' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'J' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'K' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'L' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
];
}
public function registerEvents(): array
{
$table_style = [
'borders' => [
'allBorders' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '#000000'],
],
],
];
$main_table_row_count = count($this->teller_with_lelongan_data) + 1;
$main_table_start_at_row = 9;
$main_table_range = 'A' . $main_table_start_at_row . ':J' . ($main_table_row_count + $main_table_start_at_row);
$summary_table_row_count = 1;
$summary_table_start_at_row = $main_table_row_count + $main_table_start_at_row + 5;
$summary_table_range = 'A' . $summary_table_start_at_row . ':I' . ($summary_table_row_count + $summary_table_start_at_row);
$summary_table_column_head = 'A' . $summary_table_start_at_row . ':F' . $summary_table_start_at_row;
// return [
// AfterSheet::class => function (AfterSheet $event) use ($main_table_range, $summary_table_range, $summary_table_column_head, $table_style) {
// $event->sheet->getStyle($main_table_range)->applyFromArray($table_style);
// $event->sheet->getStyle($summary_table_range)->applyFromArray($table_style);
// $event->sheet->mergeCells($summary_table_column_head);
// },
// ];
return [];
}
public function view(): View
{
return view('exports.bakilelong.cawangan', [
'cawangan_detail' => $this->cawangan_detail,
'query' => $this->query,
'teller_with_lelongan_data' => $this->teller_with_lelongan_data,
]);
}
}
+134
View File
@@ -0,0 +1,134 @@
<?php
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithColumnWidths;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use Maatwebsite\Excel\Concerns\WithEvents;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use Maatwebsite\Excel\Concerns\WithTitle;
class BakiLelongSummaryExport extends DefaultValueBinder implements FromView, ShouldAutoSize, WithCustomValueBinder, WithColumnWidths, WithEvents, WithColumnFormatting, WithTitle
{
public $cawangan_detail;
public $query;
public $teller_with_lelongan_summary_data;
public $summary_lelongan;
public $isByTeller;
public function __construct($cawangan_detail, $query, $teller_with_lelongan_data, $summary_lelongan, $isByTeller = true)
{
$this->cawangan_detail = $cawangan_detail;
$this->query = $query;
$this->teller_with_lelongan_summary_data = $teller_with_lelongan_data;
$this->summary_lelongan = $summary_lelongan;
$this->isByTeller = $isByTeller;
}
public function title(): string
{
return 'SUMMARY LELONGAN';
}
public function bindValue(Cell $cell, $value)
{
if (is_numeric($value)) {
$cell->setValueExplicit($value, DataType::TYPE_NUMERIC);
return true;
}
// else return default behavior
return parent::bindValue($cell, $value);
}
public function columnWidths(): array
{
return [
'A' => 28,
'B' => 14.67,
'C' => 16.00,
'D' => 14.18,
];
}
public function columnFormats(): array
{
return [
'E' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'F' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'G' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'H' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'I' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'J' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'C' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
'D' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
];
}
public function registerEvents(): array
{
$table_style = [
'borders' => [
'allBorders' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['argb' => '#000000'],
],
],
];
$main_table_row_count = count($this->teller_with_lelongan_summary_data) + 1;
$main_table_start_at_row = 9;
$main_table_range = 'A' . $main_table_start_at_row . ':J' . ($main_table_row_count + $main_table_start_at_row);
$summary_table_row_count = 1;
$summary_table_start_at_row = $main_table_row_count + $main_table_start_at_row + 5;
$summary_table_range = 'A' . $summary_table_start_at_row . ':I' . ($summary_table_row_count + $summary_table_start_at_row);
$summary_table_column_head = 'A' . $summary_table_start_at_row . ':F' . $summary_table_start_at_row;
return [];
}
public function view(): View
{
$data = $this->teller_with_lelongan_summary_data;
if (!$this->isByTeller) {
// Gabung semua teller jadi 1 baris jumlah
$total = [
'jumlah_lelongan' => 0,
'jumlah_harga' => 0,
'jumlah_baki' => 0,
// ... fields lain
];
foreach ($data as $row) {
$total['jumlah_lelongan'] += $row['jumlah_lelongan'];
$total['jumlah_harga'] += $row['jumlah_harga'];
$total['jumlah_baki'] += $row['jumlah_baki'];
// ... jumlahkan field lain
}
$data = [$total]; // Gantikan data kepada 1 baris gabungan
}
return view('exports.bakilelong.summary', [
'cawangan_detail' => $this->cawangan_detail,
'query' => $this->query,
'teller_with_lelongan_data' => $data,
'summary_lelongan' => $this->summary_lelongan,
]);
}
}
@@ -0,0 +1,132 @@
<?php
namespace App\Http\Controllers\Reports;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Http;
use App\Exports\BakiLelongBelumTuntutExport;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Support\Facades\Auth;
use App\Exports\LaporanKeseluruhan\BakiLelongAllExportExcel;
class BakiLelongController extends Controller
{
public function index(Request $request)
{
$current = new Carbon();
$request->hostname = config('api.url');
$kod_cawangan = $request->kod_cawangan;
$action = $request->input('action', 'search');
$getReportDate = function ($date_string) use ($current) {
if ($date_string == null) {
return $current->toDateString();
}
return $date_string;
};
$request->hostname = config('api.url');
$lelongan = Http::get($request->hostname . '/api/reports/bakilelongbelumtuntut', [
'startDate' => $getReportDate($request->startDate),
'endDate' => $getReportDate($request->endDate),
])->json();
$startDate = $getReportDate($request->startDate);
$endDate = $getReportDate($request->endDate);
if ($action === 'excel') {
$file_title = sprintf("LaporanBakiLelongBelumTuntut %s (%s - %s).xlsx", $kod_cawangan, $request->startDate, $request->endDate);
return Excel::download(new BakiLelongBelumTuntutAllExportExcel($data), $file_title);
}
return view('reports.bakilelongbelumtuntut.index', compact('lelongan', 'startDate', 'endDate'));
}
public function show(Request $request)
{
$current = Carbon::now();
$action = $request->input('action', 'search');
$getReportDate = function ($date_string) use ($current) {
return $date_string ? $date_string : $current->toDateString();
};
$hostname = config('api.url');
$response = Http::get("$hostname/api/reports/bakilelongbelumtuntut", [
'startDate' => $getReportDate($request->startDate),
'endDate' => $getReportDate($request->endDate),
]);
$lelongan = $response->json() ?? []; // Ensure it's an array
// Debugging: Check the response before using it
if (empty($lelongan)) {
return back()->with('error', 'Failed to fetch data from API.');
}
$startDate = $getReportDate($request->startDate);
$endDate = $getReportDate($request->endDate);
if ($action === 'excel') {
// Ensure $kod_cawangan is defined (Modify as per your data structure)
$kod_cawangan = $request->input('kod_cawangan', 'DEFAULT');
$file_title = sprintf("LaporanBakiLelongan %s (%s - %s).xlsx", $kod_cawangan, $startDate, $endDate);
return Excel::download(new BakiLelonganAllExportExcel($lelongan), $file_title);
}
return view('reports.bakilelongbelumtuntut.index', compact('lelongan', 'startDate', 'endDate'));
}
public function downloadBakiLelongBelumTuntutCawanganExcel(Request $request)
{
$api_url = $request->hostname;
$auth_user = Auth::user();
$current = Carbon::now();
$current = new Carbon();
$tarikh_cetak = $current->toDateString();
$getReportDate = function ($date_string) use ($current) {
if ($date_string == null) {
return $current->toDateString();
}
return $date_string;
};
$request->hostname = config('api.url');
$kod_cawangan = $request->kod_cawangan;
// dd($kod_cawangan);
$data = Http::get($request->hostname . '/api/reports/bakilelongbelumtuntut/' . $kod_cawangan, [
'startDate' => $getReportDate($request->startDate),
'endDate' => $getReportDate($request->endDate),
])->json();
$byTeller = $request->input('by_teller', 1); // default ikut teller
if (!$byTeller) {
// Gabung semua data jadi satu baris
$gabung = [
'teller' => 'Keseluruhan',
'jumlah_lelongan' => 0,
'jumlah_baki' => 0,
];
foreach ($data as $item) {
$gabung['jumlah_lelongan'] += $item['jumlah_lelongan'] ?? 0;
$gabung['jumlah_baki'] += $item['jumlah_baki'] ?? 0;
}
$data = [$gabung];
}
$file_title = sprintf("LaporanBakiLelongBelumTuntutCawangan %s (%s - %s).xlsx", $kod_cawangan, $request->startDate, $request->endDate);
return Excel::download(new BakiLelongBelumTuntutExport($data), $file_title);
}
}
@@ -0,0 +1,95 @@
<table>
<tr>
<td>{{ $cawangan_detail['nama'] }}</td>
</tr>
<tr>
<td>{{ $cawangan_detail['code'] }}</td>
</tr>
<tr>
<td>{{ $cawangan_detail['alamat'] }}</td>
</tr>
<tr>
<td>{{ $cawangan_detail['waktu_operasi'] }}</td>
</tr>
</table>
<table>
<tr>
<td colspan="2">
<strong>LAPORAN BAKI LELONG BELUM TUNTUT</strong>
</td>
</tr>
<tr>
<td>
TARIKH DARI {{ $query['startDate'] }} hingga {{ $query['endDate'] }}
</td>
</tr>
</table>
<table>
<td colspan="2">
<strong>TELLER : {{ $teller_with_lelongan_data['teller'] }}</strong>
</td>
</table>
<table>
<thead>
<tr>
<th>No rujukan</th>
<th>Nama</th>
<!-- <th>Alamat</th> -->
<th>No KP</th>
<!-- <th>Masa</th> -->
<th>Marhun</th>
<th>Berat</th>
<th>Nilai Marhun (RM)</th>
<th>Pembiayaan (RM)</th>
<th>%</th>
<th>Baki Pembiayaan (RM)</th>
<th>Keuntungan (RM)</th>
<th>Caj Lelong (RM)</th>
<th>Harga Jual (RM)</th>
<th>Baki(RM)</th>
</tr>
</thead>
<tbody>
@foreach ($teller_with_lelongan_data['data']['lelongan'] as $lelongan_detail)
<tr>
<td>{{ $lelongan_detail['no_rujukan'] }}</td>
<td>{{ $lelongan_detail['nama'] }}</td>
<!-- <td>{{ $lelongan_detail['alamat'] }}</td> -->
<td>'{{ $lelongan_detail['no_kp'] }}</td>
<!-- <td>{{ $lelongan_detail['masa'] }}</td> -->
<td>{{ $lelongan_detail['marhun'] }}</td>
<td>{{ $lelongan_detail['berat'] }}</td>
<td>{{ $lelongan_detail['nilai_marhun'] }}</td>
<td>{{ $lelongan_detail['pinjaman'] }}</td>
<td>{{ $lelongan_detail['peratusan_margin_pinjaman'] }}</td>
<td>{{ $lelongan_detail['bakipjm'] }}</td>
<td>{{ $lelongan_detail['keuntungan'] }}</td>
<td>{{ $lelongan_detail['cajlelong'] }}</td>
<td>{{ $lelongan_detail['hargajual'] }}</td>
<td>{{ $lelongan_detail['baki'] }}</td>
</tr>
@endforeach
<tr>
<td></td>
<td></td>
<td></td>
<td>Jumlah</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_berat'] }}</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_nilai_marhun'] }}</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_pembiayaan'] }}</td>
<td></td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_bakipjm'] }}</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_keuntungan'] }}</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_cajlelong'] }}</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_hargajual'] }}</td>
<td>{{ $teller_with_lelongan_data['data']['summary_lelongan_teller']['total_baki'] }}</td>
</tr>
</tbody>
</table>
@@ -0,0 +1,82 @@
<table>
<thead>
<tr>
<th colspan="11" style="text-align: center; font-weight: bold; font-size: 16px;">
SENARAI BAKI LELONG BELUM TUNTUT
</th>
</tr>
<tr>
<th colspan="11" style="text-align: center;">
Cawangan: {{ $cawangan_detail['nama'] ?? '-' }} |
Tarikh: {{ $query['tarikh'] ?? now()->format('d/m/Y') }}
</th>
</tr>
<tr><td colspan="11">&nbsp;</td></tr> {{-- ruang kosong sebelum header kolum --}}
<tr>
<th>#</th>
<th>No Rujukan</th>
<th>Nama</th>
<th>No KP</th>
<th>Berat (g)</th>
<th>Nilai Marhun (RM)</th>
<th>Tarikh Lelong</th>
<th>Harga Jual (RM)</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan (RM)</th>
<th>Caj Lelong (RM)</th>
<th>Baki (RM)</th>
</tr>
</thead>
<tbody>
@php
$total_berat = 0;
$total_nilaimarhun = 0;
$total_pinjaman = 0;
$total_hargajual = 0;
$total_keuntungan = 0;
$total_cajlelong = 0;
$total_baki = 0;
@endphp
@foreach ($lelongan_data as $index => $item)
@php
$total_berat += (float) $item['berat'];
$total_nilaimarhun += (float) $item['nilai_marhun'];
$total_pinjaman += (float) $item['pinjaman'];
$total_hargajual += (float) $item['hargajual'];
$total_keuntungan += (float) ($item['keuntungan'] ?? 0);
$total_cajlelong += (float) ($item['cajlelong'] ?? 0);
$total_baki += (float) ($item['baki'] ?? 0);
@endphp
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $item['no_rujukan'] ?? '' }}</td>
<td>{{ $item['nama'] ?? '' }}</td>
<td>'{{ $item['no_kp'] ?? '' }}</td>
<td>{{ $item['berat'] ?? 0 }}</td>
<td>{{ $item['nilai_marhun'] ?? 0 }}</td>
<td>{{ $item['t_lelong'] ?? 0 }}</td>
<td>{{ $item['hargajual'] ?? 0 }}</td>
<td>{{ $item['pinjaman'] ?? 0 }}</td>
<td>{{ $item['keuntungan'] ?? 0 }}</td>
<td>{{ $item['cajlelong'] ?? 0 }}</td>
<td>{{ $item['baki'] ?? 0 }}</td>
</tr>
@endforeach
<tr>
<td colspan="4"><strong>Jumlah</strong></td>
<td><strong>{{ number_format($total_berat, 2) }}</strong></td>
<td><strong>{{ number_format($total_nilaimarhun, 2) }}</strong></td>
<td><strong></strong></td>
<td><strong>{{ number_format($total_hargajual, 2) }}</strong></td>
<td><strong>{{ number_format($total_pinjaman, 2) }}</strong></td>
<td><strong>{{ number_format($total_keuntungan, 2) }}</strong></td>
<td><strong>{{ number_format($total_cajlelong, 2) }}</strong></td>
<td><strong>{{ number_format($total_baki, 2) }}</strong></td>
<td></td>
</tr>
</tbody>
</table>
@@ -0,0 +1,72 @@
<table>
<tr>
<td>{{ $cawangan_detail['nama'] }}</td>
</tr>
<tr>
<td>{{ $cawangan_detail['code'] }}</td>
</tr>
<tr>
<td>{{ $cawangan_detail['alamat'] }}</td>
</tr>
<tr>
<td>{{ $cawangan_detail['waktu_operasi'] }}</td>
</tr>
</table>
<table>
<tr>
<td colspan="2">
<strong>LAPORAN BAKI LELONG BELUM TUNTUT</strong>
</td>
</tr>
<tr>
<td>
TARIKH DARI {{ $query['startDate'] }} hingga {{ $query['endDate'] }}
</td>
</tr>
</table>
<table>
<tr>
<th>Teller</th>
<th>Bil</th>
<th>Berat</th>
<th>N.Marhun</th>
<th>Pembiayaan(RM)</th>
<th>Baki Pembiayaan(RM)</th>
<th>Keuntungan(RM)</th>
<th>Caj Lelong(RM)</th>
<th>Harga Jual(RM)</th>
<th>Baki(RM)</th>
</tr>
@foreach ($teller_with_lelongan_data as $data)
<tr>
<td>{{ $data['teller'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_lelongan'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_berat'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_nilai_marhun'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_pembiayaan'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_bakipjm'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_keuntungan'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_cajlelong'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_hargajual'] }}</td>
<td>{{ $data['summary_lelongan_teller']['total_baki'] }}</td>
</tr>
@endforeach
<tr>
<td></td>
<td>{{ $summary_lelongan['total_lelongan'] }}</td>
<td>{{ $summary_lelongan['total_berat'] }}</td>
<td>{{ $summary_lelongan['total_nilai_marhun'] }}</td>
<td>{{ $summary_lelongan['total_pembiayaan'] }}</td>
<td>{{ $summary_lelongan['total_bakipjm'] }}</td>
<td>{{ $summary_lelongan['total_keuntungan'] }}</td>
<td>{{ $summary_lelongan['total_cajlelong'] }}</td>
<td>{{ $summary_lelongan['total_hargajual'] }}</td>
<td>{{ $summary_lelongan['total_baki'] }}</td>
</tr>
</table>
@@ -0,0 +1,375 @@
@extends('layouts.app')
@section('content')
<div class="bg-gray-900 opacity-50 hidden fixed inset-0 z-10" id="sidebarBackdrop"></div>
<div id="main-content" class="h-full w-full bg-gray-50 relative overflow-y-auto">
<main>
<div class="pt-6 px-4">
<breadcrumb
:items="[{ 'title': 'Laporan Keseluruhan', 'icon': 'fas fa-users', 'url': '{{ route('reports') }}' }, { 'title': 'Baki Lelong Belum Tuntut', 'icon': 'fas fa-users' }]">
</breadcrumb>
<div class="container">
<div class="flex w-full">
<div class="xl:w-3/5 2xl:w-2/3 p-12 mx-auto">
<div class="bg-yellow-600 text-gray-200 text-lg px-6 py-4 rounded-t-lg"><a href="/reports"
class="router-link-active"><i class="fas fa-backspace text-white"></i></a> <span
class="text-center mx-auto text-white font-bold">Laporan Baki Lelong Belum Tuntut</span></div>
<form id="formLelongan" method="GET" action="{{ route('reports.bakilelongbelumtuntut.show') }}">
<div class="rounded bg-white shadow p-6">
<div class="pb-6"><label for="username"
class="font-semibold text-gray-700 block pb-1">Tarikh</label>
<div class="flex">
<span
class="text-gray-600 border border-2 rounded-l px-4 py-2 whitespace-no-wrap"
style="background-color: rgb(249, 250, 251);">Mula</span>
<input id="tarikhmula" name="startDate" type="date"
value="{{ request()->startDate ?? $startDate }}"
class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2">
<span
class="text-gray-600 border border-2 rounded-l px-4 py-2 whitespace-no-wrap"
style="background-color: rgb(249, 250, 251);">Hingga</span>
<input id="tarikhhingga" name="endDate" type="date"
value="{{ request()->endDate ?? $endDate }}"
class="border border-2 border-l-0 rounded-r px-4 py-2 w-80r mr-2">
<!-- Hidden Input to Determine Action -->
<input type="hidden" name="action" id="formAction" value="search">
<button type="submit" onclick="setAction('search')" class="border border-yellow-600 text-yellow-600 font-montserrat py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300 ml-5">
<i class="fas fa-magnifying-glass mr-2"></i> Search
</button>
<button type="submit" onclick="setAction('excel')" class="border border-yellow-600 text-yellow-600 py-2 px-8 font-medium rounded-xl hover:bg-yellow-600 hover:text-white transition-all duration-300 ml-2">
<i class="fas fa-file-excel mr-2"></i> Excel
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div kodcaw="operasi">
<div>
<!---->
<!---->
</div>
<div>
<!---->
<!---->
</div>
<div class="flex justify-between mb-2">
</div>
<table class="min-w-full leading-normal">
<thead class="text-center">
<tr>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
No
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Kod Cawangan
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Cawangan
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Bil
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Berat (g)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Nilai Marhun(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Pembiayaan(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Baki Pembiayaan(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Keuntungan(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Caj Lelong(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Harga Jual(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Baki(RM)
</th>
<th
class="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">
Action
</th>
</tr>
</thead>
@php
$totalbillelong = 0;
$totalberat = 0;
$totalnm = 0;
$totalpinjaman = 0;
$totalbakipjm = 0;
$totalkeuntungan = 0;
$totalcajlelong = 0;
$totalhargajual= 0;
$totalbaki= 0;
@endphp
<tbody>
@forelse ($lelongan as $lelong)
@php
$totalbillelong += $lelong['total_lelongan'];
$totalberat += $lelong['sum_berat'];
$totalnm += $lelong['sum_nilai_marhun'];
$totalpinjaman += $lelong['sum_pinjaman'];
$totalbakipjm += $lelong['sum_bakipjm'];
$totalkeuntungan += $lelong['sum_bakiupah'];
$totalcajlelong+= $lelong['sum_cajlelong'];
$totalhargajual+= $lelong['sum_hargajual'];
$totalbaki+= $lelong['sum_baki'];
@endphp
<tr>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">{{ $loop->iteration }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">{{ $lelong['kodcaw'] }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">{{ $lelong['details_caw'] }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">{{ $lelong['total_lelongan'] }}
</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_berat'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_nilai_marhun'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_pinjaman'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_bakipjm'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_bakiupah'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_cajlelong'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_hargajual'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($lelong['sum_baki'], 2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<a href="{{ route('reports.bakilelongbelumtuntut.cawangan.excel', [$lelong['kodcaw'], 'startDate' => request()->startDate, 'endDate' => request()->endDate]) }}"
target="_blank" rel="noopener noreferrer"
class="border border-blue-600 text-blue-600 font-montserrat py-2 px-4 font-medium rounded-xl hover:bg-blue-600 hover:text-white transition-all duration-300">
<i class="fas fa-download mr-2"></i>
</a>
</div>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">Data not available</p>
</div>
</div>
</td>
</tr>
@endforelse
<tr>
<td colspan="3" class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">Jumlah Keseluruhan</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">{{ $totalbillelong}}
</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalberat,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalnm,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalpinjaman,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalbakipjm,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalkeuntungan,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalcajlelong,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalhargajual,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
{{ number_format($totalbaki,2) }}</p>
</div>
</div>
</td>
<td class="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div class="flex items-center">
<div class="ml-3">
<p class="text-gray-900 whitespace-no-wrap">
</p>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
@include('layouts.footer')
</div>
@endsection
<!-- JavaScript to Change Action -->
<script>
function setAction(action) {
document.getElementById('formAction').value = action;
document.getElementById('formLelongan').submit();
}
</script>
@@ -0,0 +1,232 @@
<style>
#header {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#header td, #customers th {
padding:4px;
font-size:10px;
}
#header tr:nth-child(even){background-color: #ffffff;}
#header tr:hover {background-color: #ddd;}
#header th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#scan {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#scan td, #scan th {
padding: 8px;
font-size:11px;
}
#scan tr:nth-child(even){background-color: #ffffff;}
#scan tr:hover {background-color: #ddd;}
#scan th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#scan {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#scan td, #scan th {
border-collapse: collapse;
padding: 8px;
font-size:11px;
}
#scan tr:nth-child(even){background-color: #ffffff;}
#scan tr:hover {background-color: #ddd;}
#scan th {
border-collapse: collapse;
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#details {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#details td, #details th {
padding: 8px;
font-size:11px;
}
#details tr:nth-child(even){background-color: #ffffff;}
#details tr:hover {background-color: #ddd;}
#details th {
padding-top: 12px;
font-style:bold;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<style>
#sign {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#sign td, #sign th {
padding: 8px;
font-size:11px;
text-align: center;
}
#sign tr:nth-child(even){background-color: #ffffff;}
#sign tr:hover {background-color: #ddd;}
#sign th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
padding:4px;
color:black;
}
</style>
<table id="header">
<tr>
<th rowspan="4" style="width:50px"><br><img src="{{ asset('img/ARRAHN1.png') }}" style="width:70px"></img></th>
<th colspan="1">KOPERASI PERMODALAN KELANTAN BERHAD</th>
</tr>
<tr>
<td>Semua Cawangan</td>
<td></td>
</tr>
</table>
<br>
<table id="scan">
<tr>
<th colspan ="5"><b>Laporan Stok Audit</b></th>
<th> </th>
<th> </th>
<th><b> Tarikh Cetak:</b>
@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
$formattedweddingdate = $myDateTime->format('d-m-Y');
echo($formattedweddingdate)
@endphp
</th>
<th></th>
</tr>
<tr>
<td style="width:10px"> <b>TARIKH</b></td>
<td>{{ $tebus_date }}</td>
<td style="width:50px">
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br>
<table id="details">
<thead>
<th>Cawangan</th>
<th>Bilangan Pembiayaan</th>
<th>Berat</th>
<th>Nilai Marhun</th>
<th>Baki Pembiayaan</th>
<th>Pembiayaan</th>
<th>Keuntungan Belum Bayar</th>
<th>Jumlah Untung 1% Percent</th>
<th>Jumlah Lain-lain Caj</th>
</thead>
@foreach($stokAudit as $item)
<tr>
<td>{{$item['cawangan']}}</td>
<td>{{ $item['bilangan_pembiayaan'] }}</td>
<td>{{ number_format($item['berat'],2) }}</td>
<td>{{ number_format($item['nilai_marhun'],2) }}</td>
<td>{{ number_format($item['baki_pembiayaan'],2) }}</td>
<td>{{ number_format($item['pembiayaan'],2) }}</td>
<td>{{ number_format($item['upah_belum_bayar'],2) }}</td>
<td>{{ number_format($item['total_utg_onepercent'],2) }}</td>
<td>{{ number_format($item['total_ujrah'],2) }}</td>
</tr>
@endforeach
</table>
<br>
<br>
<table id="sign">
<tr>
<td></td>
<td colspan="2"> .................................................................. </td>
<td> </td>
<td colspan="2">.................................................................. </td>
<td> </td>
</tr>
<tr>
<td></td>
<td colspan="2"><B> DI SEMAK</B> </td>
<td> </td>
<td colspan="2"><B>DI SAHKAN </B></td>
<td> </td>
</tr>
</table>