mirror of
https://github.com/Karaka-Management/oms-Exchange.git
synced 2026-02-11 15:28:40 +00:00
more code fixes
This commit is contained in:
parent
92efabd600
commit
c0b8123a00
|
|
@ -12,10 +12,19 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Exchange\Models\NullReport;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
/** @var array $data */
|
||||
$report = $this->data['report'] ?? [];
|
||||
$headlines = \array_keys(\reset($report->data));
|
||||
|
||||
/** @var \Modules\Exchange\Models\Report $report */
|
||||
$report = $this->data['report'] ?? new NullReport();
|
||||
|
||||
$first = \reset($report->data);
|
||||
if ($first === false) {
|
||||
$first = [];
|
||||
}
|
||||
|
||||
$headlines = \array_keys($first);
|
||||
|
||||
$out = \fopen('php://output', 'w');
|
||||
if ($out !== false) {
|
||||
|
|
|
|||
|
|
@ -12,24 +12,34 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Exchange\Models\NullReport;
|
||||
use Modules\Media\Models\NullCollection;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use phpOMS\Utils\StringUtils;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
|
||||
/** @var array<array> $data */
|
||||
$report = $this->data['report'] ?? [];
|
||||
/** @var \Modules\Exchange\Models\Report $report */
|
||||
$report = $this->data['report'] ?? new NullReport();
|
||||
|
||||
include $this->data['defaultTemplates']->findFile('.xls.php')->getAbsolutePath();
|
||||
/** @var \Modules\Media\Models\Collection $collection */
|
||||
$collection = $this->data['defaultTemplates'] ?? new NullCollection();
|
||||
|
||||
include $collection->findFile('.xls.php')->getAbsolutePath();
|
||||
|
||||
$spreadsheet = new DefaultExcel();
|
||||
|
||||
$headlines = \array_keys(\reset($report->data));
|
||||
$first = \reset($report->data);
|
||||
if ($first === false) {
|
||||
$first = [];
|
||||
}
|
||||
|
||||
$headlines = \array_keys($first);
|
||||
foreach ($headlines as $j => $headline) {
|
||||
$spreadsheet->getActiveSheet()->setCellValue(StringUtils::intToAlphabet($j + 1) . 1, $headline);
|
||||
}
|
||||
|
||||
foreach ($data as $i => $row) {
|
||||
foreach ($report->data as $i => $row) {
|
||||
foreach ($row as $j => $cell) {
|
||||
$spreadsheet->getActiveSheet()->setCellValue(StringUtils::intToAlphabet($j + 1) . ($i + 2), $cell);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,18 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Exchange\Models\NullReport;
|
||||
use Modules\Media\Models\NullCollection;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
|
||||
/** @var array<array> $data */
|
||||
$report = $this->data['report'] ?? [];
|
||||
/** @var \Modules\Exchange\Models\Report $report */
|
||||
$report = $this->data['report'] ?? new NullReport();
|
||||
|
||||
require_once $this->data['defaultTemplates']->findFile('.pdf.php')->getAbsolutePath();
|
||||
/** @var \Modules\Media\Models\Collection $collection */
|
||||
$collection = $this->data['defaultTemplates'] ?? new NullCollection();
|
||||
|
||||
require_once $collection->findFile('.pdf.php')->getAbsolutePath();
|
||||
|
||||
/** @phpstan-import-type DefaultPdf from ../../../../Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php */
|
||||
$pdf = new DefaultPdf();
|
||||
|
|
@ -27,7 +33,12 @@ $topPos = $pdf->getY();
|
|||
$tbl = '<table border="1" cellpadding="0" cellspacing="0">';
|
||||
|
||||
// headline
|
||||
$headlines = \array_keys(\reset($report->data));
|
||||
$first = \reset($report->data);
|
||||
if ($first === false) {
|
||||
$first = [];
|
||||
}
|
||||
|
||||
$headlines = \array_keys($first);
|
||||
$tbl .= '<thead><tr>';
|
||||
foreach ($headlines as $headline) {
|
||||
$tbl .= '<th>' . $headline . '</th>';
|
||||
|
|
|
|||
27
Models/NullReport.php
Normal file
27
Models/NullReport.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Exchange\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Exchange\Models;
|
||||
|
||||
/**
|
||||
* Null model.
|
||||
*
|
||||
* @package Modules\Exchange\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullReport extends Report
|
||||
{
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user