Пример #1
0
<?php

/**
 * @var \phpOMS\Views\View $this
 */
$tabView = new \Web\Views\Divider\TabularView($this->l11n, $this->request, $this->response);
$tabView->setTemplate('/Web/Templates/Divider/Tabular');
$lang = $this->getData('lang');
// $csv = json_decode(file_get_contents(__DIR__ . '/NOGIT.json', true)); = faster but addional modification to json
$file = fopen(__DIR__ . '/NOGITCARS.csv', 'r');
$cars = [];
while (($line = fgetcsv($file, 0, ';')) !== false) {
    $line[2] = number_format((double) str_replace(':', ',', str_replace(',', '.', str_replace('.', ':', $line[2]))), 2);
    $line[3] = number_format((double) str_replace(':', ',', str_replace(',', '.', str_replace('.', ':', $line[3]))), 2);
    $line[4] = number_format((double) str_replace(':', ',', str_replace(',', '.', str_replace('.', ':', $line[4]))), 2);
    $line[5] = number_format((double) str_replace(':', ',', str_replace(',', '.', str_replace('.', ':', $line[5]))), 2);
    $line[6] = number_format((double) str_replace(':', ',', str_replace(',', '.', str_replace('.', ':', $line[6]))), 2);
    $cars[$line[0]] = $line;
}
fclose($file);
$file = fopen(__DIR__ . '/NOGIT.csv', 'r');
//$bookentries = [];
$carData = [];
$accountData = [];
while (($line = fgetcsv($file)) !== false) {
    //$bookentries[] = $line;
    if (array_key_exists($line[9], $cars) || $line[9] === '') {
        if ($line[9] === '') {
            $line[9] = 'EMPTY';
        }
        $soll = (double) str_replace(':', ',', str_replace(',', '.', str_replace('.', ':', $line[3])));