/**
  * @return bool|TblItem
  */
 public function getTblItem()
 {
     if (null === $this->tblItem) {
         return false;
     } else {
         return Item::useService()->entityItemById($this->tblItem);
     }
 }
Example #2
0
 /**
  * @param $Id
  * @param $Item
  *
  * @return Stage
  */
 public function frontendItemEdit($Id, $Item)
 {
     $Stage = new Stage();
     $Stage->setTitle('Artikel');
     $Stage->setDescription('Bearbeiten');
     $Stage->setMessage('<b>Hinweis:</b> <br>
         Ist ein Bildungsgang unter der <i>Bedingung Bildungsgang</i> ausgewählt, wird der Artikel nur für
         Personen (Schüler) berechnet welche diesem Bildungsgang angehören. <br>
         Ist eine Kind-Reihenfolge unter der <i>Bedingung Kind-Reihenfolge</i> ausgewählt, wird der Artikel nur für
         Personen (Schüler) berechnet welche dieser Kind-Reihenfolge entsprechen. <br>
         Beide Bedingungen können einzeln ausgewählt werden, bei der Wahl beider Bedingungen werden diese
         <b>Und</b> verknüpft.
     ');
     $Stage->addButton(new Primary('Zurück', '/Billing/Inventory//Item', new ChevronLeft()));
     //        $tblCourseAll = Management::serviceCourse()->entityCourseAll();   //todo
     //        array_unshift( $tblCourseAll, new TblCourse( '' ) );
     //        $tblChildRankAll = Management::serviceStudent()->entityChildRankAll();
     //        array_unshift( $tblChildRankAll, new TblChildRank( '' ) );
     if (empty($Id)) {
         $Stage->setContent(new Warning('Die Daten konnten nicht abgerufen werden'));
     } else {
         $tblItem = Item::useService()->entityItemById($Id);
         if (empty($tblItem)) {
             $Stage->setContent(new Warning('Der Artikel konnte nicht abgerufen werden'));
         } else {
             $Global = $this->getGlobal();
             if (!isset($Global->POST['Item'])) {
                 $Global->POST['Item']['Name'] = $tblItem->getName();
                 $Global->POST['Item']['Description'] = $tblItem->getDescription();
                 $Global->POST['Item']['Price'] = str_replace('.', ',', $tblItem->getPrice());
                 $Global->POST['Item']['CostUnit'] = $tblItem->getCostUnit();
                 //                    if ( $tblItem->getServiceManagementCourse() ) {
                 //                        $Global->POST['Item']['Course'] = $tblItem->getServiceManagementCourse()->getId();
                 //                    }
                 //                    if ( $tblItem->getServiceManagementStudentChildRank() ) {
                 //                        $Global->POST['Item']['ChildRank'] = $tblItem->getServiceManagementStudentChildRank()->getId();
                 //                    }
                 $Global->savePost();
             }
             $Stage->setContent(Item::useService()->executeEditItem(new Form(array(new FormGroup(array(new FormRow(array(new FormColumn(new TextField('Item[Name]', 'Name', 'Name', new Conversation()), 6), new FormColumn(new TextField('Item[Price]', 'Preis in €', 'Preis', new MoneyEuro()), 6))), new FormRow(array(new FormColumn(new TextField('Item[CostUnit]', 'Kostenstelle', 'Kostenstelle', new Money()), 6))), new FormRow(array(new FormColumn(new TextField('Item[Description]', 'Beschreibung', 'Beschreibung', new Conversation()), 12)))))), new \SPHERE\Common\Frontend\Form\Repository\Button\Primary('Änderungen speichern')), $tblItem, $Item));
         }
     }
     return $Stage;
 }
Example #3
0
 /**
  * @param $tblItemId
  * @param $tblAccountId
  *
  * @return Stage
  */
 public function frontendItemAccountAdd($tblItemId, $tblAccountId)
 {
     $Stage = new Stage();
     $Stage->setTitle('Artikel');
     $Stage->setDescription('FIBU-Konto Hinzufügen');
     $tblItem = Item::useService()->entityItemById($tblItemId);
     $tblAccount = Account::useService()->entityAccountById($tblAccountId);
     if (!empty($tblItemId) && !empty($tblAccountId)) {
         $Stage->setContent(Item::useService()->executeAddItemAccount($tblItem, $tblAccount));
     }
     return $Stage;
 }
Example #4
0
 /**
  * @param TblItem $tblItem
  *
  * @return TblAccount[]
  */
 public function entityAccountAllByItem(TblItem $tblItem)
 {
     $tblItemAccountAllByItem = Item::useService()->entityItemAccountAllByItem($tblItem);
     $tblAccount = array();
     foreach ($tblItemAccountAllByItem as $tblItemAccount) {
         array_push($tblAccount, $tblItemAccount->getServiceBilling_Account());
     }
     return $tblAccount;
 }