コード例 #1
0
 /**
  * @return Stage
  */
 public function frontendItemStatus()
 {
     $Stage = new Stage();
     $Stage->setTitle('Artikel');
     $Stage->setDescription('Übersicht');
     // ToDo
     $Stage->setMessage('Zeigt alle verfügbaren Artikel an. <br>
         Artikel sind Preise für erbrachte Dienste, die Abhängigkeiten zugewiesen bekommen können. <br />
         Somit werden bei Rechnungen nur die Artikel berechnet, <br />
         die <b>keine</b> oder die <b>zutreffenden</b> Abhängigkeiten für die einzelne Person besitzen.');
     $Stage->addButton(new Primary('Artikel anlegen', '/Billing/Inventory/Item/Create', new Plus()));
     $tblItemAll = Item::useService()->entityItemAll();
     if (!empty($tblItemAll)) {
         array_walk($tblItemAll, function (TblItem $tblItem) {
             $tblItem->PriceString = $tblItem->getPriceString();
             if (Commodity::useService()->entityCommodityItemAllByItem($tblItem)) {
                 $tblItem->Option = (new Primary('Bearbeiten', '/Billing/Inventory/Item/Edit', new Edit(), array('Id' => $tblItem->getId())))->__toString() . (new Primary('FIBU-Konten auswählen', '/Billing/Inventory/Item/Account/Select', new Listing(), array('Id' => $tblItem->getId())))->__toString();
             } else {
                 $tblItem->Option = (new Primary('Bearbeiten', '/Billing/Inventory/Item/Edit', new Edit(), array('Id' => $tblItem->getId())))->__toString() . (new Primary('FIBU-Konten auswählen', '/Billing/Inventory/Item/Account/Select', new Listing(), array('Id' => $tblItem->getId())))->__toString() . (new Danger('Löschen', '/Billing/Inventory/Item/Delete', new Remove(), array('Id' => $tblItem->getId())))->__toString();
             }
         });
     }
     $Stage->setContent(new TableData($tblItemAll, null, array('Name' => 'Name', 'Description' => 'Beschreibung', 'PriceString' => 'Preis', 'Option' => 'Option')));
     return $Stage;
 }
コード例 #2
0
 /**
  * @return bool|TblCommodityType
  */
 public function getTblCommodityType()
 {
     if (null === $this->tblCommodityType) {
         return false;
     } else {
         return Commodity::useService()->entityCommodityTypeById($this->tblCommodityType);
     }
 }
コード例 #3
0
 /**
  * @return bool|TblItem
  */
 public function getTblItem()
 {
     if (null === $this->tblItem) {
         return false;
     } else {
         return Commodity::useService()->entityItemById($this->tblItem);
     }
 }
コード例 #4
0
 /**
  * @return bool|TblCommodity
  */
 public function getServiceBillingCommodity()
 {
     if (null === $this->serviceBilling_Commodity) {
         return false;
     } else {
         return Commodity::useService()->entityCommodityById($this->serviceBilling_Commodity);
     }
 }
コード例 #5
0
 public static function registerApplication()
 {
     /**
      * Register Module
      */
     Commodity::registerModule();
     Item::registerModule();
     Main::getDisplay()->addApplicationNavigation(new Link(new Link\Route(__NAMESPACE__), new Link\Name('Inventar')));
     Main::getDisplay()->addModuleNavigation(new Link(new Link\Route(__NAMESPACE__ . '/Commodity'), new Link\Name('Leistungen')));
     Main::getDisplay()->addModuleNavigation(new Link(new Link\Route(__NAMESPACE__ . '/Item'), new Link\Name('Artikel')));
     Main::getDispatcher()->registerRoute(Main::getDispatcher()->createRoute(__NAMESPACE__ . '/Inventory', __CLASS__ . '::frontendWelcome'));
 }
コード例 #6
0
ファイル: Data.php プロジェクト: BozzaCoon/SPHERE-Framework
 /**
  * @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);
     }
 }
コード例 #7
0
ファイル: Data.php プロジェクト: BozzaCoon/SPHERE-Framework
 /**
  * @param TblItem $tblItem
  *
  * @return bool
  */
 public function actionDestroyItem(TblItem $tblItem)
 {
     $Manager = $this->Connection->getEntityManager();
     //        $EntityList = $Manager->getEntity( 'TblCommodityItem' )->findBy( array( TblCommodityItem::ATTR_TBL_ITEM => $tblItem->getId() ) ); //todo
     $EntityList = Commodity::useService()->entityCommodityItemAllByItem($tblItem);
     if (empty($EntityList)) {
         $EntityItems = $Manager->getEntity('TblItemAccount')->findBy(array(TblItemAccount::ATTR_TBL_Item => $tblItem->getId()));
         if (null !== $EntityItems) {
             foreach ($EntityItems as $Entity) {
                 Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $Entity);
                 $Manager->killEntity($Entity);
             }
         }
         $Entity = $Manager->getEntity('TblItem')->findOneBy(array('Id' => $tblItem->getId()));
         if (null !== $Entity) {
             /** @var Element $Entity */
             Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $Entity);
             $Manager->killEntity($Entity);
             return true;
         }
     }
     return false;
 }
コード例 #8
0
 /**
  * @param $Id
  *
  * @return Stage
  */
 public function frontendItemRemove($Id)
 {
     $Stage = new Stage();
     $Stage->setTitle('Leistung');
     $Stage->setDescription('Artikel Entfernen');
     $tblCommodityItem = Commodity::useService()->entityCommodityItemById($Id);
     if (!empty($tblCommodityItem)) {
         $Stage->setContent(Commodity::useService()->executeRemoveCommodityItem($tblCommodityItem));
     }
     return $Stage;
 }
コード例 #9
0
 /**
  * @param $Id
  *
  * @return Stage
  */
 public function frontendInvoiceShow($Id)
 {
     $Stage = new Stage();
     $Stage->setTitle('Rechnung');
     $Stage->setDescription('Anzeigen');
     $Stage->addButton(new Primary('Zurück', '/Billing/Bookkeeping/Invoice', new ChevronLeft()));
     $tblInvoice = Invoice::useService()->entityInvoiceById($Id);
     if ($tblInvoice->getIsVoid()) {
         $Stage->setMessage(new \SPHERE\Common\Frontend\Message\Repository\Danger("Diese Rechnung wurde storniert"));
     }
     $tblInvoiceItemAll = Invoice::useService()->entityInvoiceItemAllByInvoice($tblInvoice);
     if (!empty($tblInvoiceItemAll)) {
         array_walk($tblInvoiceItemAll, function (TblInvoiceItem &$tblInvoiceItem, $index, TblInvoice $tblInvoice) {
             if ($tblInvoice->getServiceBillingBankingPaymentType()->getId() == 1) {
                 $tblCommodity = Commodity::useService()->entityCommodityByName($tblInvoiceItem->getCommodityName());
                 if ($tblCommodity) {
                     $tblDebtor = Banking::useService()->entityDebtorByDebtorNumber($tblInvoice->getDebtorNumber());
                     if ($tblDebtor) {
                         if (Banking::useService()->entityReferenceByDebtorAndCommodity($tblDebtor, $tblCommodity)) {
                             $tblInvoiceItem->Status = new Success('Mandatsreferenz', new Ok());
                         } else {
                             $tblInvoiceItem->Status = new Warning('keine Mandatsreferenz', new Disable());
                         }
                     } else {
                         $tblInvoiceItem->Status = new \SPHERE\Common\Frontend\Message\Repository\Danger('Debitor nicht gefunden', new Disable());
                     }
                 } else {
                     $tblInvoiceItem->Status = new \SPHERE\Common\Frontend\Message\Repository\Danger('Leistung nicht gefunden', new Disable());
                 }
             } else {
                 $tblInvoiceItem->Status = "";
             }
             $tblInvoiceItem->TotalPriceString = $tblInvoiceItem->getTotalPriceString();
             $tblInvoiceItem->QuantityString = str_replace('.', ',', $tblInvoiceItem->getItemQuantity());
             $tblInvoiceItem->PriceString = $tblInvoiceItem->getPriceString();
         }, $tblInvoice);
     }
     $Stage->setContent(new Layout(array(new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(new Panel('Rechnungsnummer', $tblInvoice->getNumber(), Panel::PANEL_TYPE_PRIMARY), 3), new LayoutColumn(new Panel('Warenkorb', $tblInvoice->getBasketName(), Panel::PANEL_TYPE_DEFAULT), 3), new LayoutColumn(new Panel('Rechnungsdatum', $tblInvoice->getInvoiceDate(), $tblInvoice->getIsPaymentDateModified() ? Panel::PANEL_TYPE_WARNING : Panel::PANEL_TYPE_DEFAULT), 3), new LayoutColumn(new Panel('Zahlungsdatum', $tblInvoice->getPaymentDate(), $tblInvoice->getIsPaymentDateModified() ? Panel::PANEL_TYPE_WARNING : Panel::PANEL_TYPE_DEFAULT), 3))), new LayoutRow(new LayoutColumn(new Aspect('Empfänger'))), new LayoutRow(array(new LayoutColumn(new Panel('Debitor', $tblInvoice->getDebtorFullName()), 3), new LayoutColumn(new Panel('Debitorennummer', $tblInvoice->getDebtorNumber()), 3), new LayoutColumn(new Panel('Person', $tblInvoice->getServiceManagementPerson()->getFullName()), 3))), new LayoutRow(array(new LayoutColumn($tblInvoice->getServiceManagementAddress() ? new Panel(new MapMarker() . ' Rechnungsadresse', new Address($tblInvoice->getServiceManagementAddress()), Panel::PANEL_TYPE_DEFAULT) : new Warning('Keine Rechnungsadresse verfügbar', new Disable()), 3), new LayoutColumn(new Panel('Zahlungsart', $tblInvoice->getServiceBillingBankingPaymentType()->getName(), Panel::PANEL_TYPE_DEFAULT), 3))), new LayoutRow(new LayoutColumn(new Aspect('Betrag'))), new LayoutRow(array(new LayoutColumn(new Panel('Rechnungsbetrag', Invoice::useService()->sumPriceItemAllStringByInvoice($tblInvoice)), 3), new LayoutColumn($tblInvoice->getIsConfirmed() ? $tblInvoice->getIsPaid() ? new Success("Bezahlt") : (round(Balance::useService()->sumPriceItemByBalance(Balance::useService()->entityBalanceByInvoice($tblInvoice)), 2) >= round(Invoice::useService()->sumPriceItemAllByInvoice($tblInvoice), 2) ? new Panel('Bezahlbetrag', Balance::useService()->sumPriceItemStringByBalance(Balance::useService()->entityBalanceByInvoice($tblInvoice)), Panel::PANEL_TYPE_SUCCESS) : new Panel('Bezahlbetrag', Balance::useService()->sumPriceItemStringByBalance(Balance::useService()->entityBalanceByInvoice($tblInvoice)), Panel::PANEL_TYPE_DANGER)) : new \SPHERE\Common\Frontend\Text\Repository\Success(""), 3)))), new Title('Kopf')), new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(array(new TableData($tblInvoiceItemAll, null, array('CommodityName' => 'Leistung', 'ItemName' => 'Artikel', 'PriceString' => 'Preis', 'QuantityString' => 'Menge', 'TotalPriceString' => 'Gesamtpreis', 'Status' => 'Status'))))))), new Title('Positionen')))));
     return $Stage;
 }
コード例 #10
0
 /**
  * @param IFormInterface $Stage
  * @param                $Debtor
  * @param                $Id
  *
  * @return IFormInterface|string
  */
 public function executeAddDebtor(IFormInterface &$Stage = null, $Debtor, $Id)
 {
     /**
      * Skip to Frontend
      */
     if (null === $Debtor) {
         return $Stage;
     }
     $Error = false;
     if (isset($Debtor['DebtorNumber']) && empty($Debtor['DebtorNumber'])) {
         $Stage->setError('Debtor[DebtorNumber]', 'Bitte geben sie die Debitorennummer an');
         $Error = true;
     }
     if (isset($Debtor['DebtorNumber']) && Banking::useService()->entityDebtorByDebtorNumber($Debtor['DebtorNumber'])) {
         $Stage->setError('Debtor[DebtorNumber]', 'Die Debitorennummer exisitiert bereits. Bitte geben Sie eine andere Debitorennummer an');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFirst']) && empty($Debtor['LeadTimeFirst'])) {
         $Stage->setError('Debtor[LeadTimeFirst]', 'Bitte geben sie den Ersteinzug an.');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFirst']) && !is_numeric($Debtor['LeadTimeFirst'])) {
         $Stage->setError('Debtor[LeadTimeFirst]', 'Bitte geben sie eine Zahl an.');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFollow']) && empty($Debtor['LeadTimeFollow'])) {
         $Stage->setError('Debtor[LeadTimeFollow]', 'Bitte geben sie den Folgeeinzug an.');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFollow']) && !is_numeric($Debtor['LeadTimeFollow'])) {
         $Stage->setError('Debtor[LeadTimeFollow]', 'Bitte geben sie eine Zahl an.');
         $Error = true;
     }
     if (isset($Debtor['Reference']) && Banking::useService()->entityReferenceByReference($Debtor['Reference'])) {
         $Stage->setError('Debtor[Reference]', 'Die Mandatsreferenz exisitiert bereits. Bitte geben Sie eine andere an');
         $Error = true;
     }
     if (!$Error) {
         (new Data($this->Binding))->actionAddDebtor($Debtor['DebtorNumber'], $Debtor['LeadTimeFirst'], $Debtor['LeadTimeFollow'], $Debtor['BankName'], $Debtor['Owner'], $Debtor['CashSign'], $Debtor['IBAN'], $Debtor['BIC'], $Debtor['Description'], $Debtor['PaymentType'], Management::servicePerson()->entityPersonById($Id));
         //todo
         if (!empty($Debtor['Reference'])) {
             (new Data($this->Binding))->actionAddReference($Debtor['Reference'], $Debtor['DebtorNumber'], $Debtor['ReferenceDate'], Commodity::useService()->entityCommodityById($Debtor['Commodity']));
         }
         return new Success('Der Debitor ist erfasst worden') . new Redirect('/Billing/Accounting/Banking', 2);
     }
     return $Stage;
 }
コード例 #11
0
 /**
  * @param $Id
  * @param $CommodityId
  *
  * @return Stage
  */
 public function frontendBasketCommodityRemove($Id, $CommodityId)
 {
     $Stage = new Stage();
     $Stage->setTitle('Warenkorb');
     $Stage->setDescription('Leistung Entfernen');
     $tblBasket = Basket::useService()->entityBasketById($Id);
     $tblCommodity = Commodity::useService()->entityCommodityById($CommodityId);
     $Stage->setContent(Basket::useService()->executeRemoveBasketCommodity($tblBasket, $tblCommodity));
     return $Stage;
 }
コード例 #12
0
ファイル: Data.php プロジェクト: BozzaCoon/SPHERE-Framework
 /**
  * @param TblCommodity $tblCommodity
  * @param TblBasket    $tblBasket
  *
  * @return TblBasket
  */
 public function actionCreateBasketItemsByCommodity(TblBasket $tblBasket, TblCommodity $tblCommodity)
 {
     $Manager = $this->Connection->getEntityManager();
     $tblCommodityItemList = Commodity::useService()->entityCommodityItemAllByCommodity($tblCommodity);
     /** @var TblCommodityItem $tblCommodityItem */
     foreach ($tblCommodityItemList as $tblCommodityItem) {
         $Entity = $Manager->getEntity('TblBasketItem')->findOneBy(array(TblBasketItem::ATTR_TBL_Basket => $tblBasket->getId(), TblBasketItem::ATTR_SERVICE_BILLING_COMMODITY_ITEM => $tblCommodityItem->getId()));
         if (null === $Entity) {
             $Entity = new TblBasketItem();
             $Entity->setPrice($tblCommodityItem->getTblItem()->getPrice());
             $Entity->setQuantity($tblCommodityItem->getQuantity());
             $Entity->setServiceBillingCommodityItem($tblCommodityItem);
             $Entity->setTblBasket($tblBasket);
             $Manager->bulkSaveEntity($Entity);
             Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
         }
     }
     $Manager->flushCache();
     return $tblBasket;
 }
コード例 #13
0
 /**
  * @param $Debtor
  * @param $Id
  *
  * @return Stage
  */
 public function frontendBankingPersonSelect($Debtor, $Id)
 {
     $Stage = new Stage();
     $Stage->setTitle('Debitoreninformationen');
     $Stage->addButton(new Primary('Zurück', '/Billing/Accounting/Banking/Person', new ChevronLeft()));
     //        $PersonName = Management::servicePerson()->entityPersonById( $Id )->getFullName();  //todo
     $PersonName = false;
     //        $PersonType = Management::servicePerson()->entityPersonById( $Id )->getTblPersonType();
     $PersonType = false;
     $tblPaymentType = Banking::useService()->entityPaymentTypeAll();
     $tblCommodity = Commodity::useService()->entityCommodityAll();
     //        $tblPerson = Management::servicePerson()->entityPersonById( $Id );
     $tblPerson = false;
     //todo
     //        $tblStudent = Management::serviceStudent()->entityStudentByPerson( $tblPerson );
     $tblStudent = false;
     //todo
     if ($tblStudent) {
         if ($tblStudent->getStudentNumber() === 0) {
             $tblStudent->setStudentNumber('Nicht vergeben');
         }
     }
     $Global = $this->getGlobal();
     $Global->POST['Debtor']['Owner'] = $PersonName;
     if (!isset($Global->POST['Debtor']['PaymentType'])) {
         $Global->POST['Debtor']['PaymentType'] = Banking::useService()->entityPaymentTypeByName('SEPA-Lastschrift')->getId();
     }
     if (Banking::useService()->entityDebtorByServiceManagementPerson($Id) == true) {
         $tblDebtor = Banking::useService()->entityDebtorByServiceManagementPerson($Id);
     }
     $Global->savePost();
     $Stage->setContent(new Layout(array(new LayoutGroup(array(empty($tblStudent) ? new LayoutRow(array(new LayoutColumn(array(new Panel(new Person() . ' Debitor', $PersonName, Panel::PANEL_TYPE_SUCCESS)), 6), new LayoutColumn(array(new Panel(new Group() . '. Personengruppe', $PersonType, Panel::PANEL_TYPE_SUCCESS)), 6))) : null, !empty($tblStudent) ? new LayoutRow(array(new LayoutColumn(array(new Panel(new Person() . ' Debitor', $PersonName, Panel::PANEL_TYPE_WARNING)), 4), new LayoutColumn(array(new Panel(new Group() . '. Schülernummer', $tblStudent, Panel::PANEL_TYPE_PRIMARY)), 4), new LayoutColumn(array(new Panel(new Group() . '. Personengruppe', $PersonType, Panel::PANEL_TYPE_WARNING)), 4))) : null)), new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(array(Banking::useService()->executeAddDebtor(new Form(array(new FormGroup(array(new FormRow(array(new FormColumn(new TextField('Debtor[DebtorNumber]', 'Debitornummer', 'Debitornummer', new BarCode()), 12), new FormColumn(new SelectBox('Debtor[PaymentType]', 'Bezahlmethode', array(TblPaymentType::ATTR_NAME => $tblPaymentType), new Money()), 4), new FormColumn(new TextField('Debtor[LeadTimeFirst]', 'Vorlaufzeit in Tagen', 'Ersteinzug', new Time()), 4), new FormColumn(new TextField('Debtor[LeadTimeFollow]', 'Vorlaufzeit in Tagen', 'Folgeeinzug', new Time()), 4), new FormColumn(new TextField('Debtor[Description]', 'Beschreibung', 'Beschreibung', new Conversation()), 12)))), new \SPHERE\Common\Frontend\Form\Repository\Title('Debitor')), new FormGroup(array(new FormRow(array(new FormColumn(new TextField('Debtor[Owner]', 'Vorname Nachname', 'Inhaber', new Person()), 6), new FormColumn(new TextField('Debtor[BankName]', 'Name der Bank', 'Name der Bank', new Building()), 6), new FormColumn(new TextField('Debtor[IBAN]', 'XXXX XXXX XXXX XXXX XXXX XX', 'IBAN', new BarCode()), 4), new FormColumn(new TextField('Debtor[BIC]', 'XXXX XX XX XXX', 'BIC', new BarCode()), 4), new FormColumn(new TextField('Debtor[CashSign]', 'Kassenzeichen', 'Kassenzeichen', new Nameplate()), 4)))), new \SPHERE\Common\Frontend\Form\Repository\Title('Bankdaten')), new FormGroup(array(new FormRow(array(new FormColumn(new TextField('Debtor[Reference]', 'Referenz', 'Mandatsreferenz', new BarCode()), 4), new FormColumn(new DatePicker('Debtor[ReferenceDate]', 'Datum', 'Erstellungsdatum', new Time()), 4), new FormColumn(new SelectBox('Debtor[Commodity]', 'Leistung', array('Name' => $tblCommodity), new Time()), 4)))), new \SPHERE\Common\Frontend\Form\Repository\Title('Mandatsreferenz'))), new \SPHERE\Common\Frontend\Form\Repository\Button\Primary('Hinzufügen')), $Debtor, $Id))))))), !empty($tblDebtor) ? new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(array(new Form(array(new FormGroup(array(new FormRow(array(new FormColumn(array(new TableData($tblDebtor, null, array('DebtorNumber' => 'Debitorennummer', 'BankName' => 'Name der Bank', 'IBAN' => 'IBAN', 'BIC' => 'BIC', 'Owner' => 'Inhaber'))))))))))), 12)))), new Title('Vorhandene Debitorennummer(n)')) : null)));
     return $Stage;
 }