php 带有页眉和页脚的Laravel打印
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 带有页眉和页脚的Laravel打印相关的知识,希望对你有一定的参考价值。
<!doctype html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>{{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="Laravel Base">
<meta name="author" content="nazroltech">
<meta name="robots" content="noindex, nofollow">
<!-- Icons -->
<link rel="shortcut icon" href="{{ asset('media/favicons/favicon.png') }}">
<link rel="icon" sizes="192x192" type="image/png" href="{{ asset('media/favicons/favicon-192x192.png') }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('media/favicons/apple-touch-icon-180x180.png') }}">
<!-- Fonts and Styles -->
@yield('css_before')
<link rel="stylesheet" id="css-main" href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,400i,600,700">
<link rel="stylesheet" id="css-theme" href="{{ mix('css/dashmix.css') }}">
<style>
thead {
display: table-header-group;
}
tfoot {
display: table-footer-group;
}
</style>
@yield('css_after')
</head>
<body>
<!-- Page Container -->
<div id="page-container" class="">
<!-- Main Container -->
<main id="main-container">
<table>
<thead>
<tr>
<th>
<!-- printing header here -->
<div class="text-center">
<img src="{{ asset('img/company-logo.png') }}" width="100" />
{!! $header ?? null !!}
</div>
<div class="content">
Printed Date: {{ date('d/M/Y H:i A') }}
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
@yield('content')
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<!-- printing footer here -->
{{ $footer ?? null }}
</td>
</tr>
</tfoot>
</table>
</main>
<!-- END Main Container -->
</div>
<!-- END Page Container -->
@yield('js_after')
</body>
</html>
@php
$header = '<h3>Report</h3>';
@endphp
@extends('layouts.printing', ['header' => $header])
@section('css_before')
@endsection
@section('js_after')
<script>
window.print();
</script>
@endsection
@section('content')
<!-- Page Content -->
<div class="content">
<!-- Your Block -->
<div>
@foreach($asset_depreciation_details as $asset_depreciations_detail)
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th colspan="7">
Nama Aset: {{ $asset_depreciations_detail[0]->asset->asset_name ?? null }}
</th>
</tr>
<tr>
<th>Bil</th>
<th>Tahun</th>
<th>Harga Kos (RM)</th>
<th>Kadar (%)</th>
<th>Susut Nilai (RM)</th>
<th>Susut Nilai Terkumpul (RM)</th>
<th>Nilai Buku Bersih (RM)</th>
</tr>
</thead>
<tbody>
@foreach($asset_depreciations_detail as $key => $asset_depreciation)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $asset_depreciation->year }}</td>
<td>{{ $asset_depreciation->cost }}</td>
<td>{{ $asset_depreciation->depreciation_rate }}</td>
<td>{{ $asset_depreciation->depreciated_amount }}</td>
<td>{{ $asset_depreciation->accumulated_depreciated_amount }}</td>
<td>{{ $asset_depreciation->item_book_value }}</td>
</tr>
@endforeach
</tbody>
</table>
@endforeach
</div>
<!-- END Your Block -->
</div>
<!-- END Page Content -->
@endsection
以上是关于php 带有页眉和页脚的Laravel打印的主要内容,如果未能解决你的问题,请参考以下文章