<?php if(count($em['em_id']) > 0): ?>
    <div id="DivIdToPrint">
        <style>
            @page  {
                size: auto;
                margin: 10px auto;
            }
            @media  print {
                html, body {
                    width: 210mm;
                    height: 297mm;

                }
                .page-break{
                    page-break-before: always;
                }
                table, th, td {
                    padding: 5px !important;
                }
            }
            table {
                border-collapse: collapse;
            }

            table, th, td {

            }
            table thead th {
                border: 1px solid black !important;
            }
            .container{
                width: 1024px;
                margin: 0 auto;

            }
            .battambong
            {
                font-family: khmer os battambang !important;
                font-size: 12px;
            }
            .arial
            {
                font-family: Arial, Helvetica, sans-serif, khmer os battambang !important;
                font-size: 12px;
            }
        </style>
        <div class="col-sm-12 col-xs-12">
            <div class="wrapper-table">
                <table id="tblData" class="table table-bordered"  border="1" style="width: 100%;border-collapse: collapse;">
                    <thead>
                        <tr>
                            <th rowspan="2">No</th>
                            <th rowspan="2">Code</th>
                            <th rowspan="2">Name</th>
                            <?php
                                $hh = [];
                            ?>
                            <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $date): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $sun_day = \App\Helpers\IDate::getDayName($date);
                                        $styles = '';
                                        if ($sun_day == 'Sunday' || $sun_day =='Saturday')
                                        {
                                            $styles = 'color:crimson;';
                                        }
                                    $getHol = \App\Helpers\IDate::getHol(\Carbon\Carbon::parse($date)->format('Y/m/d'),$sun_day);
                                    $hh[$date] = $getHol;
                                ?>
                                <th colspan="7" style="text-align: center; <?php echo e($styles. $hh[$date]); ?>" nowrap>
                                    <?php echo e(\Carbon\Carbon::parse($date)->format('d/m/Y')); ?>

                                </th>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tr>
                        <tr>
                            <?php
                                $hh = [];
                                $ss = [];
                            ?>
                            <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $date): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $sun_day = \App\Helpers\IDate::getDayName($date);
                                    $styles = '';
                                    if ($sun_day == 'Sunday' || $sun_day == 'Saturday')
                                    {
                                        $styles = 'color:crimson;';
                                    }

                                    $getHol = \App\Helpers\IDate::getHol(\Carbon\Carbon::parse($date)->format('Y/m/d'), $sun_day);
                                    $hh[$date] = $getHol;
                                ?>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">in</th>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">out</th>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">Late</th>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">Before</th>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">OT</th>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">BOT</th>
                                <th style="<?php echo e($styles.$hh[$date]); ?>">TOT</th>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tr>
                    </thead>
                    <tbody>
                    <?php
                        $attend_all = \App\Model\Hr\TimeAttendanceGenModel::whereIn('emp_id', $em['em_id'])
                                                                        ->whereDate('att_date', '>=', date('Y-m-d', strtotime($from_date)))
                                                                        ->whereDate('att_date', '<=', date('Y-m-d', strtotime($to_date)))
                                                                        ->get();
                                                                        // dd($attend_all);
                        $arr_att_all = [];
                        if(count($attend_all) > 0)
                        {
                            foreach ($attend_all as $att_row)
                            {
                                if($att_row->att_date != null)
                                $arr_att_all[$att_row->emp_id][Carbon\Carbon::parse($att_row->att_date)->format('Y-m-d')] = $att_row;
                            }
                        }
                    ?>
                    <?php $__currentLoopData = $em['rows']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><?php echo e($loop->index+1); ?></td>
                            <td><?php echo e($row->code); ?></td>
                            <td nowrap=""><?php echo e($row->name); ?></td>
                            <?php
                                $ss = [];
                                $hh = [];
                            ?>
                            <?php $__currentLoopData = $dates; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $date): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $attend  = isset($arr_att_all[$row->id][$date])? $arr_att_all[$row->id][$date]: null;
                                    $sun_day = \App\Helpers\IDate::getDayName($date);
                                    $styles = '';
                                    if ($sun_day == 'Sunday' || $sun_day == 'Saturday')
                                    {
                                        $styles = 'color:crimson;';
                                    }

                                    $getHol = \App\Helpers\IDate::getHol(\Carbon\Carbon::parse($date)->format('Y/m/d'), $sun_day);
                                    $hh[$date] = $getHol;
                                ?>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e(optional($attend)->cin != null?\Carbon\Carbon::parse(optional($attend)->cin)->format('H:i'):'-'); ?></td>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e(optional($attend)->cout != null?\Carbon\Carbon::parse(optional($attend)->cout)->format('H:i'):'-'); ?></td>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e((optional($attend)->late > 0 ? optional($attend)->late:'-')); ?> </td>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e((optional($attend)->befor > 0 ? optional($attend)->befor :'-')); ?> </td>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e((optional($attend)->ot > 0 ? optional($attend)->ot :'-')); ?> </td>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e((optional($attend)->bot > 0 ? optional($attend)->ot :'-')); ?> </td>
                                <td style="<?php echo e($styles.$hh[$date]); ?>"><?php echo e((optional($attend)->total_ot > 0 ? optional($attend)->ot :'-')); ?> </td>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
<?php else: ?>
    <h1>No data!!</h1>
<?php endif; ?>
<?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/hr/report-attendance/daily_attend_detail.blade.php ENDPATH**/ ?>