Пример #1
0
 /**
  * Initializes the Participant.
  *
  * @param ParticipantBuilder $participantBuilder
  */
 public function __construct(ParticipantBuilder $participantBuilder)
 {
     $this->name = $participantBuilder->getName();
     $this->street = $participantBuilder->getStreet();
     $this->houseNumber = $participantBuilder->getHouseNumber();
     $this->city = $participantBuilder->getCity();
     $this->zip = $participantBuilder->getZip();
     $this->in = $participantBuilder->getIn();
     $this->tin = $participantBuilder->getTin();
     $this->accountNumber = $participantBuilder->getAccountNumber();
 }
Пример #2
0
 protected function createComponentFaktura()
 {
     $dateNow = new DateTime();
     $variableSymbol = 123;
     $supplierBuilder = new ParticipantBuilder("company", "Street", '', "City", "Postcode");
     $supplier = $supplierBuilder->setIn(1111)->setTin("CZ1111")->setAccountNumber("123/0800")->build();
     $nazev = "Customer Name";
     $customerBuilder = new ParticipantBuilder($nazev, "Customer street", '', "Customer city", "Postcode");
     $customer = $customerBuilder->build();
     $items = array(new ItemImpl('Sample item', 1, 1111, TaxImpl::fromPercent(22), false));
     $dataBuilder = new DataBuilder(999, 'Faktura', $supplier, $customer, $dateNow->modifyClone("+14 days"), $dateNow, $items);
     $dataBuilder->setVariableSymbol($variableSymbol)->setDateOfVatRevenueRecognition($dateNow->modifyClone("+15 days"));
     $data = $dataBuilder->build();
     $env = new Eciovni($data);
     $env->setTemplatePath(__DIR__ . "/templates/faktura.latte");
     return $env;
 }
 /**
  * @param $id
  * @return Eciovni
  */
 public function getInvoice($id)
 {
     /** @var InvoiceEntity $invoice */
     $invoice = $this->invoiceRepository->find($id);
     $account = $invoice->getSupplier()->getAccount();
     $person = $account->getPerson();
     $supplierBuilder = new ParticipantBuilder($person->getName(), $person->getStreet(), $person->getNumber(), $person->getCity(), $person->getZip());
     $supplierBuilder->setIn($person->getIdentificationNumber())->setTin($person->getTaxIdentificationNumber())->setAccountNumber((string) $account)->setBankName((string) $account->getBank())->setRegistration($person->getRegistration())->setPayment($invoice->getType())->setVatPayer($person->getTaxpayer());
     if ($person->getEmail()) {
         $supplierBuilder->addContact('email', $person->getEmail());
     }
     if ($person->getPhone()) {
         $supplierBuilder->addContact('phone', $person->getPhone());
     }
     if ($person->getFax()) {
         $supplierBuilder->addContact('fax', $person->getFax());
     }
     if ($person->getWebsite()) {
         $supplierBuilder->addContact('website', $person->getWebsite());
     }
     $supplier = $supplierBuilder->build();
     $person = $invoice->getCustomer();
     $customerBuilder = new ParticipantBuilder($person->getName(), $person->getStreet(), $person->getNumber(), $person->getCity(), $person->getZip());
     $customer = $customerBuilder->setIn($person->getIdentificationNumber())->setTin($person->getTaxIdentificationNumber())->setAccountNumber((string) $account)->setRegistration($person->getRegistration())->setVatPayer(FALSE)->build();
     $items = array();
     foreach ($invoice->getItems() as $item) {
         $items[] = new ItemImpl($item->name, $item->getUnits(), $item->getQUnit(), $item->getUnitValue(), TaxImpl::fromPercent($item->getTax()), $item->getUnitValueIsTaxed());
     }
     $dataBuilder = new DataBuilder($invoice->identification, 'Daňový doklad, č.', $supplier, $customer, $invoice->getExpirationDate(), $invoice->getDate(), $items);
     $dataBuilder->setVariableSymbol($invoice->getVariableSymbol())->setConstantSymbol($invoice->getConstantSymbol())->setSpecificSymbol($invoice->getSpecificSymbol())->setDateOfVatRevenueRecognition($invoice->getDate())->setStamp($invoice->getSupplier()->getAccount()->getPerson()->getSignature());
     $data = $dataBuilder->build();
     $control = new Eciovni($data);
     $control->setTranslator($this->translator);
     return $control;
 }
Пример #4
0
 /**
  * Initializes the Participant.
  *
  * @param ParticipantBuilder $participantBuilder
  */
 public function __construct(ParticipantBuilder $participantBuilder)
 {
     $this->name = $participantBuilder->getName();
     $this->street = $participantBuilder->getStreet();
     $this->houseNumber = $participantBuilder->getHouseNumber();
     $this->city = $participantBuilder->getCity();
     $this->zip = $participantBuilder->getZip();
     $this->in = $participantBuilder->getIn();
     $this->tin = $participantBuilder->getTin();
     $this->accountNumber = $participantBuilder->getAccountNumber();
     $this->bankName = $participantBuilder->getBankName();
     $this->payment = $participantBuilder->getPayment();
     $this->registration = $participantBuilder->getRegistration();
     $this->vatPayer = $participantBuilder->getVatPayer();
     $this->order = $participantBuilder->getOrder();
     $this->contacts = $participantBuilder->getContacts();
 }