diff --git a/app/Models/OLDLMS/Appointment.php b/app/Models/OLDLMS/Appointment.php index 70011769..32801ab7 100644 --- a/app/Models/OLDLMS/Appointment.php +++ b/app/Models/OLDLMS/Appointment.php @@ -119,7 +119,16 @@ class Appointment extends Model { return Attribute::make( 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( get: function() { - // return $this->healthCare->commission; + $consulPrice = ((float) $this->detail->sPaymentDetails['gross_amount'] ?? 0) - $this->nAdminFee; 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 - return $this->shareKonsultasi * ($this->healthCare->commission->nCommissionTC) / 100; + return $consulPrice * ($this->healthCare->commission->nCommissionTC) / 100; } else { // Walk In - return $this->shareKonsultasi * ($this->nCommission) / 100; + return $consulPrice * ($this->healthCare->commission->nCommission) / 100; } } );