Add ContractForm, Add contract pdf, Add Display all Transfer option

This commit is contained in:
2016-02-21 21:41:25 +01:00
parent 462e93c740
commit 29a8b440b2
33 changed files with 1417 additions and 304 deletions

View File

@@ -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;
}
}