[WIP] Add Linksehat Payment Report

This commit is contained in:
R
2023-04-06 05:03:38 +07:00
parent 59e7394d13
commit cca2310f54
20 changed files with 1786 additions and 46 deletions

View File

@@ -124,24 +124,7 @@ class Member extends Model
public function currentCorporate()
{
// return $this->belongsToMany(Corporate::class, 'corporate_employees', 'corporate_id', 'member_id')
// // ->withPivot([
// // 'branch_code',
// // 'divison_id',
// // 'nik',
// // 'status',
// // 'start',
// // 'end'
// // ])
// ->where('start', '<', now())
// ->where('end', '>', now());
return $this->hasOneThrough(Corporate::class, CorporateEmployee::class, 'member_id', 'id', 'id', 'corporate_id');
// ->where('corporate_policies.start', '<', now())
// ->where('corporate_policies.end', '>', now())
// ->where('member_policies.start', '<', now())
// ->where('member_policies.end', '>', now());
}
public function memberPlans()

View File

@@ -31,6 +31,20 @@ class Appointment extends Model
5 => 'Voucher',
];
public $sPaymentStatusName = [
'settlement' => 'Diterima',
'expired' => 'Kadaluarsa',
'capture' => 'Captured',
'deny' => 'Ditolak',
'pending' => 'Menunggu Pembayaran',
'cancel' => 'Dibatalkan',
'refund' => 'Dikembalikan',
'expire' => 'Kadaluarsa',
'cod' => 'COD',
'FAILED' => 'Gagal',
'COMPLETED' => 'Complete',
];
public $nIDJenisBookingNames = [
1 => 'Rawat Jalan',
2 => 'Telekonsultasi',
@@ -60,7 +74,8 @@ class Appointment extends Model
protected $appends = [
'status_name',
'payment_method',
'type'
'type',
'payment_status'
];
protected function statusName(): Attribute
@@ -71,6 +86,16 @@ class Appointment extends Model
},
);
}
protected function paymentStatus(): Attribute
{
return Attribute::make(
get: function ($value) {
return $this->sPaymentStatusName[$this->sPaymentStatus] ?? $this->sPaymentStatus;
},
);
}
protected function paymentMethod(): Attribute
{
@@ -96,6 +121,11 @@ class Appointment extends Model
return $this->hasOne(AppointmentDetail::class, 'nIDAppointment', 'nID');
}
public function detail()
{
return $this->hasOne(AppointmentDetail::class, 'nIDAppointment', 'nID');
}
public function doctor()
{
return $this->belongsTo(Dokter::class, 'nIDDokter', 'nID');