1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace alekciy\ofd\providers\yandex\Model; |
4
|
|
|
|
5
|
|
|
use alekciy\ofd\BaseModel; |
6
|
|
|
use alekciy\ofd\interfaces\ShiftInterface; |
7
|
|
|
use Exception; |
8
|
|
|
|
9
|
|
|
class Shift extends BaseModel implements ShiftInterface |
10
|
|
|
{ |
11
|
|
|
/** @var string Дата открытия */ |
12
|
|
|
public $openDateTime = ''; |
13
|
|
|
|
14
|
|
|
/** @var string Дата закрытия */ |
15
|
|
|
public $closeDateTime = ''; |
16
|
|
|
|
17
|
|
|
/** @var string Регистрационный номер */ |
18
|
|
|
public $kktRegNumber; |
19
|
|
|
|
20
|
|
|
/** @var string Заводской номер ФН */ |
21
|
|
|
public $fnFactoryNumber; |
22
|
|
|
|
23
|
|
|
/** @var int Номер смены */ |
24
|
|
|
public $shiftNumber = 0; |
25
|
|
|
|
26
|
|
|
/** @var OperationShiftReport Данные по операциям с типом «outcome» (расход) за смену */ |
27
|
|
|
public $outcome; |
28
|
|
|
|
29
|
|
|
/** @var OperationShiftReport Данные по операциям с типом «outcome-return» (возврат расхода) за смену */ |
30
|
|
|
public $outcomeReturn; |
31
|
|
|
|
32
|
|
|
/** @var OperationShiftReport Данные по операциям с типом «income-return» (возврат прихода) за смену */ |
33
|
|
|
public $incomeReturn; |
34
|
|
|
|
35
|
|
|
/** @var OperationShiftReport Данные по операциям с типом расчета «income» (приход) за смену */ |
36
|
|
|
public $income; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param array $operationShiftReportInit |
40
|
|
|
* @return OperationShiftReport |
41
|
|
|
* @throws Exception |
42
|
|
|
*/ |
43
|
|
|
protected function getOperationShiftReport(array $operationShiftReportInit): OperationShiftReport |
44
|
|
|
{ |
45
|
|
|
return new OperationShiftReport($operationShiftReportInit); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @inheritDoc |
50
|
|
|
*/ |
51
|
|
|
protected function getPropertyInitMap(): array |
52
|
|
|
{ |
53
|
|
|
return [ |
54
|
|
|
'shift' => 'shiftNumber', |
55
|
|
|
'fn' => 'fnFactoryNumber', |
56
|
|
|
'rn' => 'kktRegNumber', |
57
|
|
|
'open' => 'openDateTime', |
58
|
|
|
'close' => 'closeDateTime', |
59
|
|
|
'income' => ['income', 'conv' => 'getOperationShiftReport'], |
60
|
|
|
'income_return' => ['incomeReturn', 'conv' => 'getOperationShiftReport'], |
61
|
|
|
'outcome' => ['outcome', 'conv' => 'getOperationShiftReport'], |
62
|
|
|
'outcome_return' => ['outcome_return', 'conv' => 'getOperationShiftReport'], |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @inheritDoc |
68
|
|
|
*/ |
69
|
|
|
public function getRuleList(): array |
70
|
|
|
{ |
71
|
|
|
return [ |
72
|
|
|
'fnFactoryNumber' => ['required', ['lengthMin', 1], ['lengthMax', 16]], |
73
|
|
|
'shiftNumber' => ['required', 'integer', ['min', 0]], |
74
|
|
|
'openDateTime' => ['required', ['dateFormat', 'Y-m-d H:i:s']], |
75
|
|
|
'kktRegNumber' => ['required', ['lengthMin', 1], ['lengthMax', 16]], |
76
|
|
|
|
77
|
|
|
'closeDateTime' => [['dateFormat', 'Y-m-d H:i:s']], |
78
|
|
|
]; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @inheritDoc |
83
|
|
|
*/ |
84
|
|
|
public function getFnFactoryNumber(): string |
85
|
|
|
{ |
86
|
|
|
return $this->fnFactoryNumber; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @inheritDoc |
91
|
|
|
*/ |
92
|
|
|
public function getShiftNumber(): int |
93
|
|
|
{ |
94
|
|
|
return $this->shiftNumber; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @inheritDoc |
99
|
|
|
*/ |
100
|
|
|
public function getOpenDateTime(): string |
101
|
|
|
{ |
102
|
|
|
return $this->openDateTime; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @inheritDoc |
107
|
|
|
*/ |
108
|
|
|
public function getCloseDateTime(): string |
109
|
|
|
{ |
110
|
|
|
return $this->closeDateTime; |
111
|
|
|
} |
112
|
|
|
} |