<section class="container" style="padding-bottom: 2rem;">
	<div class="row">
		<div class="col">
			<div class="card bg-light-transparent">
                <form action="<?php echo base_url('hr/claim/total_claim_by_type'); ?>" method="post">
                    <div class="card-body">
                        <div class="card bg-white no-shadow">
                            <div class="card-body">
                                <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 ($year == date('Y',strtotime('-'.$i.' years')))?'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>
                            </div>
                        </div>
                    </div>
                </form>
			
			</div>
		</div>
	</div>
</section> 

<div class="container">
    <div class="card bg-light-transparent mb-5">
        <div class="card-header bg-white">
            <div class="row">
                <div class="col-12 col-md-6">
                    <h5 class="card-title">
                        Total claim by claim type
                    </h5>
                </div>
                <div class="col-12 col-md-6 text-right">
                    <a href="<?php echo base_url('hr/claim/report_total_claim_by_type/'.$month.'/'.$year); ?>" target="_blank" class="btn btn-outline-dark"><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($year) && !empty($month)): ?>
                        <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>Summary grand total claim <?php echo $submission_month; ?></b></h5>
                            </div>
                        </div>
                                                    
                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right"><b>No</b></div>
                            <div class="col border text-uppercase p-3"><b>Item</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b>Total</b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">1</div>
                            <div class="col border text-uppercase p-3"><b>Mileage</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['mileage_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">2</div>
                            <div class="col border text-uppercase p-3"><b>Meals Allowance</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['meals_approved'] + $results['subsistence_meals'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">3</div>
                            <div class="col border text-uppercase p-3"><b>Outstation Allowance</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['subsistence_outstation'],2); ?></b></div>
                        </div>

                        <!-- <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">4</div>
                            <div class="col border text-uppercase p-3"><b>SSM</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php //echo number_format($results['others_ssm_search'],2); ?></b></div>
                        </div> -->

                        <!-- <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">5</div>
                            <div class="col border text-uppercase p-3"><b>Oath</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php //echo number_format($results['others_stamping'],2); ?></b></div>
                        </div> -->

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">4</div>
                            <div class="col border text-uppercase p-3"><b>Medical</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['hospitalization_approved'] + $results['outpatient_approved'] + $results['medical_screening_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">5</div>
                            <div class="col border text-uppercase p-3"><b>Dental/Optical</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['dental_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">6</div>
                            <div class="col border text-uppercase p-3"><b>Panel Clinic</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['panel_claim'],2); ?></b></div>
                        </div>

                        <!-- <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">9</div>
                            <div class="col border text-uppercase p-3"><b>Courier/Postage</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php //echo number_format($results['other_courier'],2); ?></b></div>
                        </div> -->

                        <!-- <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">10</div>
                            <div class="col border text-uppercase p-3"><b>Printing Stationary</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php //echo number_format($results['others_stationary'] + $results['others_printing'],2); ?></b></div>
                        </div> -->

                        <!-- <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">11</div>
                            <div class="col border text-uppercase p-3"><b>Motor Vehicle</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php //echo number_format($results['others_motor_expenses'],2); ?></b></div>
                        </div> -->

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">7</div>
                            <div class="col border text-uppercase p-3"><b>Toll</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['toll_claim_approved'] + $results['others_tng'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">8</div>
                            <div class="col border text-uppercase p-3"><b>Petrol</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['petrol_claim_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">9</div>
                            <div class="col border text-uppercase p-3"><b>Parking</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['parking_claim_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">10</div>
                            <div class="col border text-uppercase p-3"><b>E-Hailing / LRT</b></div>
                            <div class="col-2 border text-upppercase p-3 text-right"><b><?php echo number_format($results['transportation_e_hailing_approved'] + $results['transportation_car_rental_approved'] + $results['transportation_public_transport_approved'] + $results['transportation_trains_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">11</div>
                            <div class="col border text-uppercase p-3"><b>Flight</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['transportation_flight_approved'] + $results['others_airport_taxes'] + $results['others_service_taxes'] + $results['others_excess_baggage'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">12</div>
                            <div class="col border text-uppercase p-3"><b>Hotel/Accomodation</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['accomodation_claim_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">13</div>
                            <div class="col border text-uppercase p-3"><b>Entertainment</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['entertainment_claim_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">14</div>
                            <div class="col border text-uppercase p-3"><b>Membership</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['others_membership'] + $results['others_license'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">15</div>
                            <div class="col border text-uppercase p-3"><b>Training Allowance</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['trainer_claim_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">16</div>
                            <div class="col border text-uppercase p-3"><b>Special Allowance - Dressing</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['dressing_approved'],2); ?></b></div>
                        </div>

                        <div class="row">
                            <div class="col-1 border text-uppercase p-3 text-right">17</div>
                            <div class="col border text-uppercase p-3"><b>Special Allowance - Gadget</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b><?php echo number_format($results['gadget_approved'],2); ?></b></div>
                        </div>
                        
                        <div class="row">
                            <div class="col-1 border text-uppercase p-3"></div>
                            <div class="col border text-uppercase p-3"><b>Grand total</b></div>
                            <div class="col-2 border text-uppercase p-3 text-right"><b>
                                <?php
                                    $grand_total =  $results['dental_approved']
                                                +   $results['hospitalization_approved']
                                                +   $results['outpatient_approved']
                                                +   $results['medical_screening_approved']
                                                +   $results['meals_approved']
                                                +   $results['others_tng']
                                                // +   $results['others_purchase']
                                                // +   $results['others_call']
                                                +   $results['others_airport_taxes']
                                                +   $results['others_service_taxes']
                                                // +   $results['others_tips_and_portage']
                                                // +   $results['others_laundry']
                                                +   $results['others_excess_baggage']
                                                // +   $results['others_loss_in_foreign_exchange']
                                                // +   $results['others_firm_event']
                                                // +   $results['others_motor_expenses']
                                                // +   $results['others_ssm_search']
                                                // +   $results['others_book']
                                                // +   $results['others_stationary']
                                                +   $results['others_membership']
                                                // +   $results['others_printing']
                                                // +   $results['others_stamping']
                                                // +   $results['others_license']
                                                +   $results['mileage_approved']
                                                +   $results['accomodation_claim_approved']
                                                +   $results['subsistence_outstation']
                                                +   $results['subsistence_meals']
                                                +   $results['transportation_car_rental_approved']
                                                +   $results['transportation_flight_approved']
                                                +   $results['transportation_public_transport_approved']
                                                +   $results['transportation_e_hailing_approved']
                                                +   $results['transportation_trains_approved']
                                                +   $results['parking_claim_approved']
                                                +   $results['toll_claim_approved']
                                                +   $results['trainer_claim_approved']
                                                +   $results['panel_claim']
                                                +   $results['petrol_claim_approved']
                                                +   $results['entertainment_claim_approved']
                                                +   $results['dressing_approved']
                                                +   $results['gadget_approved'];
                                                // +   $results['other_courier']

                                    echo number_format($grand_total,2);
                                ?>
                            </b></div>
                        </div>

                    <?php endif; ?>

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