固定打印4行信息

develop
vine_liutk 2023-06-16 12:13:39 +08:00
parent 1954065299
commit 47f610eefc
2 changed files with 23 additions and 6 deletions

View File

@ -28,11 +28,27 @@ class PrintController extends Controller
$time = $flow->created_at->format('Y-m-d H:i:s');
$sn = $flow->sn;
$ukeys = explode(',', $request->input('ukeys', ''));
$i = 0;
foreach($rows as $item){
if(in_array($item['ukey'], $ukeys)){
$list[] = $item;
if($i<4){
if(in_array($item['ukey'], $ukeys)){
$i++;
$list[] = $item;
}
}else{
break;
}
}
for($i; $i<4; $i++){
$list[] = [
'ukey' => '',
'name' => '',
'fee_name' => '',
'fee_value' => 0,
];
}
if(count($list) > 0){
$total = collect($list)->sum('fee_value');
if($total > 0){

View File

@ -62,14 +62,14 @@
<th style="width: 5%;">序号</th>
<th style="width: 25%;">费用类别</th>
<th style="width: 30%;">起止日期</th>
<th style="width: 15%;">金额</th>
<th style="width: 15%;">金额(元)</th>
<th style="width: 25%;">备注</th>
</tr>
@foreach($list as $item)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$item['fee_name']}}</td>
<td>{{$timeZone}}</td>
<td>{{$item['name']}}-{{$item['fee_name']}}</td>
<td>@if(empty($item['name']))-@else{{$timeZone}}@endif</td>
<td>{{$item['fee_value']}}</td>
<td>
<input type="text" style="border:none">
@ -78,7 +78,8 @@
@endforeach
<tr>
<td colspan="3" style=" text-align: left;">合计大写:{{$bigTotal}}</td>
<td colspan="2">{{$total}}</td>
<td >{{$total}}</td>
<td ></td>
</tr>
</table>
<p class="tag" style="font-size:20px;">