Initial Commit
This commit is contained in:
47
app/Exports/ArahMataAnginExport.php
Normal file
47
app/Exports/ArahMataAnginExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\ArahMataAngin;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class ArahMataAnginExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return ArahMataAngin::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Arah Mata Angin',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
58
app/Exports/BasicDataSurveyorExport.php
Normal file
58
app/Exports/BasicDataSurveyorExport.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class BasicDataSurveyorExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
|
||||
public function __construct($model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->model::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/CustomFieldExport.php
Normal file
49
app/Exports/CustomFieldExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\CustomField;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class CustomFieldExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return CustomField::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->name,
|
||||
$row->type,
|
||||
$row->created_at,
|
||||
$row->updated_at,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Name',
|
||||
'Type',
|
||||
'Created At',
|
||||
'Updated At',
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
||||
'E' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
||||
];
|
||||
}
|
||||
}
|
||||
81
app/Exports/DebitureExport.php
Normal file
81
app/Exports/DebitureExport.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class DebitureExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Debiture::with('branch', 'province', 'city', 'district', 'village')->get();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->branch->name,
|
||||
$row->cif,
|
||||
$row->nomor_rekening,
|
||||
$row->name,
|
||||
$row->npwp,
|
||||
$row->nomor_id,
|
||||
$row->email,
|
||||
$row->phone,
|
||||
$row->province->name,
|
||||
$row->city->name,
|
||||
$row->district->name,
|
||||
$row->village->name,
|
||||
$row->postal_code,
|
||||
$row->address,
|
||||
$row->registered_at,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Branch',
|
||||
'CIF',
|
||||
'Nomor Rekening',
|
||||
'Name',
|
||||
'NPWP',
|
||||
'Nomor ID',
|
||||
'Email',
|
||||
'Phone',
|
||||
'Province',
|
||||
'City',
|
||||
'District',
|
||||
'Village',
|
||||
'Postal Code',
|
||||
'Address',
|
||||
'Registered At',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_NUMBER,
|
||||
'F' => NumberFormat::FORMAT_NUMBER,
|
||||
'G' => NumberFormat::FORMAT_NUMBER,
|
||||
'P' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'Q' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
47
app/Exports/HubunganPemilikJaminanExport.php
Normal file
47
app/Exports/HubunganPemilikJaminanExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\HubunganPemilikJaminan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class HubunganPemilikJaminanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return HubunganPemilikJaminan::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Hubungan Pemilik Jaminan',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
47
app/Exports/HubunganPenghuniJaminanExport.php
Normal file
47
app/Exports/HubunganPenghuniJaminanExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\HubunganPenghuniJaminan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class HubunganPenghuniJaminanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return HubunganPenghuniJaminan::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Hubungan Penghuni Jaminan',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
47
app/Exports/IjinUsahaExport.php
Normal file
47
app/Exports/IjinUsahaExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\IjinUsaha;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class IjinUsahaExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return IjinUsaha::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/JenisAsetExport.php
Normal file
49
app/Exports/JenisAsetExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisAset;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisAsetExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisAset::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
51
app/Exports/JenisDokumenExport.php
Normal file
51
app/Exports/JenisDokumenExport.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisDokumen;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisDokumenExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisDokumen::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->name,
|
||||
$row->max_size,
|
||||
$row->description,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Name',
|
||||
'Max Size',
|
||||
'Description',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/JenisFasilitasKreditExport.php
Normal file
49
app/Exports/JenisFasilitasKreditExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisFasilitasKredit;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisFasilitasKreditExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisFasilitasKredit::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/JenisJaminanExport.php
Normal file
49
app/Exports/JenisJaminanExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisJaminanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisJaminan::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/JenisLampiranExport.php
Normal file
46
app/Exports/JenisLampiranExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\app\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Modules\Lpj\app\Models\JenisLampiran;
|
||||
|
||||
class JenisLampiranExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisLampiran::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->nama,
|
||||
$row->deskripsi,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nama',
|
||||
'Deskripsi',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/JenisLaporanExport.php
Normal file
46
app/Exports/JenisLaporanExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisLaporan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisLaporanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisLaporan::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/JenisLegalitasJaminanExport.php
Normal file
49
app/Exports/JenisLegalitasJaminanExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisLegalitasJaminan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisLegalitasJaminanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisLegalitasJaminan::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/JenisPenilaianExport.php
Normal file
46
app/Exports/JenisPenilaianExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisPenilaian;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisPenilaianExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisPenilaian::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Jenis Penilaian',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
89
app/Exports/KJPPExport.php
Normal file
89
app/Exports/KJPPExport.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\KJPP;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class KJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return KJPP::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->jenis_kantor,
|
||||
$row->nomor_ijin_usaha,
|
||||
$row->province_code,
|
||||
$row->city_code,
|
||||
$row->district_code,
|
||||
$row->village_code,
|
||||
$row->address,
|
||||
$row->postal_code,
|
||||
$row->nomor_telepon_kantor,
|
||||
$row->email_kantor,
|
||||
$row->nama_pimpinan,
|
||||
$row->nomor_hp_pimpinan,
|
||||
$row->nama_pic_reviewer,
|
||||
$row->nomor_hp_pic_reviewer,
|
||||
$row->nama_pic_admin,
|
||||
$row->nomor_hp_pic_admin,
|
||||
$row->nama_pic_marketing,
|
||||
$row->nomor_hp_pic_marketing,
|
||||
$row->ijin_usaha_id,
|
||||
$row->jenis_aset_id,
|
||||
$row->attachment,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Jenis Kantor',
|
||||
'Nomor Ijin Usaha',
|
||||
'Province Code',
|
||||
'City Code',
|
||||
'District Code',
|
||||
'Village Code',
|
||||
'Address',
|
||||
'Postal Code',
|
||||
'Nomor Telepon Kantor',
|
||||
'Email Kantor',
|
||||
'Nama Pimpinan',
|
||||
'Nomor HP Pimpinan',
|
||||
'Nama PIC Reviewer',
|
||||
'Nomor HP PIC Reviewer',
|
||||
'Nama PIC Admin',
|
||||
'Nomor HP PIC Admin',
|
||||
'Nama PIC Marketing',
|
||||
'Nomor HP PIC Marketing',
|
||||
'Ijin Usaha ID',
|
||||
'Jenis Aset ID',
|
||||
'Attachment',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
339
app/Exports/KertasKerjaExport.php
Normal file
339
app/Exports/KertasKerjaExport.php
Normal file
@@ -0,0 +1,339 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnWidths;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class KertasKerjaExport implements FromCollection, WithHeadings, WithStyles, WithColumnWidths, WithEvents
|
||||
{
|
||||
// use Illuminate\Contracts\View\View;
|
||||
// use Maatwebsite\Excel\Concerns\FromView;
|
||||
// class KertasKerjaExport implements FromView
|
||||
// {
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
// public function view(): View
|
||||
// {
|
||||
// return view('lpj::component.kertas-kerja', [
|
||||
// 'data' => $this->data,
|
||||
// ]);
|
||||
// }
|
||||
|
||||
public function collection()
|
||||
{
|
||||
// $rows = [];
|
||||
|
||||
// $nomor = 1;
|
||||
$fields = [
|
||||
'jenis_aset' => 'Jenis Aset',
|
||||
'luas_tanah' => 'Luas Tanah (M²)',
|
||||
'luas_bangunan' => 'Luas Bangunan (M²)',
|
||||
'harga' => 'Harga Transaksi/Penawaran',
|
||||
'tanggal_penawaran' => 'Tanggal Penawaran/Transaksi',
|
||||
'diskon' => 'Diskon %',
|
||||
'esitmasi_harga' => 'Esitmasi Harga Transaksi (Rp)',
|
||||
'no_telepon' => 'Telepon Contact Person',
|
||||
'nama_nara_sumbr' => 'Nama Nara Sumber',
|
||||
'status_nara_sumbr' => 'Status Nara Sumber',
|
||||
'waktu_transaksi' => 'Waktu Transaksi/Penawaran',
|
||||
'alamat' => 'Alamat Titik Gps',
|
||||
|
||||
'jalan' => 'Jalan',
|
||||
'desa' => 'Desa/Kelurahan',
|
||||
'kecamatan' => 'Kecamatan',
|
||||
'kabupaten' => 'Kabupaten',
|
||||
'provinsi' => 'Provinsi',
|
||||
|
||||
'jarak_pembanding' => 'Jarak Pembanding dengan Objek',
|
||||
'elevasi' => 'Estimasi Ranking Tanah',
|
||||
'peruntukan' => 'Estiamsi Rangkin Bangunan'
|
||||
|
||||
];
|
||||
|
||||
$rows = [];
|
||||
$nomor = 1;
|
||||
|
||||
// Add general asset information
|
||||
$rows[] = ['No.', 'Uraian', 'Objek Penilaian', 'Data Pembanding 1', 'Data Pembanding 2', 'Data Pembanding 3'];
|
||||
|
||||
foreach ($this->data['objek'] as $key => $value) {
|
||||
$rows[] = [
|
||||
$nomor++,
|
||||
$key,
|
||||
$value,
|
||||
$this->data['pembanding1'][$key] ?? '',
|
||||
$this->data['pembanding2'][$key] ?? '',
|
||||
$this->data['pembanding3'][$key] ?? ''
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// B. Perhitungan Penyesuaian
|
||||
$rows[] = [''];
|
||||
$rows[] = [''];
|
||||
$rows[] = ['B. Estimasi Nilai Tanah Pembanding dengan Teknik Penyisaan Tanah untuk mendapatkan per meter persegi estimasi Nilai Tanah Pembanding'];
|
||||
$rows[] = ['No.','Uraian', 'Objek Penilaian', 'Data Pembanding 1', 'Data Pembanding 2', 'Data Pembanding 3'];
|
||||
$nostimasi = 1;
|
||||
$filedEstimasi = [
|
||||
'estimasi' => 'Estimasi Biaya Pengganti Baru Bangunan (Rp)',
|
||||
'estimasi_spl' => 'Estimasi Biaya Pengganti Baru SPL (Rp)',
|
||||
'penyusutan' => 'Penyusutan Fisik Banguna',
|
||||
|
||||
'a' => 'a. rincian ttipe bangunan (MAPPI)',
|
||||
'b' => 'b. umur ekonomis (MAPPI)',
|
||||
'c' => 'c. estimasi Tahun tahun visual dengan mempertimbangkan renovasi',
|
||||
'd' => 'd. Sehingga sisa umur efektif',
|
||||
'e' => 'e. kondisi bagunan',
|
||||
'f' => 'f.sehinggan penyusutan fisik',
|
||||
'penyusutan_fungsi' => 'Penyusutan fungsi Bangunan (%)',
|
||||
'penyusutan_ekonomi' => 'Penyusutan Ekonomi Bangunan (%)',
|
||||
'total_penyusutan' => 'Total Penyusutan (%)',
|
||||
'estimasi_nilai' => 'Estimasi Nilai Bangunan dan SPL (Rp)',
|
||||
'estimasi_tanah' => 'Estimasi Nilai Tanah Pembanding (Rp)',
|
||||
'estimasi_nilai' => 'Estimasi Nilai Tanah Pembanding (Rp)',
|
||||
];
|
||||
|
||||
foreach ($filedEstimasi as $key => $label) {
|
||||
$rows[] = [
|
||||
$nostimasi++,
|
||||
$label,
|
||||
$this->data['estimasi'][$key] ?? '',
|
||||
$this->data['estimasi1'][$key] ?? '',
|
||||
$this->data['estimasi2'][$key] ?? '',
|
||||
$this->data['estimasi3'][$key] ?? ''
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$row[] = [''];
|
||||
$row[] = [''];
|
||||
$rows[] = ['INDIKASI NILAI TANAHATAS OBJEK PENILAIAN'];
|
||||
|
||||
$indikasi=[
|
||||
'luas_tanah' => 'Luas Tanah ',
|
||||
'indikasi_per' => 'INDIKASI TANAH PER M2 (RP/M2)',
|
||||
'indikasi_total' => 'INDIKASI TANAH TOTAL(RP)',
|
||||
'varian' => 'VARIANT(%)',
|
||||
];
|
||||
|
||||
foreach ($indikasi as $key => $label) {
|
||||
$rows[] = [
|
||||
$label,
|
||||
$this->data['indikasi'][$key] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// C. Peta Lokasi
|
||||
$rows[] = [''];
|
||||
$rows[] = [''];
|
||||
$rows[] = ['C. Peta Lokasi'];
|
||||
$rows[] = [$this->data['foto_objek']['foto_objek_peta'] ?? ''];
|
||||
|
||||
// D. Foto Objek dan Data Pembanding
|
||||
$rows[] = [''];
|
||||
$rows[] = ['D. Foto Objek dan Data Pembanding'];
|
||||
$rows[] = [
|
||||
$this->data['foto_objek1']['foto_objek'] ?? '',
|
||||
$this->data['foto_objek2']['foto_objek'] ?? '',
|
||||
'', '', ''
|
||||
];
|
||||
|
||||
// E. Foto Objek
|
||||
$rows[] = [''];
|
||||
$rows[] = ['E. Foto Objek'];
|
||||
$rows[] = [
|
||||
$this->data['foto']['foto_objek'] ?? '',
|
||||
$this->data['foto']['foto_objek'] ?? '',
|
||||
'', '', ''
|
||||
];
|
||||
|
||||
return collect($rows);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
['KERTAS KERJA PENILAIAN'],
|
||||
['Pendekatan Pasar'],
|
||||
['Metode Perbandingan Data Pasar'],
|
||||
['Tanggal Penilaian: ' . ($this->headerInfo['tanggal_penilaian'] ?? '')],
|
||||
['Nama Pemilik Aset: ' . ($this->headerInfo['nama_pemilik'] ?? '')],
|
||||
['Nama Pemberi Tugas: ' . ($this->headerInfo['nama_pemberi_tugas'] ?? '')],
|
||||
['Lokasi: ' . ($this->headerInfo['lokasi_lengkap'] ?? '')],
|
||||
|
||||
];
|
||||
}
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
// Styling untuk header utama
|
||||
|
||||
|
||||
// Styling untuk setiap section header
|
||||
$sectionRows = [10, 34, 56, 46, 52]; // Sesuaikan dengan posisi setiap section
|
||||
foreach ($sectionRows as $row) {
|
||||
$event->sheet->getStyle("A{$row}:F{$row}")->getFill()
|
||||
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
|
||||
->getStartColor()->setRGB('E2EFDA');
|
||||
}
|
||||
|
||||
// Merge cells untuk headers
|
||||
$event->sheet->mergeCells('A1:E1');
|
||||
$event->sheet->mergeCells('A2:E2');
|
||||
$event->sheet->mergeCells('A4:E4');
|
||||
$event->sheet->mergeCells('A5:E5');
|
||||
$event->sheet->mergeCells('A6:E6');
|
||||
$event->sheet->mergeCells('A7:E7');
|
||||
$event->sheet->mergeCells('A8:E8');
|
||||
|
||||
// Alignment
|
||||
$event->sheet->getStyle('A1:E8')->getAlignment()
|
||||
->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT);
|
||||
$this->insertImages($event->sheet);
|
||||
}
|
||||
];
|
||||
}
|
||||
public function columnWidths(): array
|
||||
{
|
||||
return [
|
||||
'A' => 5,
|
||||
'B' => 30,
|
||||
'C' => 30,
|
||||
'D' => 30,
|
||||
'E' => 30,
|
||||
'F' => 30,
|
||||
];
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
return [
|
||||
// Style for the main header
|
||||
|
||||
// Style for section headers
|
||||
10 => ['font' => ['bold' => true]], // A. Informasi Umum
|
||||
34 => ['font' => ['bold' => true]], // B. Estimasi Nilai Tanah
|
||||
35 => ['font' => ['bold' => true]], // C. Peta Lokasi
|
||||
57 => ['font' => ['bold' => true]], // D. Foto Objek dan Pembanding
|
||||
60 => ['font' => ['bold' => true]], // E. Foto Objek
|
||||
|
||||
// Default styling for columns
|
||||
'A:J' => [
|
||||
'alignment' => ['horizontal' => 'left', 'vertical' => 'center'],
|
||||
'wrapText' => true,
|
||||
],
|
||||
|
||||
// Style for other sections (like photo and map sections)
|
||||
|
||||
// Style for the other headers
|
||||
'A11:F11' => [
|
||||
'font' => ['bold' => true],
|
||||
'fill' => ['fillType' => 'solid', 'color' => ['rgb' => 'E2EFDA']],
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN
|
||||
]
|
||||
]
|
||||
],
|
||||
'A12:F31' => [
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
||||
'A35:F35' => [
|
||||
'font' => ['bold' => true],
|
||||
'fill' => ['fillType' => 'solid', 'color' => ['rgb' => 'E2EFDA']],
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN
|
||||
]
|
||||
]
|
||||
],
|
||||
'A35:F49' => [
|
||||
'borders' => [
|
||||
'allBorders' => [
|
||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
// end header
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
protected function insertImages($sheet)
|
||||
{
|
||||
ini_set('max_execution_time', '300');
|
||||
|
||||
$worksheet = $sheet->getDelegate();
|
||||
|
||||
// Insert images for pembanding1
|
||||
if (!empty($this->data['pembanding1']['foto_objek'])) {
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName('Pembanding 1');
|
||||
$drawing->setDescription('Foto Objek Pembanding 1');
|
||||
$drawing->setPath(storage_path('app/public/' . $this->data['pembanding1']['foto_objek'])); // Adjust path as needed
|
||||
$drawing->setHeight(90);
|
||||
$drawing->setCoordinates('C' . (count($this->collection()) + 2)); // Adjust coordinates as needed
|
||||
$drawing->setWorksheet($worksheet);
|
||||
}
|
||||
|
||||
// Repeat for pembanding2 and pembanding3
|
||||
if (!empty($this->data['pembanding2']['foto_objek'])) {
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName('Pembanding 2');
|
||||
$drawing->setDescription('Foto Objek Pembanding 2');
|
||||
$drawing->setPath(storage_path('app/public/' . $this->data['pembanding2']['foto_objek'])); // Adjust path as needed
|
||||
$drawing->setHeight(90);
|
||||
$drawing->setCoordinates('C' . (count($this->collection()) + 4)); // Adjust coordinates as needed
|
||||
$drawing->setWorksheet($worksheet);
|
||||
}
|
||||
|
||||
if (!empty($this->data['pembanding3']['foto_objek'])) {
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName('Pembanding 3');
|
||||
$drawing->setDescription('Foto Objek Pembanding 3');
|
||||
$drawing->setPath(storage_path('app/public/' . $this->data['pembanding3']['foto_objek'])); // Adjust path as needed
|
||||
$drawing->setHeight(90);
|
||||
$drawing->setCoordinates('C' . (count($this->collection()) + 6)); // Adjust coordinates as needed
|
||||
$drawing->setWorksheet($worksheet);
|
||||
}
|
||||
|
||||
// Insert images for foto_objek
|
||||
foreach ($this->data['foto_objek'] as $index => $foto) {
|
||||
if (!empty($foto['foto_objek'])) {
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName($foto['name_objek']);
|
||||
$drawing->setDescription($foto['deskripsi_objek']);
|
||||
$drawing->setPath(storage_path('app/public/' . $foto['foto_objek'])); // Adjust path as needed
|
||||
$drawing->setHeight(90);
|
||||
$drawing->setCoordinates('C' . (count($this->collection()) + (8 + $index * 2))); // Adjust coordinates as needed
|
||||
$drawing->setWorksheet($worksheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
app/Exports/LaporanAdminKreditExport.php
Normal file
70
app/Exports/LaporanAdminKreditExport.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\LaporanAdminKredit;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class LaporanAdminKreditExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return LaporanAdminKredit::with('debiture')->get();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->debiture->cif,
|
||||
$row->debiture->name,
|
||||
$row->debiture->branch->name,
|
||||
$row->kode_register_t24,
|
||||
$row->jenis_agunan,
|
||||
$row->bukti_kepemilikan,
|
||||
$row->alamat_agunan,
|
||||
$row->nama_pemilik,
|
||||
$row->tanggal_kunjungan,
|
||||
$row->nilai_pasar_wajar,
|
||||
$row->nilai_likuidasi,
|
||||
$row->nama_penilai,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'CIF',
|
||||
'Nama Debitur',
|
||||
'Cabang',
|
||||
'Kode Register T24',
|
||||
'Jenis Agunan',
|
||||
'Bukti Kepemilikan',
|
||||
'Alamat Agunan',
|
||||
'Nama Pemilik',
|
||||
'Tanggal Kunjungan',
|
||||
'Nilai Pasar Wajar',
|
||||
'Nilai Likuidasi',
|
||||
'Nama Penilai',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'J' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
||||
'K' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
|
||||
'L' => NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1,
|
||||
'M' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\Branch;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LaporanHasilPenilaianJaminanInternalExternalExport implements FromCollection, WithHeadings, WithMapping, WithTitle, WithCustomStartCell, WithEvents
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$query = Permohonan::query();
|
||||
$query = $query->where('status', 'done');
|
||||
|
||||
// Apply date range filter if provided
|
||||
if ($this->request->has('start_date') || $this->request->has('end_date')) {
|
||||
$query->whereBetween('tanggal_permohonan', [
|
||||
$this->request->start_date ?? '1900-01-01',
|
||||
$this->request->end_date ?? now()->toDateString()
|
||||
]);
|
||||
}
|
||||
|
||||
// Apply branch filter if provided
|
||||
if ($this->request->has('branch_id') && !empty($this->request->branch_id)) {
|
||||
$query->where('branch_id', $this->request->branch_id);
|
||||
}
|
||||
|
||||
if ($this->request->has('penilai_id') && !empty($this->request->penilai_id)) {
|
||||
$request = $this->request; // Store in a local variable
|
||||
$query->whereHas('penilaian._user_penilai.userPenilaiTeam', function($q) use ($request) {
|
||||
$q->where('user_id', $request->penilai_id);
|
||||
});
|
||||
}
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($this->request->has('search') && !empty($this->request->search)) {
|
||||
$search = $this->request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisFasilitasKredit', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
// Default ordering
|
||||
$query->orderBy('nomor_registrasi', 'asc');
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
protected $rowNumber = 0;
|
||||
|
||||
public function map($permohonan): array
|
||||
{
|
||||
$this->rowNumber++;
|
||||
$luas_tanah = 0;
|
||||
$luas_bangunan = 0;
|
||||
$nilai_tanah = 0;
|
||||
$nilai_bangunan = 0;
|
||||
$npw = 0;
|
||||
$nilai_liquidasi = 0;
|
||||
|
||||
if (isset($permohonan->penilai->lpj)) {
|
||||
$lpj = json_decode($permohonan->penilai->lpj, true);
|
||||
$npw = str_replace('.', '', $lpj['total_nilai_pasar_wajar'] ?? 0);
|
||||
|
||||
$luas_tanah = $lpj['luas_tanah'] ?? 0;
|
||||
$luas_bangunan = $lpj['luas_bangunan'] ?? 0;
|
||||
$nilai_tanah = str_replace('.', '', $lpj['nilai_tanah_2'] ?? 0);
|
||||
$nilai_bangunan = str_replace('.', '', $lpj['nilai_bangunan_2'] ?? 0);
|
||||
$nilai_liquidasi = str_replace('.', '', $lpj['likuidasi_nilai_2'] ?? 0);
|
||||
}
|
||||
|
||||
return [
|
||||
$this->rowNumber,
|
||||
$permohonan->nomor_registrasi,
|
||||
$permohonan->tanggal_permohonan,
|
||||
$permohonan->debiture->branch->name,
|
||||
$permohonan->creator->name,
|
||||
$permohonan->debiture->cif,
|
||||
$permohonan->debiture->name,
|
||||
$permohonan->jenisPenilaian->name,
|
||||
$permohonan->tujuanPenilaian->name,
|
||||
$permohonan->jenisFasilitasKredit->name,
|
||||
$permohonan->documents->pluck('jenisJaminan.name')->unique()->implode(', '),
|
||||
$permohonan->documents->map(function ($document) {
|
||||
return formatAlamat($document);
|
||||
})->unique()->implode(', '),
|
||||
$permohonan->documents->flatMap(function ($document) {
|
||||
return $document->detail->map(function ($detail) {
|
||||
return (!empty($detail->dokumen_nomor) && is_array($detail->dokumen_nomor))
|
||||
? ($detail->jenisLegalitasJaminan->name ?? '') . "\n" . implode(', ', $detail->dokumen_nomor)
|
||||
: null;
|
||||
});
|
||||
})->filter()->unique()->implode(', '),
|
||||
$permohonan->documents->pluck('pemilik.name')->unique()->implode(', '),
|
||||
$luas_tanah . ' m²',
|
||||
formatRupiah($nilai_tanah, 2),
|
||||
$luas_bangunan . ' m²',
|
||||
formatRupiah($nilai_bangunan, 2),
|
||||
formatRupiah($permohonan->nilai_njop ?? 0, 2),
|
||||
formatRupiah($npw, 2),
|
||||
formatRupiah($nilai_liquidasi, 2),
|
||||
$permohonan->documents->map(function ($document) {
|
||||
return formatTanggalIndonesia($document->created_at);
|
||||
})->first(),
|
||||
'', // tanggal_spk
|
||||
'', // nomor_spk
|
||||
'', // tanggal_rencana_kunjungan
|
||||
$permohonan->penilaian->tanggal_kunjungan ? formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) : '',
|
||||
'', // tanggal_delivered
|
||||
'', // jangka_waktu_sla
|
||||
($permohonan->approval_dd_at || $permohonan->approval_eo_at) ?
|
||||
formatTanggalIndonesia($permohonan->approval_dd_at ?? $permohonan->approval_eo_at) : '',
|
||||
$permohonan->penilaian->tanggal_kunjungan ? formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) : '',
|
||||
$permohonan->penilaian->_user_penilai->userPenilaiTeam->name ?? '',
|
||||
$permohonan->penilaian->teams ?? '',
|
||||
'', // saran
|
||||
'' // catatan
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'No',
|
||||
'Nomor Registrasi',
|
||||
'Tanggal Permohonan',
|
||||
'Cabang',
|
||||
'Pemohon',
|
||||
'CIF',
|
||||
'Nama Debitur',
|
||||
'Jenis Penilaian',
|
||||
'Tujuan Penilaian',
|
||||
'Jenis Fasilitas Kredit',
|
||||
'Jenis Agunan',
|
||||
'Alamat Agunan',
|
||||
'Bukti Kepemilikan',
|
||||
'Nama Pemilik',
|
||||
'Luas Tanah',
|
||||
'Nilai Tanah',
|
||||
'Luas Bangunan',
|
||||
'Nilai Bangunan',
|
||||
'Nilai NJOP',
|
||||
'Nilai Pasar Wajar',
|
||||
'Nilai Likuidasi',
|
||||
'Tanggal Dokumen Diterima',
|
||||
'Tanggal SPK',
|
||||
'Nomor SPK',
|
||||
'Tanggal Rencana Kunjungan',
|
||||
'Tanggal Kunjungan',
|
||||
'Tanggal Delivered',
|
||||
'Jangka Waktu SLA',
|
||||
'Tanggal Laporan',
|
||||
'Tanggal Review',
|
||||
'Nama Penilai',
|
||||
'Nama Team Leader',
|
||||
'Saran',
|
||||
'Catatan'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function title(): string
|
||||
{
|
||||
return 'Laporan Hasil Penilaian Jaminan Internal & External';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function startCell(): string
|
||||
{
|
||||
return 'A7';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function(AfterSheet $event) {
|
||||
// Get the sheet
|
||||
$sheet = $event->sheet->getDelegate();
|
||||
|
||||
// Set the title
|
||||
$sheet->setCellValue('A1', 'LAPORAN PENILAIAN JAMINAN');
|
||||
$sheet->getStyle('A1')->getFont()->setBold(true)->setSize(16);
|
||||
|
||||
// Merge cells for title
|
||||
$sheet->mergeCells('A1:AH1');
|
||||
$sheet->getStyle('A1')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
|
||||
// Set the branch information if filtered
|
||||
$branchInfo = '';
|
||||
if ($this->request->has('branch_id') && !empty($this->request->branch_id)) {
|
||||
$branch = Branch::find($this->request->branch_id);
|
||||
if ($branch) {
|
||||
$branchInfo = 'Cabang: ' . $branch->name;
|
||||
$sheet->setCellValue('A2', $branchInfo);
|
||||
$sheet->mergeCells('A2:AH2');
|
||||
$sheet->getStyle('A2')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
$sheet->getStyle('A2')->getFont()->setBold(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the period
|
||||
$startDate = $this->request->start_date ?? '';
|
||||
$endDate = $this->request->end_date ?? '';
|
||||
|
||||
$rowIndex = $branchInfo ? 3 : 2;
|
||||
|
||||
if ($startDate && $endDate) {
|
||||
$startDateFormatted = Carbon::parse($startDate)->format('d F Y');
|
||||
$endDateFormatted = Carbon::parse($endDate)->format('d F Y');
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Periode: ' . $startDateFormatted . ' - ' . $endDateFormatted);
|
||||
} else {
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Periode: Semua Data');
|
||||
}
|
||||
$sheet->mergeCells('A' . $rowIndex . ':AH' . $rowIndex);
|
||||
$sheet->getStyle('A' . $rowIndex)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
|
||||
// Set the date of export
|
||||
$rowIndex++;
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Tanggal Export: ' . Carbon::now()->format('d F Y H:i:s'));
|
||||
|
||||
// Set the user who exported
|
||||
$rowIndex++;
|
||||
$userName = Auth::user() ? Auth::user()->name : 'System';
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Diexport oleh: ' . $userName);
|
||||
|
||||
// Add a blank line
|
||||
$rowIndex++;
|
||||
$sheet->setCellValue('A' . $rowIndex, '');
|
||||
|
||||
// Style the header row
|
||||
$headerRange = 'A7:' . $sheet->getHighestColumn() . '7';
|
||||
$sheet->getStyle($headerRange)->getFont()->setBold(true);
|
||||
$sheet->getStyle($headerRange)->getFill()
|
||||
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
|
||||
->getStartColor()->setARGB('FFCCCCCC');
|
||||
|
||||
// Auto-size columns - fixed to handle columns beyond Z
|
||||
$highestColumn = $sheet->getHighestColumn();
|
||||
$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn);
|
||||
|
||||
for ($i = 1; $i <= $highestColumnIndex; $i++) {
|
||||
$currentColumn = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($i);
|
||||
$sheet->getColumnDimension($currentColumn)->setAutoSize(true);
|
||||
}
|
||||
|
||||
// Add borders to all cells with data
|
||||
$dataRange = 'A7:' . $sheet->getHighestColumn() . $sheet->getHighestRow();
|
||||
$sheet->getStyle($dataRange)->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN);
|
||||
|
||||
// Center align the header row
|
||||
$sheet->getStyle($headerRange)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
|
||||
// Set text wrap for header cells
|
||||
$sheet->getStyle($headerRange)->getAlignment()->setWrapText(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
102
app/Exports/LaporanPembatalanExport.php
Normal file
102
app/Exports/LaporanPembatalanExport.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\PermohonanPembatalan;
|
||||
|
||||
class LaporanPembatalanExport implements FromCollection, WithHeadings, WithMapping
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$query = PermohonanPembatalan::where('status', 'batal');
|
||||
|
||||
if (!Auth::user()->hasAnyRole(['administrator'])) {
|
||||
$query = $query->whereHas('permohonan', function ($q) {
|
||||
$q->where('branch_id', Auth::user()->branch_id);
|
||||
});
|
||||
}
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($this->request->has('search') && !empty($this->request->get('search'))) {
|
||||
$search = $this->request->get('search');
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->whereHas('permohonan', function ($subq) use ($search) {
|
||||
$subq->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||
$subq->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||
$subq->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
$q->orWhere('alasan', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
// Filter by date range if provided
|
||||
if ($this->request->has('start_date') || $this->request->has('end_date')) {
|
||||
$query->whereBetween('created_at', [
|
||||
$this->request->get('start_date') ?? '1900-01-01',
|
||||
$this->request->get('end_date') ?? now()->toDateString()
|
||||
]);
|
||||
}
|
||||
|
||||
// Filter by status if provided
|
||||
if ($this->request->has('status') && !empty($this->request->get('status'))) {
|
||||
$query->where('status', $this->request->get('status'));
|
||||
}
|
||||
|
||||
// Filter by branch if provided
|
||||
if ($this->request->has('branch_id') && !empty($this->request->get('branch_id'))) {
|
||||
$query->whereHas('permohonan', function ($q) {
|
||||
$q->where('branch_id', $this->request->get('branch_id'));
|
||||
});
|
||||
}
|
||||
|
||||
return $query->orderBy('created_at', 'desc')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'No. Registrasi',
|
||||
'Tanggal Permohonan',
|
||||
'Tanggal Pembatalan',
|
||||
'Cabang',
|
||||
'Pemohon',
|
||||
'Debitur',
|
||||
'Alasan Pembatalan',
|
||||
'Status',
|
||||
'Diajukan Oleh',
|
||||
'Disetujui Oleh',
|
||||
'Tanggal Disetujui'
|
||||
];
|
||||
}
|
||||
|
||||
public function map($pembatalan): array
|
||||
{
|
||||
return [
|
||||
$pembatalan->permohonan->nomor_registrasi ?? '-',
|
||||
$pembatalan->permohonan->tanggal_permohonan ? date('d-m-Y', strtotime($pembatalan->permohonan->tanggal_permohonan)) : '-',
|
||||
date('d-m-Y', strtotime($pembatalan->created_at)),
|
||||
$pembatalan->permohonan->branch->name ?? '-',
|
||||
$pembatalan->permohonan->user->name ?? '-',
|
||||
$pembatalan->permohonan->debiture->name ?? '-',
|
||||
$pembatalan->alasan_pembatalan,
|
||||
$pembatalan->status,
|
||||
$pembatalan->user->name ?? '-',
|
||||
$pembatalan->authorized_by ? $pembatalan->authorizedUser->name : '-',
|
||||
$pembatalan->authorized_at ? formatTanggalIndonesia(strtotime($pembatalan->authorized_at),1) : '-'
|
||||
];
|
||||
}
|
||||
}
|
||||
177
app/Exports/LaporanPenilaiJaminanExport.php
Normal file
177
app/Exports/LaporanPenilaiJaminanExport.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Helpers\Lpj;
|
||||
|
||||
class LaporanPenilaiJaminanExport implements FromQuery, WithHeadings, WithMapping, ShouldAutoSize
|
||||
{
|
||||
protected $tanggalAwal;
|
||||
protected $tanggalAkhir;
|
||||
protected $status;
|
||||
protected $selectedIds;
|
||||
|
||||
public function __construct($tanggalAwal = null, $tanggalAkhir = null, $status = null, $selectedIds = null)
|
||||
{
|
||||
$this->tanggalAwal = $tanggalAwal;
|
||||
$this->tanggalAkhir = $tanggalAkhir;
|
||||
$this->status = $status;
|
||||
$this->selectedIds = $selectedIds;
|
||||
}
|
||||
|
||||
|
||||
public function query()
|
||||
{
|
||||
$query = Permohonan::query()
|
||||
->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian', 'dokumenjaminan.jenisJaminan','nilaiPlafond', 'penilai', 'inspeksi']);
|
||||
|
||||
// Filter by date range if provided
|
||||
if ($this->tanggalAwal && $this->tanggalAkhir) {
|
||||
$query->whereBetween('tanggal_permohonan', [$this->tanggalAwal, $this->tanggalAkhir]);
|
||||
}
|
||||
|
||||
$query->where('status', 'done');
|
||||
// Filter by status if provided
|
||||
if ($this->status) {
|
||||
$types = is_array($this->status) ? $this->status : [$this->status];
|
||||
$types = array_map('strtolower', $types);
|
||||
$query->whereHas('penilai', function (Builder $query) use ($types) {
|
||||
$query->whereIn('type_penilai', $types);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Filter by selected IDs if provided
|
||||
if ($this->selectedIds) {
|
||||
$selectedIds = is_array($this->selectedIds) ? $this->selectedIds : explode(',', $this->selectedIds);
|
||||
$query->whereIn('id', $selectedIds);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
|
||||
// ambil data alamat dari inspeksi
|
||||
$alamat_inspeksi = null;
|
||||
|
||||
if ($row->inspeksi) {
|
||||
$alamat_inspeksi = json_decode($row->inspeksi->data_form, true) ?? null;
|
||||
$alamat_inspeksi = $alamat_inspeksi['asset']['alamat']['sesuai'] ?? $alamat_inspeksi['asset']['alamat']['tidak sesuai'] ?? [];
|
||||
}
|
||||
$alamat_inspeksi = $alamat_inspeksi['address'] ?? '-';
|
||||
|
||||
|
||||
// ambil data dari table penilai
|
||||
$fieldPenilai = ['lpj', 'resume', 'memo', 'rap', 'call-report'];
|
||||
$penilaiCek = null;
|
||||
|
||||
// Cari field yang tersedia
|
||||
foreach ($fieldPenilai as $value) {
|
||||
if (!empty($row->penilai->$value)) {
|
||||
$penilaiCek = $row->penilai->$value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$decodePenilai = json_decode($penilaiCek, true) ?? [];
|
||||
// Ambil nilai utama
|
||||
$luasTanah = $decodePenilai['luas_tanah'] ?? 0;
|
||||
$nilaiTanah1 = $decodePenilai['nilai_tanah_1'] ?? 0;
|
||||
$luasBangunan = $decodePenilai['luas_bangunan'] ?? 0;
|
||||
$nilaiBangunan1 = $decodePenilai['nilai_bangunan_1'] ?? 0;
|
||||
$totalNilaiPasar = $decodePenilai['total_nilai_pasar_wajar'] ?? 0;
|
||||
$likuidasi = $decodePenilai['likuidasi'] ?? 0;
|
||||
|
||||
// Ambil data npw_tambahan jika ada
|
||||
$npwTambahan = $decodePenilai['npw_tambahan'] ?? [];
|
||||
$tambahanDetails = [];
|
||||
foreach ($npwTambahan as $tambahan) {
|
||||
$tambahanDetails[] = sprintf(
|
||||
'%s: Luas: %s, Nilai 1: %s, Nilai 2: %s',
|
||||
$tambahan['name'] ?? '-',
|
||||
$tambahan['luas'] ?? 0,
|
||||
$tambahan['nilai_1'] ?? 0,
|
||||
$tambahan['nilai_2'] ?? 0
|
||||
);
|
||||
}
|
||||
$tambahanSummary = implode("; ", $tambahanDetails);
|
||||
|
||||
// Ambil data penilaian dari table penilaian
|
||||
$user_penilai = $row->penilaian->userPenilai ?? null;
|
||||
$user_penilai_name = null;
|
||||
foreach ($user_penilai as $value) {
|
||||
if ($value->role == 'penilai') {
|
||||
$user_penilai_name = $value->user->name;
|
||||
$nik_penilai = $value->user->nik ?? '-';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return [
|
||||
$row->id,
|
||||
$row->nomor_registrasi,
|
||||
$row->user->name,
|
||||
$row->branch->name,
|
||||
$row->tujuanPenilaian->name,
|
||||
$row->debiture->name,
|
||||
$row->penilai->type_penilai ?? '-',
|
||||
$alamat_inspeksi ?? '-',
|
||||
$luasTanah,
|
||||
$luasBangunan,
|
||||
$nilaiTanah1,
|
||||
$nilaiBangunan1,
|
||||
$totalNilaiPasar,
|
||||
$likuidasi,
|
||||
$row->laporan->created_at ?? '-',
|
||||
$user_penilai_name,
|
||||
$nik_penilai,
|
||||
$row->created_at,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nomor Registrasi',
|
||||
'User Pemohon',
|
||||
'Cabang',
|
||||
'Tujuan Penilaian',
|
||||
'Debitur',
|
||||
'Jenis Laporan',
|
||||
'Lokasi Jaminan',
|
||||
'Luas Tanah',
|
||||
'Luas Bangunan',
|
||||
'Harga Tanah',
|
||||
'Harga Bangunan',
|
||||
'Nilai Pasar Wajar',
|
||||
'Likuidasi',
|
||||
'Tanggal Laporan',
|
||||
'Nama Penilai',
|
||||
'Nik Penilai',
|
||||
'Created At',
|
||||
];
|
||||
}
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'K' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'N' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
245
app/Exports/LaporanPenilaianJaminanExport.php
Normal file
245
app/Exports/LaporanPenilaianJaminanExport.php
Normal file
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\Branch;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LaporanPenilaianJaminanExport implements FromCollection, WithHeadings, WithMapping, WithTitle, WithCustomStartCell, WithEvents
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$query = Permohonan::query();
|
||||
$query = $query->where('status', 'done');
|
||||
|
||||
// Apply date range filter if provided
|
||||
if ($this->request->has('start_date') || $this->request->has('end_date')) {
|
||||
$query->whereBetween('tanggal_permohonan', [
|
||||
$this->request->start_date ?? '1900-01-01',
|
||||
$this->request->end_date ?? now()->toDateString()
|
||||
]);
|
||||
}
|
||||
|
||||
// Apply branch filter if provided
|
||||
if ($this->request->has('branch_id') && !empty($this->request->branch_id)) {
|
||||
$query->where('branch_id', $this->request->branch_id);
|
||||
}
|
||||
|
||||
if ($this->request->has('penilai_id') && !empty($this->request->penilai_id)) {
|
||||
$request = $this->request; // Store in a local variable
|
||||
$query->whereHas('penilaian._user_penilai.userPenilaiTeam', function($q) use ($request) {
|
||||
$q->where('user_id', $request->penilai_id);
|
||||
});
|
||||
}
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($this->request->has('search') && !empty($this->request->search)) {
|
||||
$search = $this->request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisFasilitasKredit', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
// Default ordering
|
||||
$query->orderBy('nomor_registrasi', 'asc');
|
||||
|
||||
return $query->with(['debiture.branch'])->get();
|
||||
}
|
||||
|
||||
protected $rowNumber = 0;
|
||||
|
||||
public function map($permohonan): array
|
||||
{
|
||||
$this->rowNumber++;
|
||||
$luas_tanah = 0;
|
||||
$luas_bangunan = 0;
|
||||
$nilai_tanah = 0;
|
||||
$nilai_bangunan = 0;
|
||||
$npw = 0;
|
||||
$nilai_liquidasi = 0;
|
||||
|
||||
if (isset($permohonan->penilai->lpj)) {
|
||||
$lpj = json_decode($permohonan->penilai->lpj, true);
|
||||
$npw = str_replace('.', '', $lpj['total_nilai_pasar_wajar'] ?? 0);
|
||||
|
||||
$luas_tanah = $lpj['luas_tanah'] ?? 0;
|
||||
$luas_bangunan = $lpj['luas_bangunan'] ?? 0;
|
||||
$nilai_tanah = str_replace('.', '', $lpj['nilai_tanah_2'] ?? 0);
|
||||
$nilai_bangunan = str_replace('.', '', $lpj['nilai_bangunan_2'] ?? 0);
|
||||
$nilai_liquidasi = str_replace('.', '', $lpj['likuidasi_nilai_2'] ?? 0);
|
||||
}
|
||||
|
||||
return [
|
||||
$this->rowNumber,
|
||||
$permohonan->nomor_registrasi,
|
||||
$permohonan->tanggal_permohonan,
|
||||
$permohonan->debiture->branch->name,
|
||||
$permohonan->debiture->name,
|
||||
$permohonan->creator->name,
|
||||
$permohonan->tujuanPenilaian->name,
|
||||
$permohonan->documents->pluck('jenisJaminan.name')->unique()->implode(', '),
|
||||
$permohonan->documents->map(function ($document) {
|
||||
return formatAlamat($document);
|
||||
})->unique()->implode(', '),
|
||||
$luas_tanah . ' m²',
|
||||
formatRupiah($nilai_tanah, 2),
|
||||
$luas_bangunan . ' m²',
|
||||
formatRupiah($nilai_bangunan, 2),
|
||||
($permohonan->approval_dd_at || $permohonan->approval_eo_at) ?
|
||||
formatTanggalIndonesia($permohonan->approval_dd_at ?? $permohonan->approval_eo_at) : '',
|
||||
$permohonan->penilaian->tanggal_kunjungan ?
|
||||
formatTanggalIndonesia($permohonan->penilaian->tanggal_kunjungan) : '',
|
||||
formatRupiah($npw, 2),
|
||||
formatRupiah($nilai_liquidasi, 2),
|
||||
$permohonan->penilaian->_user_penilai->userPenilaiTeam->name,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'No',
|
||||
'Nomor Registrasi',
|
||||
'Tanggal Permohonan',
|
||||
'Cabang',
|
||||
'Nama Debitur',
|
||||
'Pemohon',
|
||||
'Tujuan Penilaian',
|
||||
'Jenis Agunan',
|
||||
'Alamat Agunan',
|
||||
'Luas Tanah',
|
||||
'Nilai Tanah',
|
||||
'Luas Bangunan',
|
||||
'Nilai Bangunan',
|
||||
'Tanggal Laporan',
|
||||
'Tanggal Review',
|
||||
'Nilai Pasar Wajar',
|
||||
'Nilai Likuidasi',
|
||||
'Nama Penilai',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function title(): string
|
||||
{
|
||||
return 'Laporan Penilaian Jaminan';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function startCell(): string
|
||||
{
|
||||
return 'A7';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function(AfterSheet $event) {
|
||||
// Get the sheet
|
||||
$sheet = $event->sheet->getDelegate();
|
||||
|
||||
// Set the title
|
||||
$sheet->setCellValue('A1', 'LAPORAN PENILAIAN JAMINAN');
|
||||
$sheet->getStyle('A1')->getFont()->setBold(true)->setSize(16);
|
||||
|
||||
// Merge cells for title
|
||||
$sheet->mergeCells('A1:R1');
|
||||
$sheet->getStyle('A1')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
|
||||
// Set the branch information if filtered
|
||||
$branchInfo = '';
|
||||
if ($this->request->has('branch_id') && !empty($this->request->branch_id)) {
|
||||
$branch = Branch::find($this->request->branch_id);
|
||||
if ($branch) {
|
||||
$branchInfo = 'Cabang: ' . $branch->name;
|
||||
$sheet->setCellValue('A2', $branchInfo);
|
||||
$sheet->mergeCells('A2:R2');
|
||||
$sheet->getStyle('A2')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
$sheet->getStyle('A2')->getFont()->setBold(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the period
|
||||
$startDate = $this->request->start_date ?? '';
|
||||
$endDate = $this->request->end_date ?? '';
|
||||
|
||||
$rowIndex = $branchInfo ? 3 : 2;
|
||||
|
||||
if ($startDate && $endDate) {
|
||||
$startDateFormatted = Carbon::parse($startDate)->format('d F Y');
|
||||
$endDateFormatted = Carbon::parse($endDate)->format('d F Y');
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Periode: ' . $startDateFormatted . ' - ' . $endDateFormatted);
|
||||
} else {
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Periode: Semua Data');
|
||||
}
|
||||
$sheet->mergeCells('A' . $rowIndex . ':R' . $rowIndex);
|
||||
$sheet->getStyle('A' . $rowIndex)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
|
||||
// Set the date of export
|
||||
$rowIndex++;
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Tanggal Export: ' . Carbon::now()->format('d F Y H:i:s'));
|
||||
|
||||
// Set the user who exported
|
||||
$rowIndex++;
|
||||
$userName = Auth::user() ? Auth::user()->name : 'System';
|
||||
$sheet->setCellValue('A' . $rowIndex, 'Diexport oleh: ' . $userName);
|
||||
|
||||
// Add a blank line
|
||||
$rowIndex++;
|
||||
$sheet->setCellValue('A' . $rowIndex, '');
|
||||
|
||||
// Style the header row
|
||||
$headerRange = 'A7:' . $sheet->getHighestColumn() . '7';
|
||||
$sheet->getStyle($headerRange)->getFont()->setBold(true);
|
||||
$sheet->getStyle($headerRange)->getFill()
|
||||
->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)
|
||||
->getStartColor()->setARGB('FFCCCCCC');
|
||||
|
||||
// Auto-size columns
|
||||
foreach(range('A', $sheet->getHighestColumn()) as $column) {
|
||||
$sheet->getColumnDimension($column)->setAutoSize(true);
|
||||
}
|
||||
|
||||
// Add borders to all cells with data
|
||||
$dataRange = 'A7:' . $sheet->getHighestColumn() . $sheet->getHighestRow();
|
||||
$sheet->getStyle($dataRange)->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN);
|
||||
|
||||
// Center align the header row
|
||||
$sheet->getStyle($headerRange)->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||
|
||||
// Set text wrap for header cells
|
||||
$sheet->getStyle($headerRange)->getAlignment()->setWrapText(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
98
app/Exports/LaporanPermohonanExport.php
Normal file
98
app/Exports/LaporanPermohonanExport.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LaporanPermohonanExport implements FromCollection, WithHeadings, WithMapping
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct($request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$query = Permohonan::query();
|
||||
|
||||
// Apply role-based filtering
|
||||
if (!Auth::user()->hasAnyRole(['administrator'])) {
|
||||
$query->where('branch_id', Auth::user()->branch_id);
|
||||
}
|
||||
|
||||
|
||||
// Apply date range filter if provided
|
||||
if ($this->request->has('start_date') || $this->request->has('end_date')) {
|
||||
$query->whereBetween('tanggal_permohonan', [
|
||||
$this->request->start_date ?? '1900-01-01',
|
||||
$this->request->end_date ?? now()->toDateString()
|
||||
]);
|
||||
}
|
||||
|
||||
// Apply status filter if provided
|
||||
if ($this->request->has('status') && !empty($this->request->status)) {
|
||||
$query->where('status', $this->request->status);
|
||||
}
|
||||
|
||||
// Apply branch filter if provided
|
||||
if ($this->request->has('branch_id') && !empty($this->request->branch_id)) {
|
||||
$query->where('branch_id', $this->request->branch_id);
|
||||
}
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($this->request->has('search') && !empty($this->request->search)) {
|
||||
$search = $this->request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisFasilitasKredit', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('jenisPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
// Default ordering
|
||||
$query->orderBy('nomor_registrasi', 'asc');
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public function map($permohonan): array
|
||||
{
|
||||
return [
|
||||
$permohonan->id,
|
||||
$permohonan->nomor_registrasi,
|
||||
$permohonan->tanggal_permohonan,
|
||||
$permohonan->user ? $permohonan->user->name : '',
|
||||
$permohonan->branch ? $permohonan->branch->name : '',
|
||||
$permohonan->tujuanPenilaian ? $permohonan->tujuanPenilaian->name : '',
|
||||
$permohonan->jenisFasilitasKredit ? $permohonan->jenisFasilitasKredit->name : '',
|
||||
$permohonan->jenisPenilaian ? $permohonan->jenisPenilaian->name : '',
|
||||
$permohonan->status,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nomor Registrasi',
|
||||
'Tanggal Permohonan',
|
||||
'Pemohon',
|
||||
'Cabang',
|
||||
'Tujuan Penilaian',
|
||||
'Jenis Fasilitas Kredit',
|
||||
'Jenis Penilaian',
|
||||
'Status',
|
||||
];
|
||||
}
|
||||
}
|
||||
50
app/Exports/NilaiPlafondExport.php
Normal file
50
app/Exports/NilaiPlafondExport.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
use Modules\Lpj\Models\NilaiPlafond;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class NilaiPlafondExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return NilaiPlafond::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
63
app/Exports/PenawaranTenderExport.php
Normal file
63
app/Exports/PenawaranTenderExport.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\PenawaranTender;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class PenawaranTenderExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return PenawaranTender::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->nama_kjpp_sebelumnya,
|
||||
$row->biaya_kjpp_sebelumnya,
|
||||
$row->tanggal_penilaian_sebelumnya,
|
||||
$row->nomor_registrasi,
|
||||
$row->tujuan_penilaian_kjpp_id,
|
||||
$row->jenis_laporan_id,
|
||||
$row->start_date,
|
||||
$row->end_date,
|
||||
$row->catatan,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nomor Penawaran',
|
||||
'Nama KJPP Sebelumnya',
|
||||
'Biaya KJPP Sebelumnya',
|
||||
'Tanggal Penilaian Sebelumnya',
|
||||
'Nomor Registrasi',
|
||||
'Tujuan Penilaian KJPP ID',
|
||||
'Jenis Laporan ID',
|
||||
'Start Date',
|
||||
'End Date',
|
||||
'Catatan',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
72
app/Exports/PermohonanExport.php
Normal file
72
app/Exports/PermohonanExport.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class PermohonanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Permohonan::get();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->nomor_registrasi,
|
||||
$row->tanggal_permohonan,
|
||||
$row->user->name,
|
||||
$row->branch->name,
|
||||
$row->tujuanPenilaian->name,
|
||||
$row->debiture->name,
|
||||
$row->jenisFasilitasKredit->name,
|
||||
$row->nilaiPlafond->name,
|
||||
$row->status,
|
||||
$row->authorized_at,
|
||||
$row->authorized_status,
|
||||
$row->authorized_by,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nomor Registrasi',
|
||||
'Tanggal Permohonan',
|
||||
'User Pemohon',
|
||||
'Branch Pemohon',
|
||||
'Tujuan Penilaian',
|
||||
'Debitur',
|
||||
'Jenis Fasilitas Kredit',
|
||||
'Nilai Plafond',
|
||||
'Status Permohonan',
|
||||
'Tanggal Pengesahan',
|
||||
'Status Pengesahan',
|
||||
'Pengesah',
|
||||
'Tanggal Dibuat'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'K' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'N' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/RegionExport.php
Normal file
49
app/Exports/RegionExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\Regions;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class RegionExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Regions::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
53
app/Exports/StatusPermohonanExport.php
Normal file
53
app/Exports/StatusPermohonanExport.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\StatusPermohonan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class StatusPermohonanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return StatusPermohonan::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->name,
|
||||
$row->slug,
|
||||
$row->description,
|
||||
$row->status,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Name',
|
||||
'Slug',
|
||||
'Description',
|
||||
'Status',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'F' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
57
app/Exports/TeamPenilaianExport.php
Normal file
57
app/Exports/TeamPenilaianExport.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\JenisPenilaian;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
|
||||
class TeamPenilaianExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Teams::select(
|
||||
'teams.id as id',
|
||||
'teams.name as team_name',
|
||||
'regions.name as region_name',
|
||||
DB::raw('STRING_AGG(users.name, \', \') as team_group')
|
||||
)
|
||||
->join('regions', 'teams.regions_id', '=', 'regions.id')
|
||||
->leftJoin('teams_users', 'teams.id', '=', 'teams_users.teams_id')
|
||||
->leftJoin('users', 'teams_users.user_id', '=', 'users.id')
|
||||
->groupBy('teams.id', 'teams.name', 'regions.name')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->team_name,
|
||||
$row->region_name,
|
||||
$row->team_group,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Name',
|
||||
'Region',
|
||||
'Anggota Team',
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_TEXT,
|
||||
'B' => NumberFormat::FORMAT_TEXT,
|
||||
'C' => NumberFormat::FORMAT_TEXT,
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/TujuanPenilaianExport.php
Normal file
49
app/Exports/TujuanPenilaianExport.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\TujuanPenilaian;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class TujuanPenilaianExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return TujuanPenilaian::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/TujuanPenilaianKJPPExport.php
Normal file
46
app/Exports/TujuanPenilaianKJPPExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Modules\Lpj\Models\TujuanPenilaianKJPP;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class TujuanPenilaianKJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return TujuanPenilaianKJPP::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user