Example #1
0
 private function ini()
 {
     if ($this->valuedate == null) {
         $this->valuedate = Record::writeDate(time());
     }
     if (!$this->ini) {
         $this->_precision = Yii::$app->params['precision'];
         $item = Item::findByPk($this->item_id, $this->valuedate);
         if (is_null($item)) {
             $this->iVatRate = 0;
         } else {
             $this->iVatRate = $item->vat;
         }
         //for vat resons...
         //if ($this->rate == 0) {
         $this->rate = Currates::GetRate($this->currency_id, $this->valuedate);
         //}
         if ($this->doc_rate == 0) {
             $doc = Docs::findOne($this->doc_id);
             $this->doc_rate = Currates::GetRate($doc->currency_id, $this->valuedate);
         }
         $this->ini != $this->ini;
     }
 }