Fix Commision

This commit is contained in:
R
2023-04-06 07:32:47 +07:00
parent 3ff0cc1b29
commit 7d198583a4

View File

@@ -119,7 +119,16 @@ class Appointment extends Model
{ {
return Attribute::make( return Attribute::make(
get: function() { get: function() {
return ((float) $this->detail->sPaymentDetails['gross_amount'] ?? 0) - $this->nAdminFee; $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;
}
} }
); );
} }
@@ -128,15 +137,15 @@ class Appointment extends Model
{ {
return Attribute::make( return Attribute::make(
get: function() { get: function() {
// return $this->healthCare->commission; $consulPrice = ((float) $this->detail->sPaymentDetails['gross_amount'] ?? 0) - $this->nAdminFee;
if ( $this->nIDJenisBooking == 3 ) { // Telekonsultasi Sekarang if ( $this->nIDJenisBooking == 3 ) { // Telekonsultasi Sekarang
return $this->shareKonsultasi * ($this->healthCare->commission->nCommissionATC) / 100; return $consulPrice * ($this->healthCare->commission->nCommissionATC) / 100;
} }
else if ( $this->nIDJenisBooking == 2 ) { // Telekonsultasi else if ( $this->nIDJenisBooking == 2 ) { // Telekonsultasi
return $this->shareKonsultasi * ($this->healthCare->commission->nCommissionTC) / 100; return $consulPrice * ($this->healthCare->commission->nCommissionTC) / 100;
} }
else { // Walk In else { // Walk In
return $this->shareKonsultasi * ($this->nCommission) / 100; return $consulPrice * ($this->healthCare->commission->nCommission) / 100;
} }
} }
); );