1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* The MIT License (MIT) |
6
|
|
|
* |
7
|
|
|
* Copyright (c) 2016 Daniel Popiniuc |
8
|
|
|
* |
9
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
10
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
11
|
|
|
* in the Software without restriction, including without limitation the rights |
12
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
14
|
|
|
* furnished to do so, subject to the following conditions: |
15
|
|
|
* |
16
|
|
|
* The above copyright notice and this permission notice shall be included in all |
17
|
|
|
* copies or substantial portions of the Software. |
18
|
|
|
* |
19
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
25
|
|
|
* SOFTWARE. |
26
|
|
|
* |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
namespace danielgp\salariu; |
30
|
|
|
|
31
|
|
|
trait FormattingSalariu |
32
|
|
|
{ |
33
|
|
|
|
34
|
|
|
use \danielgp\salariu\BasicSalariu; |
35
|
|
|
|
36
|
|
|
private function buildArrayOfFieldsStyled() |
37
|
|
|
{ |
38
|
|
|
$sReturn = []; |
39
|
|
|
foreach ($this->appFlags['TCAS'] as $key => $value) { |
40
|
|
|
$sReturn[$this->tApp->gettext($key)] = $value; |
41
|
|
|
$sReturn[$this->tApp->gettext($key) . ':'] = $value; |
42
|
|
|
} |
43
|
|
|
return $sReturn; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
private function buildStyleForCellFormat($styleId) |
47
|
|
|
{ |
48
|
|
|
$sReturn = []; |
49
|
|
|
foreach ($this->appFlags['TCSD'][$styleId] as $key => $value) { |
50
|
|
|
$sReturn[] = $key . ':' . $value; |
51
|
|
|
} |
52
|
|
|
return implode(';', $sReturn) . ';'; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
private function setFormInputSelectPC() |
56
|
|
|
{ |
57
|
|
|
$choices = [ |
58
|
|
|
$this->tApp->gettext('i18n_Form_Label_CatholicEasterFree_ChoiceNo'), |
59
|
|
|
$this->tApp->gettext('i18n_Form_Label_CatholicEasterFree_ChoiceYes'), |
60
|
|
|
]; |
61
|
|
|
return $this->setArrayToSelect($choices, $this->tCmnSuperGlobals->get('pc'), 'pc', ['size' => 1]); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
private function setFormInputSelectPI() |
65
|
|
|
{ |
66
|
|
|
$temp2 = []; |
67
|
|
|
for ($counter = 0; $counter <= 4; $counter++) { |
68
|
|
|
$temp2[$counter] = $counter . ($counter == 4 ? '+' : ''); |
69
|
|
|
} |
70
|
|
|
return $this->setArrayToSelect($temp2, $this->tCmnSuperGlobals->get('pi'), 'pi', ['size' => 1]); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
private function setFormInputSelectYM() |
74
|
|
|
{ |
75
|
|
|
$temp = []; |
76
|
|
|
for ($counter = date('Y'); $counter >= 2001; $counter--) { |
77
|
|
|
for ($counter2 = 12; $counter2 >= 1; $counter2--) { |
78
|
|
|
$crtDate = mktime(0, 0, 0, $counter2, 1, $counter); |
79
|
|
|
if ($crtDate <= mktime(0, 0, 0, date('m'), 1, date('Y'))) { |
80
|
|
|
$temp[$crtDate] = strftime('%Y, %m (%B)', $crtDate); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
return $this->setArrayToSelect($temp, $this->tCmnSuperGlobals->get('ym'), 'ym', ['size' => 1]); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
private function setFormatRow($text, $value) |
88
|
|
|
{ |
89
|
|
|
$defaultCellStyle = [ |
90
|
|
|
'class' => 'labelS', |
91
|
|
|
'style' => 'color:#000;', |
92
|
|
|
]; |
93
|
|
|
$fieldsStyled = $this->buildArrayOfFieldsStyled(); |
94
|
|
|
if (array_key_exists($text, $fieldsStyled)) { |
95
|
|
|
$defaultCellStyle['style'] = $this->buildStyleForCellFormat($fieldsStyled[$text]); |
96
|
|
|
} |
97
|
|
|
if ((is_numeric($value)) && ($value == 0)) { |
98
|
|
|
$defaultCellStyle['style'] = 'color:#666;'; |
99
|
|
|
} |
100
|
|
|
return $defaultCellStyle; |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|