Merge remote-tracking branch 'origin/master' into feature/client-portal
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -90,12 +115,52 @@ class Appointment extends Model
|
||||
);
|
||||
}
|
||||
|
||||
protected function shareKonsultasi(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function() {
|
||||
$consulPrice = ((float) $this->detail->sPaymentDetails['gross_amount'] ?? 0) - $this->nAdminFee;
|
||||
if ( $this->nIDJenisBooking == 3 ) { // Telekonsultasi Sekarang
|
||||
return $consulPrice * (100-$this->healthCare->commission->nCommissionATC) / 100;
|
||||
}
|
||||
else if ( $this->nIDJenisBooking == 2 ) { // Telekonsultasi
|
||||
return $consulPrice * (100-$this->healthCare->commission->nCommissionTC) / 100;
|
||||
}
|
||||
else { // Walk In
|
||||
return $consulPrice * (100-$this->healthCare->commission->nCommission) / 100;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
protected function shareKomisi(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function() {
|
||||
$consulPrice = ((float) $this->detail->sPaymentDetails['gross_amount'] ?? 0) - $this->nAdminFee;
|
||||
if ( $this->nIDJenisBooking == 3 ) { // Telekonsultasi Sekarang
|
||||
return $consulPrice * ($this->healthCare->commission->nCommissionATC) / 100;
|
||||
}
|
||||
else if ( $this->nIDJenisBooking == 2 ) { // Telekonsultasi
|
||||
return $consulPrice * ($this->healthCare->commission->nCommissionTC) / 100;
|
||||
}
|
||||
else { // Walk In
|
||||
return $consulPrice * ($this->healthCare->commission->nCommission) / 100;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function appointmentDetail()
|
||||
{
|
||||
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');
|
||||
|
||||
@@ -20,6 +20,11 @@ class Healthcare extends Model
|
||||
|
||||
protected $primaryKey = 'nID';
|
||||
|
||||
public function commission()
|
||||
{
|
||||
return $this->hasOne(HealthcareCommission::class, 'nIDHealthcare', 'nID')->where('sStatus', 1);
|
||||
}
|
||||
|
||||
public function jadwalDokter()
|
||||
{
|
||||
return $this->hasMany(JadwalDokter::class, 'nIDHealthCare', 'nID');
|
||||
|
||||
27
app/Models/OLDLMS/HealthcareCommission.php
Normal file
27
app/Models/OLDLMS/HealthcareCommission.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\OLDLMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class HealthcareCommission extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
const CREATED_AT = 'dCreateOn';
|
||||
const UPDATED_AT = 'dUpdateOn';
|
||||
const DELETED_AT = 'dDeleteOn';
|
||||
|
||||
protected $connection = 'oldlms';
|
||||
|
||||
protected $table = 'tx_healthcare_commission';
|
||||
|
||||
protected $primaryKey = 'nID';
|
||||
|
||||
public function healthcare()
|
||||
{
|
||||
return $this->belongsTo(Healthcare::class, 'nIDHealthcare', 'nID');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user