Files
citrus-cms/resources/views/admin-ajax/document-print.blade.php
T
2026-04-28 21:15:09 +03:00

52 lines
1.3 KiB
PHP

<?php
use Barryvdh\DomPDF\Facade\Pdf;
$pdf = App::make('dompdf.wrapper');
$pdf->setPaper('A4','portrait');
$documentInfo = document_template(get("document_id"));
$data = db(get("table_name"))->where("id", get("id"))->first();
$users = usersArray();
$fileName = $data->ndt_release_no;
?>
<?php
$start = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body{
font-family: DejaVu Sans;
}
table,tr,td {
border:solid 1px #000 !important;
}
* {
font-size:12px;
}
</style>
</head>
<body>';
$end = "</body>
</html>";
$document = $start . $documentInfo->html . $end;
$document = str_replace("{today}", date("d/m/Y"), $document);
foreach($data AS $column => $value) {
if($column == "spool_ndt_check") {
if(isset($users[$value])) {
$value = $users[$value]->name;
}
}
$document = str_replace("{" . $column . "}", $value, $document);
}
echo $document;
$path = "004_QA/0009_Spool_Release_Check_List";
html_create("$path/$fileName", $document);
?>