示例#1
0
 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());
         }
     }
 }