30 lines
928 B
PHP
30 lines
928 B
PHP
<?php // phpcs:ignoreFile
|
|
require "vendor/autoload.php";
|
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
ob_start();
|
|
include __DIR__ . '/includes/cropday.php';
|
|
$cropDayRaw = trim(ob_get_clean());
|
|
|
|
if ($cropDayRaw === '' || !ctype_digit($cropDayRaw)) {
|
|
error_log('Invalid crop day value: ' . $cropDayRaw);
|
|
die('Unable to determine crop day.');
|
|
}
|
|
|
|
$cropDay = (int) $cropDayRaw;
|
|
$path = sprintf('\\\\192.168.0.2\\xampp\\htdocs\\lasuca\\controls\\milllab\\2025 MILLLABREPORT\\2025 CROP YEAR\\CROP DAY %d\\cropday%dmilllab.xlsx', $cropDay, $cropDay);
|
|
|
|
if (!is_readable($path)) {
|
|
error_log('Mill lab file inaccessible: ' . $path);
|
|
die('Server account cannot reach the network file.');
|
|
}
|
|
|
|
$reader=IOFactory::createReader("Xlsx");
|
|
$spreadsheet=$reader->load($path);
|
|
$writer=IOFactory::createWriter($spreadsheet, "Html");
|
|
|
|
header("Refresh: 120");
|
|
|
|
echo $writer->save("php://output");
|
|
?>
|