/**
  * @return bool|TblInvoiceItem
  */
 public function getTblInvoiceItem()
 {
     if (null === $this->tblInvoiceItem) {
         return false;
     } else {
         return Basket::useService()->entityBasketItemById($this->tblInvoiceItem);
     }
 }
 /**
  * @return bool|TblBasket
  */
 public function getServiceBillingBasket()
 {
     if (null === $this->serviceBilling_Basket) {
         return false;
     } else {
         return Basket::useService()->entityBasketById($this->serviceBilling_Basket);
     }
 }
 /**
  * @return bool|TblBasket
  */
 public function getTblBasket()
 {
     if (null === $this->tblBasket) {
         return false;
     } else {
         return Basket::useService()->entityBasketById($this->tblBasket);
     }
 }
示例#4
0
 /**
  * @param IFormInterface $Stage
  * @param                $Id
  * @param                $Date
  * @param                $Data
  * @param                $Save
  *
  * @return IFormInterface|string
  */
 public function executeCheckDebtors(IFormInterface &$Stage = null, $Id, $Date, $Data, $Save)
 {
     /**
      * Skip to Frontend
      */
     if (null === $Data && null === $Save) {
         return $Stage;
     }
     $isSave = $Save == 2;
     $tblBasket = Basket::useService()->entityBasketById($Id);
     if ((new Data($this->Binding))->checkDebtors($tblBasket, $Data, $isSave)) {
         if (Invoice::useService()->executeCreateInvoiceListFromBasket($tblBasket, $Date)) {
             $Stage .= new Success('Die Rechnungen wurden erfolgreich erstellt') . new Redirect('/Billing/Bookkeeping/Invoice/IsNotConfirmed', 2);
         } else {
             $Stage .= new Success('Die Rechnungen konnten nicht erstellt werden') . new Redirect('/Billing/Accounting/Basket', 2);
         }
     }
     return $Stage;
 }
示例#5
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);
     }
 }
示例#6
0
 /**
  * @param $Id
  * @param $Date
  * @param $Data
  * @param $Save
  *
  * @return Stage
  */
 public function frontendBasketDebtorSelect($Id, $Date, $Data, $Save)
 {
     $Stage = new Stage();
     $Stage->setTitle('Warenkorb');
     $Stage->setDescription('Debitoren zuordnen');
     $Stage->setMessage('Es konnten im Warenkorb nicht zu alle Personen bei allen Leistungen eindeutig ein Debitor
         ermittelt werden. Es werden alle nicht automatisch zuordenbaren Kombinationen von Personen und Leistungen
         angezeigt. Bitte weisen Sie die entsprechenden Debitoren zu');
     $Global = $this->getGlobal();
     if (!isset($Global->POST['Save'])) {
         $Global->POST['Save'] = 1;
     }
     $Global->savePost();
     $tblBasket = Basket::useService()->entityBasketById($Id);
     $tblBasketCommodityList = Basket::useService()->entityBasketCommodityAllByBasket($tblBasket);
     /**@var TblBasketCommodity $tblBasketCommodity */
     array_walk($tblBasketCommodityList, function (TblBasketCommodity $tblBasketCommodity) {
         $tblBasketCommodityDebtorList = Basket::useService()->entityBasketCommodityDebtorAllByBasketCommodity($tblBasketCommodity);
         $tblBasketCommodity->Name = $tblBasketCommodity->getServiceManagementPerson()->getFullName();
         $tblBasketCommodity->Commodity = $tblBasketCommodity->getServiceBillingCommodity()->getName();
         $tblBasketCommodity->Select = new SelectBox('Data[' . $tblBasketCommodity->getId() . ']', '', array('{{ ServiceBillingDebtor.DebtorNumber }}' . ' - {{ ServiceBillingDebtor.ServiceManagementPerson.FullName }}' . '{% if( ServiceBillingDebtor.Description is not empty) %} - {{ ServiceBillingDebtor.Description }}{% endif %}' => $tblBasketCommodityDebtorList));
     });
     $Stage->setContent(new Layout(array(new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(new Panel('Warenkorb - Nummer', $tblBasket->getId(), Panel::PANEL_TYPE_SUCCESS), 3), new LayoutColumn(new Panel('Warenkorb - Name', $tblBasket->getName(), Panel::PANEL_TYPE_SUCCESS), 6), new LayoutColumn(new Panel('Erstellt am', $tblBasket->getCreateDate(), Panel::PANEL_TYPE_SUCCESS), 3))))), new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(Basket::useService()->executeCheckDebtors(new Form(new FormGroup(array(new FormRow(new FormColumn(new TableData($tblBasketCommodityList, null, array('Name' => 'Person', 'Commodity' => 'Leistung', 'Select' => 'Debitorennummer - Debitor - Beschreibung'), false))), new FormRow(array(new FormColumn(new SelectBox('Save', '', array(1 => 'Nicht speichern', 2 => 'Als Standard speichern')), 3), new FormColumn(new \SPHERE\Common\Frontend\Form\Repository\Button\Primary('Debitoren zuordnen (prüfen)'), 3)))))), $Id, $Date, $Data, $Save)))))))));
     return $Stage;
 }
示例#7
0
 /**
  * @param TblCommodity $tblCommodity
  * @param TblBasket    $tblBasket
  *
  * @return TblBasket
  */
 public function actionDestroyBasketItemsByCommodity(TblBasket $tblBasket, TblCommodity $tblCommodity)
 {
     $Manager = $this->Connection->getEntityManager();
     $tblBasketItemAllByBasket = Basket::useService()->entityBasketItemAllByBasket($tblBasket);
     /** @var TblBasketItem $tblBasketItem */
     foreach ($tblBasketItemAllByBasket as $tblBasketItem) {
         if ($tblBasketItem->getServiceBillingCommodityItem()->getTblCommodity()->getId() == $tblCommodity->getId()) {
             $Entity = $Manager->getEntity('TblBasketItem')->findOneBy(array('Id' => $tblBasketItem->getId()));
             /**@var Element $Entity */
             Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $Entity);
             $Manager->bulkKillEntity($Entity);
         }
     }
     $Manager->flushCache();
     return $tblBasket;
 }