/**
  * @param null|TblItem $tblItem
  */
 public function setTblItem(TblItem $tblItem = null)
 {
     $this->tblItem = null === $tblItem ? null : $tblItem->getId();
 }
Example #2
0
 /**
  * @param TblItem    $tblItem
  * @param TblAccount $tblAccount
  *
  * @return TblItemAccount|null
  */
 public function actionAddItemAccount(TblItem $tblItem, TblAccount $tblAccount)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblItemAccount')->findOneBy(array(TblItemAccount::ATTR_TBL_Item => $tblItem->getId(), TblItemAccount::ATTR_SERVICE_BILLING_ACCOUNT => $tblAccount->getId()));
     if (null === $Entity) {
         $Entity = new TblItemAccount();
         $Entity->setTblItem($tblItem);
         $Entity->setTblAccount($tblAccount);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }
Example #3
0
 /**
  * @param TblCommodity  $tblCommodity
  * @param TblItem       $tblItem
  * @param TblBasket     $tblBasket
  * @param TblBasketItem $tblBasketItem
  * @param TblInvoice    $tblInvoice
  */
 private function actionCreateInvoiceItem(TblCommodity $tblCommodity, TblItem $tblItem, TblBasket $tblBasket, TblBasketItem $tblBasketItem, TblInvoice $tblInvoice)
 {
     $Entity = new TblInvoiceItem();
     $Entity->setCommodityName($tblCommodity->getName());
     $Entity->setCommodityDescription($tblCommodity->getDescription());
     $Entity->setItemName($tblItem->getName());
     $Entity->setItemDescription($tblItem->getDescription());
     if ($tblCommodity->getTblCommodityType()->getName() == 'Einzelleistung') {
         $Entity->setItemPrice($tblBasketItem->getPrice());
     } else {
         $Entity->setItemPrice($tblBasketItem->getPrice() / Basket::useService()->countPersonByBasket($tblBasket));
     }
     $Entity->setItemQuantity($tblBasketItem->getQuantity());
     $Entity->setTblInvoice($tblInvoice);
     $this->Connection->getEntityManager()->saveEntity($Entity);
     Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     $tblItemAccountList = Commodity::useService()->entityItemAccountAllByItem($tblItem);
     /** @var TblItemAccount $tblItemAccount */
     foreach ($tblItemAccountList as $tblItemAccount) {
         $EntityItemAccount = new TblInvoiceAccount();
         $EntityItemAccount->setTblInvoiceItem($Entity);
         $EntityItemAccount->setServiceBilling_Account($tblItemAccount->getServiceBilling_Account());
         $this->Connection->getEntityManager()->saveEntity($EntityItemAccount);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $EntityItemAccount);
     }
 }
Example #4
0
 /**
  * @param Entity\TblCommodity $tblCommodity
  * @param TblItem             $tblItem
  * @param                     $Quantity
  *
  * @return bool
  */
 public function actionAddCommodityItem(TblCommodity $tblCommodity, TblItem $tblItem, $Quantity)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblCommodityItem')->findOneBy(array(TblCommodityItem::ATTR_TBL_COMMODITY => $tblCommodity->getId(), TblCommodityItem::ATTR_TBL_ITEM => $tblItem->getId()));
     if (null === $Entity) {
         $Entity = new TblCommodityItem();
         $Entity->setTblCommodity($tblCommodity);
         $Entity->setTblItem($tblItem);
         $Entity->setQuantity(str_replace(',', '.', $Quantity));
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }