57 lines
1.4 KiB
PHP
Executable File

<?php
require_once('fixed/config/go_con.php');
/*
* QR Encoding Functions
*/
function __getLength($value)
{
return strlen($value);
}
function __toHex($value)
{
return pack("H*", sprintf("%02X", $value));
}
function __toString($__tag, $__value, $__length)
{
$value = (string) $__value;
return __toHex($__tag) . __toHex($__length) . $value;
}
function __getTLV($dataToEncode)
{
$__TLVS = '';
for ($i = 0; $i < count($dataToEncode); $i++) {
$__tag = $dataToEncode[$i][0];
$__value = $dataToEncode[$i][1];
$__length = __getLength($__value);
$__TLVS .= __toString($__tag, $__value, $__length);
}
return $__TLVS;
}
$dataToEncode = [
[1, $campany_info['company_name']],
[2, $campany_info['vat_number']],
[3, date("Y-m-d\TH:i:s", strtotime('2024-03-09 11:13:38'))],
[4, 460.00],
[5, 60.00]
];
$__TLV = __getTLV($dataToEncode);
$__QR = base64_encode($__TLV);
?>
<td colspan="4" align="center" height="35px">
<img src="https://chart.googleapis.com/chart?chs=215x215&cht=qr&chl=<?= $__QR ?>&chld=L|0&choe=UTF-8"
width="215" height="215">
<br>
--- Check Closed ---
</td>
<p>https://chart.googleapis.com/chart?chs=215x215&cht=qr&chl=<?= $__QR ?>&chld=L|0&choe=UTF-8</p>