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 establishLocalizationToDisplay() |
56
|
|
|
{ |
57
|
|
|
setlocale(LC_TIME, $this->tCmnSession->get('lang') . '.UTF8'); |
58
|
|
|
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { |
59
|
|
|
setlocale(LC_TIME, explode('_', $this->tCmnSession->get('lang'))[0]); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
private function setFormInputSelectPC() |
64
|
|
|
{ |
65
|
|
|
$choices = [ |
66
|
|
|
$this->tApp->gettext('i18n_Form_Label_CatholicEasterFree_ChoiceNo'), |
67
|
|
|
$this->tApp->gettext('i18n_Form_Label_CatholicEasterFree_ChoiceYes'), |
68
|
|
|
]; |
69
|
|
|
return $this->setArrayToSelect($choices, $this->tCmnSuperGlobals->get('pc'), 'pc', ['size' => 1]); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
private function setFormInputSelectPI() |
73
|
|
|
{ |
74
|
|
|
$temp2 = []; |
75
|
|
|
for ($counter = 0; $counter <= 4; $counter++) { |
76
|
|
|
$temp2[$counter] = $counter . ($counter == 4 ? '+' : ''); |
77
|
|
|
} |
78
|
|
|
return $this->setArrayToSelect($temp2, $this->tCmnSuperGlobals->get('pi'), 'pi', ['size' => 1]); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
private function setFormInputSelectYM($ymValues) |
82
|
|
|
{ |
83
|
|
|
return $this->setArrayToSelect($ymValues, $this->tCmnSuperGlobals->get('ym'), 'ym', ['size' => 1]); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
private function setFormatRow($text, $value) |
87
|
|
|
{ |
88
|
|
|
$defaultCellStyle = [ |
89
|
|
|
'class' => 'labelS', |
90
|
|
|
'style' => 'color:#000;', |
91
|
|
|
]; |
92
|
|
|
$fieldsStyled = $this->buildArrayOfFieldsStyled(); |
93
|
|
|
if (array_key_exists($text, $fieldsStyled)) { |
94
|
|
|
$defaultCellStyle['style'] = $this->buildStyleForCellFormat($fieldsStyled[$text]); |
95
|
|
|
} |
96
|
|
|
if ((is_numeric($value)) && ($value == 0)) { |
97
|
|
|
$defaultCellStyle['style'] = 'color:#666;'; |
98
|
|
|
} |
99
|
|
|
return $defaultCellStyle; |
100
|
|
|
} |
101
|
|
|
} |
102
|
|
|
|