public function TypeName() { $account = Acctype::findOne(['id' => $this->type_id]); if ($account == null) { return \Yii::t('app', 'NA'); } return $account->name; }
public function getName($id) { $model = Acctype::findOne(['id' => $id]); if ($model == NULL) { return 'ERROR'; } else { return Yii::t('app', $model->desc); } }
public function calcPay() { $this->step = 1; $this->dates(); $this->income_sum = Acctype::findOne(3)->getTotal($this->from_date, $this->to_date); $this->tax_rate = \app\helpers\Linet3Helper::getSetting('company.tax.rate'); //$tax $this->tax_sum = $this->income_sum * ($this->tax_rate / 100); $this->custtax_acc = \app\helpers\Linet3Helper::getSetting('company.acc.custtax'); $this->custtax_sum = Accounts::findOne($this->custtax_acc)->getTotal($this->from_date, $this->to_date); //*-1 $this->custtax_total = Accounts::findOne($this->custtax_acc)->getTotal(0, $this->to_date); if ($this->custtax_total > $this->tax_sum) { $this->custtax_total = $this->tax_sum; } $this->tax_total = $this->tax_sum + $this->custtax_total; return $this->tax_total; }