<style>
    .row-col-10
    {
        width:10%;
    }

    .row-col-20
    {
        width:20%;
    }

    .row-col-25
    {
        width:25%;
    }

    .row-col-30
    {
        width:30%;
    }

</style>

<header>
	<div class="row">
		<div class="col-12">
			<div class="t-corp pull-left">
				<div class="t-corp-logo">
					<img src="<?php echo base_url().'assets/images/logo/salihin-logo.png'; ?>" alt="company logo" />
				</div>
				<div class="t-corp-name"><b>SPS</b> | HR SYSTEM</div>
			</div>
		</div>
	</div>
	<div class="row">
        <div class="col-md-8">
            <table class="table-bordered" width="100%" style="font-size:8pt">
                <tr>
                    <td class="p-1"><b>EMP NAME</b></td>
                    <td><?php echo ($user['name'])?strtoupper($user['name']):''; ?></td>
                </tr>
                <tr>
                    <td class="p-1"><b>EMP CODE</b></td>
                    <td><?php echo ($user['staff_id'])?strtoupper($user['staff_id']):''; ?></td>
                </tr>
                <tr>
                    <td class="p-1"><b>POSITION</b></td>
                    <td><?php echo ($user['position_name'])?strtoupper($user['position_name']):''; ?></td>
                </tr>
                <tr>
                    <td class="p-1"><b>COMPANY</b></td>
                    <td><?php echo ($user['company_name'])?strtoupper($user['company_name']):''; ?></td>
                </tr>
                <tr>
                    <td class="p-1"><b>DEPARTMENT</b></td>
                    <td><?php echo ($user['department_name'])?strtoupper($user['department_name']):''; ?></td>
                </tr>
                <tr>
                    <td class="p-1"><b>MONTH / YEAR</b></td>
                    <td><?php echo strtoupper(date('F Y',strtotime('01-'.$month.'-'.$year))); ?></td>
                </tr>
            </table>
        </div>
	</div>
</header>

<div class="row table-responsive" style="margin-top:2rem;font-size:8pt;">
    <div class="col">        
        <table class="table table-bordered" style="width:100%;">
            <thead>
                <tr>
                    <th class="row-col-10" rowspan="2">DATE</th>
                    <th class="row-col-25" rowspan="2">DESTINATION / CLIENT</th>
                    <th class="row-col-25" rowspan="2">NATURE OF WORK / DESCRIPTION</th>
                    <th class="row-col-10" rowspan="2">ClAIM TYPE</th>
                    <th class="row-col-20" colspan="2">AMOUNT</th>
                    <th class="row-col-10" >TOTAL</th>
                </tr>
                <tr>
                    <th style="width:10%;">UNIT MEASURE</th>
                    <th style="width:10%;">MYR</th>
                    <th>MYR</th>
                </tr>
            </thead>
            <tbody>
                <?php if(!empty($outpatients)) foreach($outpatients as $key => $value):?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->date)); ?></td>
                        <td><?php echo strtoupper($value->clinic_name); ?></td>
                        <td><?php echo strtoupper($value->treatment); ?></td>
                        <td><?php echo strtoupper('outpatient'); ?></td>
                        <td></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                    </tr>
                <?php endforeach; ?>

                <?php if(!empty($hospitalizations)) foreach($hospitalizations as $key => $value):?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->date)); ?></td>
                        <td><?php echo strtoupper($value->clinic_name); ?></td>
                        <td><?php echo strtoupper($value->treatment); ?></td>
                        <td><?php echo strtoupper('hospitalization'); ?></td>
                        <td></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                    </tr>
                <?php endforeach;?>

                <?php if($dentals) foreach($dentals as $key => $value):?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->date)); ?></td>
                        <td><?php echo strtoupper($value->clinic_name); ?></td>
                        <td></td>
                        <td><?php echo strtoupper('dental and optical'); ?></td>
                        <td></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                    </tr>
                <?php endforeach; ?>    

                <?php if($mileage) foreach($mileage as $key => $value): ?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->travelling_date)); ?></td>
                        <td><?php echo strtoupper($value->client); ?></td>
                        <td><?php echo strtoupper($value->task); ?></td>
                        <td><?php echo strtoupper('mileage'); ?></td>
                        <td></td>
                        <td><?php echo number_format($value->mileage_amount_approved,2); ?></td>
                        <td><?php echo number_format($value->mileage_amount_approved,2); ?></td>
                    </tr>
                <?php endforeach;?>

                <?php if($accomodation) foreach($accomodation as $key => $value):?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->date_from)); ?></td>
                        <td>
                            <ol>
                            <?php if($value->staff_movements) foreach($value->staff_movements as $move_key => $move_value): ?>
                                <li><?php echo strtoupper($move_value->destination);?></li>
                            <?php endforeach; ?>
                            </ol>
                        </td>
                        <td></td>
                        <td><?php echo strtoupper('accomodation'); ?></td>
                        <td></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                    </tr>
                <?php endforeach; ?>

                <?php if($subsistence) foreach($subsistence as $key => $value): ?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->date_from)); ?></td>
                        <td>
                            <ol>
                            <?php if($value->staff_movements) foreach($value->staff_movements as $move_key => $move_value): ?>
                                <li><?php echo strtoupper($move_value->destination); ?></li>
                            <?php endforeach; ?>
                            </ol>
                        </td>
                        <td></td>
                        <td><?php echo strtoupper($value->allowance);?></td>
                        <td></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                    </tr>
                <?php endforeach; ?>

                <?php if($transportation) foreach($transportation as $key => $value): ?>
                    <tr>
                        <td><?php echo date('d-m-Y',strtotime($value->date)); ?></td>
                        <td>
                            <ol>
                            <?php if($value->staff_movements) foreach($value->staff_movements as $move_key => $move_value): ?>
                                <li><?php echo strtoupper($move_value->destination); ?></li>
                            <?php endforeach; ?>
                            </ol>
                        </td>
                        <td>
                            <?php echo strtoupper($value->description); ?>
                        </td>
                        <td><?php echo strtoupper('transportation'); ?></td>
                        <td></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                        <td><?php echo number_format($value->amount_approved,2); ?></td>
                    </tr>
                <?php endforeach; ?>

                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th colspan="6"></th>
                    <th><b>TOTAL</b></th>
                </tr>
            </tfoot>
        </table>
    </div>
</div>
