|
|
@@ -61,14 +61,13 @@ class PortfolioPresenter
|
|
61
|
61
|
$table = new Table($output);
|
|
62
|
62
|
$table->setHeaderTitle("ПОРТФЕЛЬ: {$parsedPortfolio->getHeader()['НачПериода']} - {$parsedPortfolio->getHeader()['КонПериода']}");
|
|
63
|
63
|
$table->setHeaders([
|
|
64
|
|
- 'ЦБ', 'Кн', 'Кк', 'Цн', 'Цк', 'Сумм', '%'
|
|
|
64
|
+ 'ЦБ', 'Кол-во', 'Цн', 'Цк', 'Сумм', '%'
|
|
65
|
65
|
]);
|
|
66
|
66
|
|
|
67
|
67
|
foreach ($parsedPortfolio->getDetails() as $detail) {
|
|
68
|
68
|
$table->addRow([
|
|
69
|
69
|
$this->getPrintableSecurityTitle($detail),
|
|
70
|
|
- $detail['КоличествоНО'],
|
|
71
|
|
- $detail['КоличествоКО'],
|
|
|
70
|
+ $this->formatQuantity($detail),
|
|
72
|
71
|
$detail['НОЦена'],
|
|
73
|
72
|
//$detail['СуммаНКДНО'],
|
|
74
|
73
|
$detail['КОЦена'],
|
|
|
@@ -139,4 +138,15 @@ class PortfolioPresenter
|
|
139
|
138
|
return $title;
|
|
140
|
139
|
}
|
|
141
|
140
|
|
|
142
|
|
-}
|
|
|
141
|
+ private function formatQuantity(array $detail): string
|
|
|
142
|
+ {
|
|
|
143
|
+ if ($detail['КоличествоНО'] == $detail['КоличествоКО']) {
|
|
|
144
|
+ return $detail['КоличествоНО'];
|
|
|
145
|
+ } else {
|
|
|
146
|
+ return ($detail['КоличествоНО'] > 0 ? $detail['КоличествоНО'] . ' ' : '')
|
|
|
147
|
+ . ($detail['КоличествоКО'] > $detail['КоличествоНО'] ? '+' : '')
|
|
|
148
|
+ . ($detail['КоличествоКО'] - $detail['КоличествоНО']);
|
|
|
149
|
+ }
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+}
|