<section class="container" style="padding-bottom: 2rem;">
	<div class="row">
		<div class="col">
			<div class="card bg-light-transparent">
				<div class="card-body">
					<div class="card bg-white no-shadow">
						<div class="card-body">
                            <form action="<?php echo base_url('hr/claim/total_claim_by_business_entities'); ?>" method="post">
                                <div class="row">
                                    
        
                                        <div class="col">
                                            <label>Month</label>
                                            <select name="month" class="form-control">
                                                <option value="1" <?php echo ($month == 1)?'selected':''; ?>>January</option>
                                                <option value="2" <?php echo ($month == 2)?'selected':''; ?>>February</option>
                                                <option value="3" <?php echo ($month == 3)?'selected':''; ?>>March</option>
                                                <option value="4" <?php echo ($month == 4)?'selected':''; ?>>April</option>
                                                <option value="5" <?php echo ($month == 5)?'selected':''; ?>>May</option>
                                                <option value="6" <?php echo ($month == 6)?'selected':''; ?>>June</option>
                                                <option value="7" <?php echo ($month == 7)?'selected':''; ?>>July</option>
                                                <option value="8" <?php echo ($month == 8)?'selected':''; ?>>August</option>
                                                <option value="9" <?php echo ($month == 9)?'selected':''; ?>>September</option>
                                                <option value="10" <?php echo ($month == 10)?'selected':''; ?>>October</option>
                                                <option value="11" <?php echo ($month == 11)?'selected':''; ?>>November</option>
                                                <option value="12" <?php echo ($month == 12)?'selected':''; ?>>December</option>
                                            </select>
                                        </div>

                                        <div class="col">
                                            <label>Year</label>
                                            <select name="year" class="form-control">
                                                <?php for($i = 0; $i <= 5; $i++){ ?>
                                                    <option value="<?php echo date('Y',strtotime('-'.$i.' years')); ?>" <?php echo (date('Y',strtotime('-'.$i.' years')) == $year)?'selected':''; ?>><?php echo date('Y',strtotime('-'.$i.' years')); ?></option>
                                                <?php } ?>
                                            </select>
                                        </div>

                                        <div class="col-2 pt-1">
                                            <br>
                                            <button type="submit" class="btn btn-primary">Search</button>
                                        </div>
                                
                                </div>
                            </form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</section> 


    <div class="container mb-5">
        <div class="card bg-light-transparent">
            <div class="card-header bg-white">
                <div class="row">
                    <div class="col-12 col-md-6">
                        <h5 class="card-title">
                            Total Summary Claim By Business Entities
                        </h5>
                    </div>
                    <div class="col-12 col-md-6 text-right">
                        <a href="<?php echo base_url('hr/claim/report_total_by_business_entities/'.$month.'/'.$year); ?>" class="btn btn-sm btn-outline-dark" target="_blank"><i class="fas fa-print"></i> Print</a>
                    </div>
                </div>
            </div>
            <div class="card-body">
                <div class="card bg-white no-shadow">
                    <div class="card-body">
                    
                        <?php if((!empty($month)) && (!empty($year))): ?>

                            <div class="row">
                                <div class="col-4 mx-auto py-5 text-center">
                                    <img src="<?php echo base_url('assets/images/logo/salihin-logo.png'); ?>" class="img img-fluid">
                                    <h5 class="text-uppercase mt-3"><b>Claim <?php echo $year; ?> - <?php echo $submisson_month; ?></b></h5>
                                </div>
                            </div>
                            <?php $grand_total = 0; ?>
                            <?php if(!empty($reports)) foreach($reports as $key => $report): ?>
                            <div class="row">
                                <div class="col-8">
                                    <b><u><?php echo $report['business_entity_name']; ?></u></b>
                                </div>
                            </div>
                                <?php $subtotal = 0; ?>
                                <?php if(!empty($report['claims'])) foreach($report['claims'] as $inner_key => $claim): ?>
                                    <div class="row">
                                        <div class="col-8">
                                        &emsp;<?php echo $claim['name']; ?>
                                        </div>
                                        <div class="col-4 text-right">
                                            <?php echo number_format($claim['monthly_claim'],2); $subtotal += $claim['monthly_claim']; ?>
                                        </div>
                                    </div>
                                <?php endforeach;?>
                            <div class="row">
                                <div class="col-8 text-uppercase">
                                    <b>sub total</b>
                                </div>
                                <div class="col-4 text-right" style="border-top:1px solid; border-bottom:double;">
                                    <?php echo number_format($subtotal,2); $grand_total += $subtotal; ?>
                                </div>
                            </div>

                            <br>
                            <?php endforeach;?>

                            <div class="row">
                                <div class="col-8 text-uppercase">
                                    <b>total</b>
                                </div>
                                <div class="col-4 text-right" style="border-top:1px solid; border-bottom:double;">
                                    <?php echo number_format($grand_total,2); ?>
                                </div>
                            </div>


                        <?php endif; ?>


                    </div>
                </div>
            </div>
        </div>
    </div>
