<style> .red { color: #eb4034; } .uppercase { text-transform: uppercase } <?php if(isset($isExcel)): ?> #tb td, #tb th { border: 1px solid #000000; } td { text-align: center; } th { text-align: center; } <?php endif; ?> </style> <table class="table table-striped table-bordered table-hover" id="tb"> <tr> <th colspan="8" class="uppercase">Báo cáo tiền cọc giữ của khách</th> </tr> <tr> <th>STT</th> <th>Nhà</th> <th>Phòng</th> <th>Khách thuê</th> <th>SĐT</th> <th>Loại tiền cọc</th> <th>Tiền cọc</th> <th>Ngày cọc</th> </tr> <tr> <th></th> <th>Tất cả nhà</th> <th></th> <th></th> <th></th> <th></th> <th><?php echo e(number_format($sumDeposits, 0,'.', '.')); ?></th> <th></th> </tr> <?php $__currentLoopData = $hostels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hostel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php
                $hostelDeposit = App\Models\Deposit::query()
        ->where('hostel_id', $hostel->id)
        ->where(function($q) {
               $q->orHas('reserve');
               $q->orHas('contractValid');
           })
           ->where(function($q) {
               $q->has('room');
           })
        ->sum('amount');
                ?> <tr> <?php $span = 0; ?> <?php $__currentLoopData = $hostel->rooms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $room): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $__currentLoopData = $room->deposits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $deposit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $span++; ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <td><strong><?php echo e(\App\Components\Functions::numberToRomanRepresentation($loop->index+1)); ?></strong></td> <td rowspan="<?php echo e($span + 1); ?>"> <strong><?php echo e($hostel->name); ?></strong></td> <td><strong>Tất cả</strong></td> <td></td> <td></td> <td></td> <td><strong><?php echo e(number_format($hostelDeposit, 0,'.', '.')); ?></strong></td> <td></td> </tr> <?php $i = 0;?> <?php $__currentLoopData = $hostel->rooms; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $room): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $__currentLoopData = $room->deposits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $deposit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $i+=1;?> <tr> <td><?php echo e($i); ?></td> <?php if(isset($isExcel)): ?> <td></td> <?php endif; ?> <td><?php echo e($room->name); ?></td> <td><?php if($deposit->contract): ?><?php echo e($deposit->contract->name); ?> <?php elseif($deposit->reserve): ?> <?php echo e($deposit->reserve->name); ?> <?php endif; ?></td> <td><?php if($deposit->contract): ?><?php echo e($deposit->contract->phone); ?> <?php elseif($deposit->reserve): ?> <?php echo e($deposit->reserve->phone); ?> <?php endif; ?></td> <td><?php if($deposit->contract): ?> Cọc hợp đồng <?php elseif($deposit->reserve): ?> Cọc giữ chỗ <?php endif; ?></td> <td><?php if(isset($isExcel)): ?> <?php echo e($deposit->amount); ?> <?php else: ?> <?php echo e(number_format($deposit->amount, 0,'.', '.')); ?> <?php endif; ?></td> <td><?php echo e($deposit->created_at->format('d/m/Y')); ?> </td> </tr> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </table>