|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of riesenia/pohoda package. |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the MIT License |
|
7
|
|
|
* (c) RIESENIA.com |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace Riesenia\Pohoda\Invoice; |
|
13
|
|
|
|
|
14
|
|
|
use Riesenia\Pohoda\Common\OptionsResolver; |
|
15
|
|
|
use Riesenia\Pohoda\Document\AbstractHeader; |
|
16
|
|
|
|
|
17
|
|
|
class Header extends AbstractHeader |
|
18
|
|
|
{ |
|
19
|
|
|
/** @var string[] */ |
|
20
|
|
|
protected array $refElements = ['extId', 'number', 'accounting', 'classificationVAT', 'classificationKVDPH', 'order', 'paymentType', 'priceLevel', 'account', 'paymentAccount', 'centre', 'activity', 'contract', 'regVATinEU', 'MOSS', 'evidentiaryResourcesMOSS', 'carrier']; |
|
21
|
|
|
|
|
22
|
|
|
/** @var string[] */ |
|
23
|
|
|
protected array $elements = ['extId', 'invoiceType', 'number', 'symVar', 'originalDocument', 'originalDocumentNumber', 'symPar', 'date', 'dateTax', 'dateAccounting', 'dateKHDPH', 'dateDue', 'dateApplicationVAT', 'dateDelivery', 'accounting', 'classificationVAT', 'classificationKVDPH', 'numberKHDPH', 'text', 'partnerIdentity', 'myIdentity', 'order', 'numberOrder', 'dateOrder', 'paymentType', 'priceLevel', 'account', 'symConst', 'symSpec', 'paymentAccount', 'paymentTerminal', 'centre', 'activity', 'contract', 'regVATinEU', 'MOSS', 'evidentiaryResourcesMOSS', 'accountingPeriodMOSS', 'dateTaxOriginalDocumentMOSS', 'note', 'carrier', 'intNote', 'postponedIssue', 'histRate']; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* {@inheritdoc} |
|
27
|
|
|
*/ |
|
28
|
1 |
|
protected function configureOptions(OptionsResolver $resolver): void |
|
29
|
|
|
{ |
|
30
|
1 |
|
parent::configureOptions($resolver); |
|
31
|
|
|
|
|
32
|
|
|
// validate / format options |
|
33
|
1 |
|
$resolver->setDefault('invoiceType', 'issuedInvoice'); |
|
34
|
1 |
|
$resolver->setAllowedValues('invoiceType', ['issuedInvoice', 'issuedCreditNotice', 'issuedDebitNote', 'issuedAdvanceInvoice', 'receivable', 'issuedProformaInvoice', 'penalty', 'issuedCorrectiveTax', 'receivedInvoice', 'receivedCreditNotice', 'receivedDebitNote', 'receivedAdvanceInvoice', 'commitment', 'receivedProformaInvoice', 'receivedCorrectiveTax']); |
|
35
|
1 |
|
$resolver->setNormalizer('symVar', $this->normalizerFactory->getClosure('string20')); |
|
36
|
1 |
|
$resolver->setNormalizer('originalDocument', $this->normalizerFactory->getClosure('string32')); |
|
37
|
1 |
|
$resolver->setNormalizer('symPar', $this->normalizerFactory->getClosure('string20')); |
|
38
|
1 |
|
$resolver->setNormalizer('date', $this->normalizerFactory->getClosure('date')); |
|
39
|
1 |
|
$resolver->setNormalizer('dateTax', $this->normalizerFactory->getClosure('date')); |
|
40
|
1 |
|
$resolver->setNormalizer('dateAccounting', $this->normalizerFactory->getClosure('date')); |
|
41
|
1 |
|
$resolver->setNormalizer('dateKHDPH', $this->normalizerFactory->getClosure('date')); |
|
42
|
1 |
|
$resolver->setNormalizer('dateDue', $this->normalizerFactory->getClosure('date')); |
|
43
|
1 |
|
$resolver->setNormalizer('dateApplicationVAT', $this->normalizerFactory->getClosure('date')); |
|
44
|
1 |
|
$resolver->setNormalizer('dateDelivery', $this->normalizerFactory->getClosure('date')); |
|
45
|
1 |
|
$resolver->setNormalizer('numberKHDPH', $this->normalizerFactory->getClosure('string32')); |
|
46
|
1 |
|
$resolver->setNormalizer('text', $this->normalizerFactory->getClosure('string240')); |
|
47
|
1 |
|
$resolver->setNormalizer('numberOrder', $this->normalizerFactory->getClosure('string32')); |
|
48
|
1 |
|
$resolver->setNormalizer('dateOrder', $this->normalizerFactory->getClosure('date')); |
|
49
|
1 |
|
$resolver->setNormalizer('symConst', $this->normalizerFactory->getClosure('string4')); |
|
50
|
1 |
|
$resolver->setNormalizer('symSpec', $this->normalizerFactory->getClosure('string16')); |
|
51
|
1 |
|
$resolver->setNormalizer('paymentTerminal', $this->normalizerFactory->getClosure('bool')); |
|
52
|
1 |
|
$resolver->setNormalizer('postponedIssue', $this->normalizerFactory->getClosure('bool')); |
|
53
|
1 |
|
$resolver->setNormalizer('histRate', $this->normalizerFactory->getClosure('bool')); |
|
54
|
1 |
|
$resolver->setNormalizer('dateTaxOriginalDocumentMOSS', $this->normalizerFactory->getClosure('date')); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|