Add ContractForm, Add contract pdf, Add Display all Transfer option
This commit is contained in:
@@ -88,6 +88,9 @@ class Contract extends \yii\db\ActiveRecord
|
||||
public function getTicketType(){
|
||||
return $this->hasOne(TicketType::className(), ['id_ticket_type' => 'id_ticket_type']);
|
||||
}
|
||||
public function getTicket(){
|
||||
return $this->hasOne(Ticket::className(), ['id_contract' => 'id_contract']);
|
||||
}
|
||||
|
||||
public function getCustomer(){
|
||||
return $this->hasOne(Customer::className(), ['id_customer' => 'id_customer']);
|
||||
@@ -179,4 +182,20 @@ class Contract extends \yii\db\ActiveRecord
|
||||
public function isFlagActive() {
|
||||
return $this->flag == static::$FLAG_ACTIVE;
|
||||
}
|
||||
|
||||
public function getPriceMonthly(){
|
||||
return $this->ticket->price_brutto;
|
||||
}
|
||||
|
||||
public function getPartsTotal(){
|
||||
$money = $this->getPriceMonthly();
|
||||
$money = $money * $this->part_count;
|
||||
return $money;
|
||||
}
|
||||
|
||||
public function getPriceTotal(){
|
||||
$money = $this->getPartsTotal();
|
||||
$money = $money + $this->getPriceMonthly();
|
||||
return $money;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user