* @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $ */ class InvoiceItem extends BaseInvoiceItem { /** * Cena celkem bez DPH * * @return integer */ public function getPriceAll() { return $this->getPriceOne() * $this->getAmount(); } /** * Cena celkem včetně DPH * * @return integer */ public function getPrice() { return $this->getPriceAll() + ($this->getPriceAll() * ($this->getDph() / 100)); } /** * Aktivuje vázané položky */ public function activateBounds() { if(!is_null($this->getJobId())) { $job = $this->getJob(); $job->setIsActive(true); $job->save(); } if(!is_null($this->getTopjobId())) { $topjob = $this->getTopJob(); $topjob->activate(); $topjob->save(); } if(!is_null($this->getBannerId())) { $banner = $this->getBanner(); $banner->setIsActive(true); $banner->save(); } if(!is_null($this->getProfileId())) { $profile = $this->getProfile(); if($profile->isPrepaymentCountRequester() || $profile->isPrepaymentRowsRequester()) { foreach($profile->getPrepaymentCounts() as $pc) { $pc->authorizeRequest(); $pc->save(); } $profile->setPrepaymentActive(true); $profile->save(); } // if($profile->isPrepaymentRequester()) // { // $profile->setPrepaymentActive(true); // $profile->save(); // } } } /** * Deaktivuje vázané položky */ public function deactivateBounds() { if(!is_null($this->getJobId())) { $job = $this->getJob(); $job->setIsActive(false); $job->save(); } if(!is_null($this->getTopjobId())) { $topjob = $this->getTopJob(); $topjob->deactivate(); $topjob->save(); } if(!is_null($this->getBannerId())) { $banner = $this->getBanner(); $banner->setIsActive(false); $banner->save(); } if(!is_null($this->getProfileId())) { $profile = $this->getProfile(); $profile->setPrepaymentActive(false); $profile->save(); } } /** * Nastaví vývhozí hodnoty z nastavení aplikace */ public function setDefaultValues() { $this->setDph(saSettings::get('invoice_dph', 0)); } }