固定打印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'); $time = $flow->created_at->format('Y-m-d H:i:s');
$sn = $flow->sn; $sn = $flow->sn;
$ukeys = explode(',', $request->input('ukeys', '')); $ukeys = explode(',', $request->input('ukeys', ''));
$i = 0;
foreach($rows as $item){ foreach($rows as $item){
if($i<4){
if(in_array($item['ukey'], $ukeys)){ if(in_array($item['ukey'], $ukeys)){
$i++;
$list[] = $item; $list[] = $item;
} }
}else{
break;
} }
}
for($i; $i<4; $i++){
$list[] = [
'ukey' => '',
'name' => '',
'fee_name' => '',
'fee_value' => 0,
];
}
if(count($list) > 0){ if(count($list) > 0){
$total = collect($list)->sum('fee_value'); $total = collect($list)->sum('fee_value');
if($total > 0){ if($total > 0){

View File

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