/**
  * @return bool|TblBalance
  */
 public function getTblBalance()
 {
     if (null === $this->tblBalance) {
         return false;
     } else {
         return Balance::useService()->entityBalanceById($this->tblBalance);
     }
 }
 public static function registerApplication()
 {
     /**
      * Register Module
      */
     Invoice::registerModule();
     Balance::registerModule();
     Main::getDisplay()->addApplicationNavigation(new Link(new Link\Route(__NAMESPACE__), new Link\Name('Buchungen')));
     Main::getDisplay()->addModuleNavigation(new Link(new Link\Route(__NAMESPACE__ . '/Invoice'), new Link\Name('Rechnungen')));
     Main::getDisplay()->addModuleNavigation(new Link(new Link\Route(__NAMESPACE__ . '/Balance'), new Link\Name('Offene Posten')));
 }
Example #3
0
 /**
  * @return Stage
  */
 public function frontendPayment()
 {
     $Stage = new Stage();
     $Stage->setTitle('Zahlungen');
     $Stage->setDescription('Importierte');
     $paymentList = Balance::useService()->entityPaymentAll();
     if ($paymentList) {
         array_walk($paymentList, function (TblPayment &$tblPayment) {
             $tblInvoice = $tblPayment->getTblBalance()->getServiceBillingInvoice();
             if ($tblInvoice) {
                 $tblPayment->InvoiceNumber = $tblInvoice->getNumber();
                 $tblPayment->InvoiceDate = $tblInvoice->getInvoiceDate();
                 $tblPayment->DebtorFullName = $tblInvoice->getDebtorFullName();
                 $tblPayment->DebtorNumber = $tblInvoice->getDebtorNumber();
                 $tblPayment->ValueString = $tblPayment->getValueString();
             }
         });
     }
     $Stage->setContent(new TableData($paymentList, null, array('InvoiceNumber' => 'Rechnungs-Nr.', 'InvoiceDate' => 'Rechnungsdatum', 'Date' => 'Zahlungseingangsdatum', 'DebtorFullName' => 'Debitor', 'DebtorNumber' => 'Debitorennummer', 'ValueString' => 'Betrag')));
     return $Stage;
 }
Example #4
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;
 }
 /**
  * @param TblDebtor $tblDebtor
  *
  * @return int
  */
 public function entityLeadTimeByDebtor(TblDebtor $tblDebtor)
 {
     if (Invoice::useService()->checkInvoiceFromDebtorIsPaidByDebtor($tblDebtor) || Balance::useService()->checkPaymentFromDebtorExistsByDebtor($tblDebtor)) {
         return $tblDebtor->getLeadTimeFollow();
     } else {
         return $tblDebtor->getLeadTimeFirst();
     }
 }
 /**
  * @param TblInvoice $tblInvoice
  * @param            $Data
  *
  * @return string
  */
 public function executeConfirmInvoice(TblInvoice $tblInvoice, $Data)
 {
     if (Balance::useService()->actionCreateBalance(Banking::useService()->entityDebtorByDebtorNumber($tblInvoice->getDebtorNumber()), $tblInvoice, null)) {
         return new Success('Die Rechnung wurde erfolgreich bestätigt und freigegeben') . new Redirect('/Billing/Bookkeeping/Invoice/IsNotConfirmed', 0);
     } else {
         return new Warning('Die Rechnung wurde konnte nicht bestätigt und freigegeben werden') . new Redirect('/Billing/Bookkeeping/Invoice/IsNotConfirmed/Edit', 2, array('Id' => $tblInvoice->getId()));
     }
 }
 /**
  * @return boolean
  */
 public function getIsConfirmed()
 {
     return Balance::useService()->entityBalanceByInvoice($this) === false ? false : true;
 }