Fix Komisi

This commit is contained in:
R
2023-04-06 06:49:04 +07:00
parent 97486da90f
commit 3ff0cc1b29
5 changed files with 65 additions and 2 deletions

View File

@@ -115,6 +115,32 @@ class Appointment extends Model
);
}
protected function shareKonsultasi(): Attribute
{
return Attribute::make(
get: function() {
return ((float) $this->detail->sPaymentDetails['gross_amount'] ?? 0) - $this->nAdminFee;
}
);
}
protected function shareKomisi(): Attribute
{
return Attribute::make(
get: function() {
// return $this->healthCare->commission;
if ( $this->nIDJenisBooking == 3 ) { // Telekonsultasi Sekarang
return $this->shareKonsultasi * ($this->healthCare->commission->nCommissionATC) / 100;
}
else if ( $this->nIDJenisBooking == 2 ) { // Telekonsultasi
return $this->shareKonsultasi * ($this->healthCare->commission->nCommissionTC) / 100;
}
else { // Walk In
return $this->shareKonsultasi * ($this->nCommission) / 100;
}
}
);
}
public function appointmentDetail()
{