/** * @param TblInvoice $tblInvoice * @param TblPaymentType $tblPaymentType * * @return bool */ public function actionChangeInvoicePaymentType(TblInvoice $tblInvoice, TblPaymentType $tblPaymentType) { $Manager = $this->Connection->getEntityManager(); /** @var TblInvoice $Entity */ $Entity = $Manager->getEntityById('TblInvoice', $tblInvoice->getId()); if (null !== $Entity) { $Protocol = clone $Entity; $Entity->setServiceBillingBankingPaymentType($tblPaymentType); $Manager->saveEntity($Entity); Protocol::useService()->createUpdateEntry($this->Connection->getDatabase(), $Protocol, $Entity); return true; } return false; }
/** * @param $tblAddressList * @param TblAddress $invoiceAddress * @param TblInvoice $tblInvoice * * @return Layout */ private static function layoutAddress($tblAddressList, TblAddress $invoiceAddress, TblInvoice $tblInvoice) { if (!empty($tblAddressList)) { /** @var TblAddress[] $tblAddressList */ foreach ($tblAddressList as &$tblAddress) { if ($invoiceAddress != null && $invoiceAddress->getId() === $tblAddress->getId()) { $AddressType = new MapMarker() . ' Rechnungsadresse'; $PanelType = Panel::PANEL_TYPE_SUCCESS; } else { $AddressType = new MapMarker() . ' Adresse'; $PanelType = Panel::PANEL_TYPE_DEFAULT; } $tblAddress = new LayoutColumn(new Panel($AddressType, new Address($tblAddress), $PanelType, new Primary('Auswählen', '/Billing/Bookkeeping/Invoice/IsNotConfirmed/Address/Change', new Ok(), array('Id' => $tblInvoice->getId(), 'AddressId' => $tblAddress->getId()))), 3); } } else { $tblAddressList = array(new LayoutColumn(new Warning('Keine Adressen hinterlegt', new \SPHERE\Common\Frontend\Icon\Repository\Warning()))); } return new Layout(new LayoutGroup(new LayoutRow($tblAddressList), new Title('Adressen'))); }
/** * @param TblDebtor $serviceBilling_Banking * @param TblInvoice $serviceBilling_Invoice * @param $ExportDate * * @return bool */ public function actionCreateBalance(TblDebtor $serviceBilling_Banking, TblInvoice $serviceBilling_Invoice, $ExportDate) { $Manager = $this->Connection->getEntityManager(); $Entity = $Manager->getEntity('TblBalance')->findOneBy(array(TblBalance::ATTR_SERVICE_BILLING_BANKING => $serviceBilling_Banking->getId(), TblBalance::ATTR_SERVICE_BILLING_INVOICE => $serviceBilling_Invoice->getId())); if (null === $Entity) { $Entity = new TblBalance(); $Entity->setServiceBillingBanking($serviceBilling_Banking); $Entity->setServiceBillingInvoice($serviceBilling_Invoice); if ($ExportDate !== null) { $Entity->setExportDate($ExportDate); } $Manager->saveEntity($Entity); Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity); return true; } return false; }
/** * @param null|TblInvoice $serviceBilling_Invoice */ public function setServiceBillingInvoice(TblInvoice $serviceBilling_Invoice = null) { $this->serviceBilling_Invoice = null === $serviceBilling_Invoice ? null : $serviceBilling_Invoice->getId(); }
/** * @param null|TblInvoice $tblInvoice */ public function setTblInvoice(TblInvoice $tblInvoice = null) { $this->tblInvoice = null === $tblInvoice ? null : $tblInvoice->getId(); }
/** * @param TblInvoice $tblInvoice * * @return string */ public function executeCancelInvoice(TblInvoice $tblInvoice) { if (!$tblInvoice->getIsConfirmed()) { if ((new Data($this->Binding))->actionCancelInvoice($tblInvoice)) { return new Success('Die Rechnung wurde erfolgreich storniert') . new Redirect('/Billing/Bookkeeping/Invoice/IsNotConfirmed', 0); } else { return new Warning('Die Rechnung konnte nicht storniert werden') . new Redirect('/Billing/Bookkeeping/Invoice/IsNotConfirmed/Edit', 2, array('Id' => $tblInvoice->getId())); } } else { //TODO cancel confirmed invoice if ((new Data($this->Binding))->actionCancelInvoice($tblInvoice)) { return new Success('Die Rechnung wurde erfolgreich storniert') . new Redirect('/Billing/Bookkeeping/Invoice', 0); } else { return new Warning('Die Rechnung konnte nicht storniert werden') . new Redirect('/Billing/Bookkeeping/Invoice', 2); } } }