public function getVatValue(Document $document = null, DefaultSettings $defaultSettings = null) { $vat = 0; if ($document && $document->getVat() !== null) { $vat = $document->getVat()->getValue(); } elseif ($defaultSettings && $defaultSettings->getVat() !== null) { $vat = $defaultSettings->getVat()->getValue(); } return $vat; }
public function setFormValues(Document $document = null) { if ($document) { $this->get('deadlineDays')->setValue($document->getDeadlineDays()); $this->get('delayPercent')->setValue($document->getDelayPercent()); if ($document instanceof Document\PurchaseInvoice) { $this->get('supplierDocNumber')->setValue($document->getSupplierDocumentNumber()); } $this->get('amount')->setValue($document->getAmount()); $this->get('taxAmount')->setValue($document->getTaxAmount()); $this->get('amountTax')->setValue($document->getAmountTax()); $this->get('comment')->setValue($document->getComment()); $this->get('paymentType')->setValue($document->getPaymentType()); if ($document->getDocumentDate()) { $this->get('docDate')->setValue($document->getDocumentDate()->format('d.m.Y')); } if ($document->getCustomer()) { $this->get('customer')->setValue($document->getCustomer()->getId()); } if ($document->getSupplier()) { $this->get('supplier')->setValue($document->getSupplier()->getId()); } if ($document->getVat()) { $this->get('vat')->setValue($document->getVat()->getId()); } } }