add exante and ibkr
This commit is contained in:
@@ -7,14 +7,17 @@ use Doctrine\ORM\EntityManager;
|
||||
|
||||
class DividendsSummary
|
||||
{
|
||||
/** @var SheetData|array $sheetData */
|
||||
/** @var SheetDataAll|array $sheetData */
|
||||
private array $sheetData=[];
|
||||
/** @var XMLReader|array $sheetData */
|
||||
private array $xmlData=[];
|
||||
private Currency $currencyObj;
|
||||
public array $error=[];
|
||||
/** @var array|DividendsData $error */
|
||||
private ?array $errorDividend=null;
|
||||
private ?array $errorString=null;
|
||||
private array $allData=[];
|
||||
private array $countryToCurrency=[];
|
||||
private int $realCalculatedRows = 0;
|
||||
|
||||
public function __construct(EntityManager $manager)
|
||||
{
|
||||
@@ -88,6 +91,7 @@ class DividendsSummary
|
||||
if (!isset($countryToCurrency[$country])) {
|
||||
$countryToCurrency[$country] = $val->getCurrency();
|
||||
}
|
||||
$this->realCalculatedRows++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,7 +105,11 @@ class DividendsSummary
|
||||
|
||||
private function getRate(DividendsData $data) : float
|
||||
{
|
||||
return $this->currencyObj->getRate($data->getCurrency(),$data->getDateTime(),$this->error);
|
||||
if (!Currency::isCurrencyExists($data->getCurrency())) {
|
||||
$this->errorString[$data->getCurrency()] = "Currency: {$data->getCurrency()} is not supported! Please contact with administrator.";
|
||||
return 0;
|
||||
}
|
||||
return $this->currencyObj->getRate($data->getCurrency(),$data->getDateTime());
|
||||
}
|
||||
|
||||
private function count(DividendsData $data, bool $fromDestiny = false) : float
|
||||
@@ -120,7 +128,7 @@ class DividendsSummary
|
||||
if ($rate > 0) {
|
||||
return $valueTax * $rate;
|
||||
}
|
||||
$this->error[]=$data;
|
||||
$this->errorDividend[]=$data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -140,9 +148,9 @@ class DividendsSummary
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SheetData $sheetData
|
||||
* @param SheetDataAll $sheetData
|
||||
*/
|
||||
public function addSheetData(SheetData $sheetData): void
|
||||
public function addSheetData(SheetDataAll $sheetData): void
|
||||
{
|
||||
$this->sheetData[] = $sheetData;
|
||||
}
|
||||
@@ -155,4 +163,27 @@ class DividendsSummary
|
||||
$this->xmlData[] = $reader;
|
||||
}
|
||||
|
||||
public function takeCountRawData(): array
|
||||
{
|
||||
$rowCount = 0;
|
||||
/** @var SheetData $sheetDatum */
|
||||
foreach ($this->sheetData as $sheetDatum) {
|
||||
$rowCount += $sheetDatum->getCount();
|
||||
}
|
||||
return [
|
||||
'countSheet' => count($this->sheetData),
|
||||
'countRows' => $rowCount,
|
||||
'realCountRows' => $this->realCalculatedRows
|
||||
];
|
||||
}
|
||||
|
||||
public function getErrorDividend(): ?array
|
||||
{
|
||||
return $this->errorDividend;
|
||||
}
|
||||
public function getErrorString(): ?array
|
||||
{
|
||||
return $this->errorString;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user