/** * @param OefPurchase $purchase * @param OefFundCertificate $condition */ public function initialize($purchase, $condition) { $this->purchase_id = $purchase->id; $this->purchase_date = DateTimeUtils::getDateFromDB($purchase->purchase_date); $this->purchase_type = $purchase->purchase_type; $this->sellable_certificate = $purchase->found_stock - $purchase->found_stock_sold; $this->sell_date = $condition->sell_date_obj; $sellCertificate = $condition->sell_certificate - $condition->sum_sell_certificate; $this->sell_certificate = $sellCertificate < $this->sellable_certificate ? $sellCertificate : $this->sellable_certificate; $this->investment = $this->sell_certificate * ($purchase->purchase + $purchase->transfer_fee + $purchase->other_fee) / $purchase->found_stock; $this->revenue = $this->sell_certificate * $condition->nav; $this->kept_months = DateTimeUtils::diffMonths($this->purchase_date, $this->sell_date); $this->income_tax_rate = $condition->income_tax_rate; $this->calculate(); }
/** * @param OefPurchase $purchase * @param OefFundCertificate $condition */ public function initialize($purchase, $condition) { $this->sip_date = DateTimeUtils::getDateFromDB($purchase->sip_date); $this->sip_months = DateTimeUtils::diffMonths($this->sip_date, $condition->sell_date_obj); parent::initialize($purchase, $condition); }