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\IssueSlip; |
13
|
|
|
|
14
|
|
|
use Riesenia\Pohoda\Common\OptionsResolver; |
15
|
|
|
use Riesenia\Pohoda\Document\AbstractItem; |
16
|
|
|
|
17
|
|
|
class Item extends AbstractItem |
18
|
|
|
{ |
19
|
|
|
/** @var string[] */ |
20
|
|
|
protected array $refElements = ['typeServiceMOSS', 'centre', 'activity', 'contract']; |
21
|
|
|
|
22
|
|
|
/** @var string[] */ |
23
|
|
|
protected array $elements = ['text', 'quantity', 'unit', 'coefficient', 'payVAT', 'rateVAT', 'percentVAT', 'discountPercentage', 'homeCurrency', 'foreignCurrency', 'typeServiceMOSS', 'note', 'code', 'stockItem', 'centre', 'activity', 'contract']; |
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->setNormalizer('text', $this->normalizerFactory->getClosure('string90')); |
34
|
1 |
|
$resolver->setNormalizer('quantity', $this->normalizerFactory->getClosure('float')); |
35
|
1 |
|
$resolver->setNormalizer('unit', $this->normalizerFactory->getClosure('string10')); |
36
|
1 |
|
$resolver->setNormalizer('coefficient', $this->normalizerFactory->getClosure('float')); |
37
|
1 |
|
$resolver->setNormalizer('payVAT', $this->normalizerFactory->getClosure('bool')); |
38
|
1 |
|
$resolver->setAllowedValues('rateVAT', ['none', 'high', 'low', 'third', 'historyHigh', 'historyLow', 'historyThird']); |
39
|
1 |
|
$resolver->setNormalizer('percentVAT', $this->normalizerFactory->getClosure('int')); |
40
|
1 |
|
$resolver->setNormalizer('discountPercentage', $this->normalizerFactory->getClosure('float')); |
41
|
1 |
|
$resolver->setNormalizer('note', $this->normalizerFactory->getClosure('string90')); |
42
|
1 |
|
$resolver->setNormalizer('code', $this->normalizerFactory->getClosure('string64')); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|