<style type="text/css">
	.report-font{
		font-size: 12pt;
	}

	.horizontal-line{
		width: 100%;
    	border-top: 4px solid #444;
    	margin: 10px 0 0;
	}
	
	.h-line{
		width: 100%;
    	border-top: 4px solid #444;
    	margin: 10px 0 0;
	}

	@media print{
		.horizontal-line{
    	page-break-after: always;
		}
	}

	@page {
       @bottom-left {
            content: counter(page) "/" counter(pages);
        }
     }
</style>

<div class="container">
	<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 class="report-title pull-right">
					<h4> STAFF INFORMATION AS AT <?php echo $date ?></h4>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-12">
				<table class="company">
					<tr>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
						<td class="details">
							<span><b>SALIHIN (AF 1426)</b></span>
							<span>555, Jalan Samudra Utara 1, Taman Samudra, Batu Caves,</span>
							<span>68100, Batu Caves, Selangor</span>
							<span>Phone: 03-6185 9970 &nbsp;&nbsp; Fax: 03-6185 9970</span>
							<span>Website: salihin.com.my</span>
						</td>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</header>

	<!-- personal data information -->
	<div class="col-12" style="margin-top:2rem">
		<div class="row">
			<div class="col">
				<h3><b>PERSONAL DETAILS</b></h3>
			</div>
		</div>
		<div class="row">
			<div class="col-3 col-md-2 p-0" >
				<img src="<?php echo $profile_picture; ?>" class="img img-fluid img-thumbnail" style="background-color:#dedede">
			</div>
			<div class="col d-flex">
				<div class="align-self-end w-100">

					<div class="row">
						<div class="col-5">
							<b>TITLE</b>
						</div>
						<div class="col">
							<p class="report-font">: 
							<?php if(!empty($latest_profile->title_id)){ 
								foreach ($titles as $key => $title): ?>
									<?php if ($latest_profile->title_id == $title->id): ?>
										<?php echo strtoupper($title->title);?>
									<?php endif ?>
								<?php endforeach ?>
							<?php }else{ ?>
							N/A
							<?php } ?>
							</p>
						</div>
					</div>

					<div class="row">
						<div class="col-5">
							<b>NAME</b>
						</div>
						<div class="col">
							<p class="report-font">: <?php echo ($staff['name'])?strtoupper($staff['name']):'N/A';?></p>
						</div>
					</div>
					
					<div class="row">
						<div class="col-5">
							<b>STAFF ID</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty($staff['staff_id']))?strtoupper($staff['staff_id']):'N/A'; ?>
							</p>
						</div>
					</div>

					<div class="row">
						<div class="col-5">
							<b>GENDER</b>
						</div>
						<div class="col">
							<p class="report-font">: 
								<?php if (!empty($latest_profile->gender_id)) {?>
									<?php if ($latest_profile->gender_id == 1): ?>
										MALE
										<?php else: ?>
										FEMALE	
									<?php endif ?>
								<?php }else{ ?>
										N/A
								<?php } ?>
							</p>
						</div>
					</div>

					<div class="row">
						<div class="col-5">
							<b>NRIC / PASSPORT NO</b>
						</div>
						<div class="col">
							<p class="report-font">: 
							<?php echo (!empty($latest_profile->ic_no))?$latest_profile->ic_no:'N/A'; ?>
							</p>
						</div>
					</div>

					<div class="row">
						<div class="col-5">
							<b>PASSPORT EXPIRED DATE</b>
						</div>
						<div class="col">
							<p class="report-font">:
								<?php echo (!empty(mysql_to_date_format($latest_profile->passport_expired_date)))?strtoupper(mysql_to_date_format($latest_profile->passport_expired_date)):'N/A'; ?>
							</p>
						</div>
					</div>

					<div class="row">
						<div class="col-5">
							<b>WORKING PERMIT EXPIRED DATE</b>
						</div>
						<div class="col">
							<p class="report-font">: 
								<?php echo (!empty(mysql_to_date_format($latest_profile->working_expired_date)))?strtoupper(mysql_to_date_format($latest_profile->working_expired_date)):'N/A'; ?>
							</p>
						</div>
					</div>

					<div class="row">
						<div class="col-5">
							<b>PLACE OF ISSUE</b>
						</div>
						<div class="col">
							<p class="report-font">: 
								<?php
									echo (!empty($latest_profile->country_issue))?strtoupper($latest_profile->country_issue):'N/A';
								?>
							</p>
						</div>
					</div>

				</div>
			</div>
		</div>
	</div>
	<div class="col-12 mt-2">

		<div class="row my-3">
			<div class="col-3">
				<b>NATIONALITY</b>
			</div>
			<div class="col">:
				<?php if(!empty($latest_profile->citizen_id)){ ?>
					<?php foreach ($countries as $key => $country): ?>
						<?php 
							if ($country->id == $latest_profile->citizen_id){
								echo $country->country;
							}
						?>
					<?php endforeach ?>
				<?php 
					}else{
						echo 'N/A';
					}
				?>
			</div>
			<div class="col-3">
				<b>RESIDENTIAL STATUS</b>
			</div>
			<div class="col">:
				<?php 
					if (!empty($latest_profile->residential_id)) {
						if ($latest_profile->residential_id == 1) 
						{
							echo 'RESIDENT';
						}elseif($latest_profile->residential_id == 2)
						{
							echo 'NON RESIDENT';
						}
					}else{
						echo 'N/A';
					}
				?>
			</div>
		</div>

		<div class="row">
			<div class="col-3">
				<b>BIRTHDATE</b>
			</div>
			<div class="col">
				<p class="report-font">:
				<?php
					// $personal_detail_birth_date = 'N/A';
					// $valid_date = false;
					// if(!empty($latest_profile->birth_date))
					// {
					// 	$birth_date = [];
					// 	$birth_date = explode('-',$latest_profile->birth_date);
					// 	$valid_date = checkdate($birth_date[1],$birth_date[2],$birth_date[0]);
					// 	if($valid_date)
					// 	{
					// 		$personal_detail_birth_date = strtoupper(date('d-F-Y',strtotime($action->birth_date)));
					// 	}
					// }
				?>
				<?php echo (mysql_to_date_format($latest_profile->birth_date))?strtoupper(mysql_to_date_format($latest_profile->birth_date)):'N/A'; ?>
				</p>
			</div>
			<div class="col-3">
				<b>BIRTHPLACE</b>
			</div>
			<div class="col">
				<p class="report-font">: 
					<?php echo (!empty($latest_profile->birth_place))?strtoupper($latest_profile->birth_place):'N/A'; ?>
				</p>
			</div>
		</div>

		<div class="row">
			<div class="col-3">
				<b>AGE</b>
			</div>
			<div class="col">
				<p class="report-font">:
					<?php
						$age = 'N/A';
						if(!empty($latest_profile->birth_date) && mysql_to_date_format($latest_profile->birth_date)){
							$current = date_create(date('Y-m-d'));
							$difference = date_diff($current,date_create($latest_profile->birth_date));
							$age = $difference->format('%Y');
						}
						echo $age;
					?>
				</p>
			</div>
			<div class="col-3">
				<b>HOBBY</b>
			</div>
			<div class="col">
				<p class="report-font">:
					<?php echo (!empty($latest_profile->hobby))?strtoupper($latest_profile->hobby):'N/A'; ?>
				</p>
			</div>
		</div>

		<div class="row">
			<div class="col-3">
				<b>RELIGION</b>
			</div>
			<div class="col">
				<p class="report-font">: 
					<?php if (!empty($latest_profile->religion_id)): ?>
						<?php foreach ($religions as $key => $religion): ?>
							<?php if ($latest_profile->religion_id == $religion->id) 
							{
								echo strtoupper($religion->name);
							}
							?>
						<?php endforeach ?>
					<?php else: ?>
						N/A
					<?php endif ?>
				</p>
			</div>
			<div class="col-3">
				<b>RACE</b>
			</div>
			<div class="col">
				<p class="report-font">: 
				<?php if (!empty($latest_profile->race_id)): ?>
					<?php foreach ($races as $key => $race): ?>
						<?php echo ($latest_profile->race_id == $race->id)?strtoupper($race->race):''; ?>
					<?php endforeach ?>
				<?php else: ?>
						N/A
				<?php endif ?>
				</p>
			</div>
		</div>

		<div class="row">
			<div class="col-3">
				<b>MARITIAL STATUS</b>
			</div>
			<div class="col">
				<p class="report-font">:
					<?php if (!empty($latest_profile->marital_status)): ?>
						<?php 
							if ($latest_profile->marital_status == 1) 
							{
								echo 'SINGLE';
							}else if($latest_profile->marital_status == 2)
							{
								echo 'MARRIED';
							}else
							{
								echo 'DIVORCE';
							}
						?>
					<?php else: ?>
						<?php echo 'N/A'; ?>
					<?php endif ?>
				</p>
			</div>
			<div class="col-3">
				<b>MARRIED DATE</b>
			</div>
			<div class="col">
				<p class="report-font">: 
					<?php if (!empty($latest_profile->marital_status)): ?>
						<?php 
							if($latest_profile->marital_status == 2)
							{
								echo (mysql_to_date_format($latest_profile->married_date))?strtoupper(mysql_to_date_format($latest_profile->married_date)):'N/A';
								// echo ($latest_profile->married_date)?strtoupper(date('d-F-Y',strtotime($latest_profile->married_date))):'N/A';
							}else{
								echo 'N/A';
							}
						?>
					<?php else: ?>
						<?php echo 'N/A'; ?>
					<?php endif ?>
				</p>
			</div>
		</div>

		<div class="row">
			<div class="col-3">
				<b>PRIMARY EMAIL</b>
			</div>
			<div class="col">
				<p>:<?php echo (!empty($latest_profile->primary_email))?$latest_profile->primary_email:'N/A'; ?></p>
				<!-- <p class="report-font">: <?php echo ($staff['email_secondary'])?$staff['email_secondary']:' N/A'; ?></p> -->
			</div>
			<div class="col-3">
				<b>SECONDARY EMAIL</b>
			</div>
			<div class="col">
				<p>: <?php echo (!empty($latest_profile->secondary_email))?$latest_profile->secondary_email:'N/A'; ?></p>
				<!-- <p class="report-font">: <?php echo ($staff['email'])?$staff['email']:' N/A'; ?></p> -->
			</div>
		</div>

		<div class="horizontal-line">&nbsp;</div>
	</div>
	<!-- personal data information -->

	<!-- action list -->
	<header class="d-none d-print-block">
		<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 class="report-title pull-right">
					
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-12">
				<table class="company">
					<tr>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
						<td class="details">
							<span><b>SALIHIN (AF 1426)</b></span>
							<span>555, Jalan Samudra Utara 1, Taman Samudra, Batu Caves,</span>
							<span>68100, Batu Caves, Selangor</span>
							<span>Phone: 03-6185 9970 &nbsp;&nbsp; Fax: 03-6185 9970</span>
							<span>Website: salihin.com.my</span>
						</td>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</header>
	<div class="col-12" style="margin-top:2rem">

		<div class="row">
			<div class="col-12">
				<h3>ACTIONS</h3>
			</div>
		</div>

		<table class="table table-bordered">
			<thead>
				<tr>
					<th>BIL</th>
					<th>ACTION TYPE</th>
					<th>EFFECTIVE DATE</th>
				</tr>
			</thead>
			<tbody>
				<?php if($actions) foreach ($actions as $key => $action): ?>	
				<tr>
					<td><?php echo $key+1; ?></td>
					<td><?php echo strtoupper($action->type); ?></td>
					<td><?php echo strtoupper(mysql_to_date_format($action->action_efective_date)); ?></td>
				</tr>
				<?php endforeach ?>

			</tbody>
		</table>
		<div class="horizontal-line">&nbsp;</div>
	</div>
	<!-- action list -->


	<!-- action details -->
	<header class="d-none d-print-block">
		<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 class="report-title pull-right">
					
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-12">
				<table class="company">
					<tr>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
						<td class="details">
							<span><b>SALIHIN (AF 1426)</b></span>
							<span>555, Jalan Samudra Utara 1, Taman Samudra, Batu Caves,</span>
							<span>68100, Batu Caves, Selangor</span>
							<span>Phone: 03-6185 9970 &nbsp;&nbsp; Fax: 03-6185 9970</span>
							<span>Website: salihin.com.my</span>
						</td>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</header>
	<div class="col-12" style="margin-top:2rem;">
		<?php if($actions) foreach ($actions as $aindex => $action): ?>
		<div class="row mt-5">
			<div class="col">
				<h3>ACTION ( <?php echo strtoupper(++$aindex.' - '.$action->type); ?> ) </h3>
			</div>
			<div class="col">
				<!-- <h3>EFFECTIVE DATE : <?php echo strtoupper(date('d-F-Y',strtotime($action->action_efective_date))); ?></h3> -->
				<h3>EFFECTIVE DATE : <?php echo strtoupper(mysql_to_date_format($action->action_efective_date)); ?></h3>

			</div>
		</div>

		<!-- personal_data -->
		<div>	
			<div class="row">
				<div class="col">
					<h4><b>PERSONAL DETAILS</b></h4>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col-3">
							<b>STAFF ID</b>
						</div>
						<div class="col">
							<p> : <?php echo (!empty($action->staff_id))?strtoupper($action->staff_id):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>TITLE</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->user_title))?strtoupper($action->user_title):'N/A'; ?></p>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>NAME</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->name))?strtoupper($action->name):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>BIRTH DATE</b>
						</div>
						<div class="col">
							<?php
								// $personal_detail_birth_date = 'N/A';
								// if(!empty($action->birth_date))
								// {
								// 	$birth_date = [];
								// 	$birth_date = explode('-',$action->birth_date);
								// 	$valid_date = checkdate($birth_date[1],$birth_date[2],$birth_date[0]);
								// 	if($valid_date)
								// 	{
								// 		$personal_detail_birth_date = strtoupper(date('d-F-Y',strtotime($action->birth_date)));
								// 	}
								// }
							?>
							<p>: <?php echo(mysql_to_date_format($action->birth_date))?strtoupper(mysql_to_date_format($action->birth_date)):'N/A'; ?></p>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>BIRTH PLACE</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->birth_place))?strtoupper($action->birth_place):'N/A'; ?></p>
						</div>
					</div>							
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>GENDER</b>
						</div>
						<div class="col">
							<p>:
								<?php 
								if (!empty($action->gender_id == 1)) 
								{
									echo strtoupper('male');
								}elseif (!empty($action->gender_id == 2)) {
									echo strtoupper('female');
								}else{
									echo 'N/A';
								}
								?>
							</p>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>HOBBY</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->hobby))?strtoupper($action->hobby):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>NRIC / PASSPORT</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->ic_no))?strtoupper($action->ic_no):'N/A'; ?></p>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>NATIONALITY</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->nationality))?strtoupper($action->nationality):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>PASSPORT EXPIRED DATE</b>
						</div>
						<div class="col">
							<!-- <p>: <?php echo (!empty($action->passport_expired_date))?strtoupper(date('d-F-Y',strtotime($action->passport_expired_date))):'N/A'; ?></p> -->
							<p>: <?php echo (!empty(mysql_to_date_format($action->passport_expired_date)))?strtoupper(mysql_to_date_format($action->passport_expired_date)):'N/A'; ?></p>

						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>WORKING EXPIRED DATE</b>
						</div>
						<div class="col">
							<!-- <p>: <?php echo (!empty($action->working_expired_date))?strtoupper(date('d-F-Y',strtotime($action->working_expired_date))):'N/A'; ?></p> -->
							<p>: <?php echo (!empty(mysql_to_date_format($action->working_expired_date)))?strtoupper(mysql_to_date_format($action->working_expired_date)):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col-3">
							<b>PLACE OF ISSUE</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->issue_country))?strtoupper($action->issue_country):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>RELIGION</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->religion))?strtoupper($action->religion):'N/A'; ?></p>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>RACE</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->race))?strtoupper($action->race):'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col-3">
							<b>RESIDENTIAL STATUS</b>
						</div>
						<div class="col">
							<p>:
								<?php 
									if (!empty($action->residential_id == 1)) 
									{
										echo strtoupper('resident');
									}elseif (!empty($action->residential_id == 2)) 
									{
										echo strtoupper('non resident');
									}else{
										echo 'N/A';
									}
								?>
							</p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>MARITAL STATUS</b>
						</div>
						<div class="col">
							<p>:
								<?php 
									if (!empty($action->marital_status)) {
										echo ($action->marital_status == 1)?strtoupper('single'):'';
										echo ($action->marital_status == 2)?strtoupper('married'):'';
										echo ($action->marital_status == 3)?strtoupper('divorce'):'';
									}else{
										echo 'N/A';
									}
								?>
							</p>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>MARRIED DATE</b>
						</div>
						<div class="col">
							<p>: 
								<!--
								<?php if ($action->marital_status == 3): ?>
									<?php echo (!empty($action->married_date))?strtoupper(date('d-F-Y',strtotime($action->married_date))):'N/A'; ?>
								<?php else: ?>
									N/A
								<?php endif ?>
								-->

								<?php 
									if($action->marital_status == 2)
									{
										echo (!empty(mysql_to_date_format($action->married_date)))?strtoupper(mysql_to_date_format($action->married_date)):'N/A';
									}else{
										echo 'N/A';
									}
								?>
								
							</p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col">
					<div class="row">
						<div class="col">
							<b>PRIMARY EMAIL</b>
						</div>
						<div class="col">
							<P>: <?php echo (!empty($action->primary_email))?$action->primary_email:'N/A'; ?></P>
						</div>
					</div>
				</div>
				<div class="col">
					<div class="row">
						<div class="col">
							<b>SECONDARY EMAIL</b>
						</div>
						<div class="col">
							<p>: <?php echo (!empty($action->secondary_email))?$action->secondary_email:'N/A'; ?></p>
						</div>
					</div>
				</div>
			</div>			
		</div>
		<!-- personal data -->

		<!-- join group action type -->
			<?php if($action->joining_group){
			echo '<br>';
			foreach ($action->joining_group as $key => $join_group): ?>
				
				<div class="row">
					<div class="col">
						<h4><b>EMPLOYMENT DETAIL</b><h4>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>REASON</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->reason)?strtoupper($join_group->reason):'N/A'; ?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>POSITION</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->position_hiring)?strtoupper($join_group->position_hiring):'N/A'; ?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row mb-1">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>DESIGNATION</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->designation)?strtoupper($join_group->designation):'N/A'; ?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYEE GRADE</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->employee_grade)?strtoupper($join_group->employee_grade):'N/A'; ?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col-3">
								<b>REPORTING TO</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->user_reporting_name)?strtoupper($join_group->user_reporting_name):'N/A';?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>BUSINESS ENTITY</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->business_entity)?strtoupper($join_group->business_entity):'N/A'; ?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>BRANCH</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->branch)?strtoupper($join_group->branch):'N/A';?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>PERSONNEL AREA</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->personnel_area)?strtoupper($join_group->personnel_area):'N/A';?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>PERSONAL SUBAREA</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->personal_subarea)?strtoupper($join_group->personal_subarea):'N/A';?></p>
							</div>
						</div>
					</div>
				</div>	

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYEE GROUP</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->employee_group)?strtoupper($join_group->employee_group):'N/A';?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>CONTRACT ELEMENT</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->contract_element)?strtoupper($join_group->contract_element):'N/A'; ?></p>
							</div>
						</div>
					</div>
				</div>	

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYEE SUBGROUP</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->employee_subgroup_designation)? strtoupper($join_group->employee_subgroup_indicator.' - '.$join_group->employee_subgroup_designation):'N/A'; ?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYMENT STATUS</b>
							</div>
							<div class="col">
								<p>: <?php echo ($join_group->is_active == 1)?'ACTIVE':'INACTIVE'; ?></p>
							</div>
						</div>
					</div>
				</div>
			<?php endforeach; } ?>
		<!-- join group action type -->

		<!-- address -->
		<?php if($action->address){?>
		<div class="row">
			<div class="col">
				<h4><b>ADDRESS</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">

				<table class="table table-bordered">
					<thead>
						<tr>
							<th>TYPE</th>
							<th>ADDRESS</th>
							<th>POSTCODE</th>
							<th>CITY</th>
							<th>STATE</th>
							<th>COUNTRY</th>
							<th>CONTACT</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->address as $key => $address): ?>
						<tr>
							<td>
								<?php
									if ($address->type == 1) {
										echo 'PERMANENT RESIDENCE';
									}elseif ($address->type == 2) {
										echo 'TEMPORARY RESIDENCE';
									}elseif ($address->type == 3) {
										echo 'CORRESPONDENCE RESIDENCE';
									}else{
										echo 'N/A';
									}
								?>
							</td>
							<td><?php echo ($address->address)?strtoupper($address->address):'N/A'; ?></td>
							<td><?php echo ($address->postcode)?strtoupper($address->postcode):'N/A'; ?></td>
							<td><?php echo ($address->city)?strtoupper($address->city):'N/A'?></td>
							<td><?php echo ($address->state_name)?strtoupper($address->state_name):'N/A'; ?></td>
							<td><?php echo ($address->country_name)?strtoupper($address->country_name):'N/A'; ?></td>
							<td><?php echo ($address->contact_no)?strtoupper($address->contact_no):'N/A'; ?></td>
						</tr>
						<?php endforeach ?>
					</tbody>
				</table>


			</div>
		</div>
		<?php } ?>
		<!-- address -->

		<!-- family information -->
		<?php if($action->family_info){ ?>
		<div class="row">
			<div class="col">
				<h4><b>FAMILY INFORMATION</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<!-- <th>ACTION TYPE</th> -->
							<th>DETAIL</th>
							<th>STATUS</th>
						</tr>
					</thead>
					<tbody>
						
						<?php if($action->family_info) foreach ($action->family_info as $key_inner => $family_info): ?>
							<tr>
								<!--
								<td>
									<?php 
										echo ($actions[$key])?strtoupper($actions[$key]->type).'<br/>'.strtoupper(date('d-F-Y',strtotime($actions[$key]->action_efective_date))):'N/A'; 
									?>
								</td>
								-->
								<td>
									<b>NAME : </b><?php echo ($family_info->name)?strtoupper($family_info->name):'N/A'; ?><br>
									<b>NRIC : </b><?php echo ($family_info->ic_no)?strtoupper($family_info->ic_no):'N/A'; ?> <br>
									<b>RELATION : </b><?php echo ($family_info->relations)?strtoupper($family_info->relations):'N/A'; ?><br>
									<b>BIRTHDATE : </b><?php echo (!empty(mysql_to_date_format($family_info->birthdate)))?strtoupper(mysql_to_date_format($family_info->birthdate)):'N/A'; ?><br>
									<b>OCCUPATION : </b><?php echo ($family_info->occupation)?strtoupper($family_info->occupation):'N/A'; ?><br>
									<b>EMAIL : </b><?php echo ($family_info->email)?$family_info->email:'N/A'; ?><br>
									<b>CONTACT NO : </b><?php echo ($family_info->phone_no)?strtoupper($family_info->phone_no):'N/A'; ?><br>
									<b>ADDRESS : </b><?php echo ($family_info->address)?strtoupper($family_info->address):'N/A'; ?><br>
									<b>ACADEMIC LEVEL : </b><?php echo ($family_info->level_academic)?strtoupper($family_info->level_academic):'N/A'; ?><br>
									<b>ACADEMIC INSTITUTION : </b><?php echo ($family_info->academic_institution)?strtoupper($family_info->academic_institution):'N/A'; ?><br>
								</td>
								<td>
									<b>OKU STATUS : </b><?php echo ($family_info->oku_status == 0)?strtoupper('YES'):strtoupper('NO'); ?><br>
									<b>STUDENT STATUS : </b><?php echo ($family_info->study_status == 0)?strtoupper('YES'):strtoupper('NO'); ?><br>
								</td>
							</tr>
						<?php endforeach ?>
					
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- family information -->

		<!-- academic qualification -->
		<?php if($action->academic_qualification){ ?>
			<div class="row">
				<div class="col">
					<h4><b>ACADEMIC QUALIFICATIONS</b></h4>
				</div>
			</div>
			<div class="row">
				<div class="col">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>LEVEL</th>
								<th>PROGRAM</th>
								<th>UNIVERSITY / INSTITUTION</th>
								<th>YEAR GRADUATED</th>
								<th>FINAL RESULTS /CGPA</th>
								<th>ATTACHMENTS</th>
							</tr>
						</thead>
						<tbody>
							<?php foreach ($action->academic_qualification as $key => $row): ?>	
							<tr>
								<td><?php echo ($row->academic_level)? strtoupper($row->academic_level):'N/A'; ?></td>
								<td><?php echo ($row->program)? strtoupper($row->program):'N/A'; ?></td>
								<td><?php echo ($row->institution)? strtoupper($row->institution):'N/A'; ?></td>
								<td><?php echo ($row->year)? strtoupper($row->year):'N/A'; ?></td>
								<td><?php echo ($row->cgpa)?strtoupper($row->cgpa):'N/A'; ?></td>
								<td><?php echo ($row->attachment_name)?strtoupper($row->attachment_name):'N/A'; ?></td>
							</tr>
							<?php endforeach ?>

						</tbody>
					</table>
				</div>
			</div>
		<?php } ?>
		<!-- academic qualification -->

		<!-- additional personal data -->
		<?php if($action->additional_personal_data){ ?>
		<div class="row">
			<div class="col">
				<h4><b>ADDITIONAL PERSONAL DATA</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>DETAIL</th>
							<th>DESCRIPTION</th>
							<th>ATTACHMENTS</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->additional_personal_data as $key => $row): ?>	
						<tr>
							<td><?php echo ($row->detail)?strtoupper($row->detail):'N/A'; ?></td>
							<td><?php echo ($row->description)?strtoupper($row->description):'N/A'; ?></td>
							<td><?php echo ($row->attachment_name)?strtoupper($row->attachment_name):'N/A'; ?></td>
						</tr>
						<?php endforeach ?>

					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- additional personal data -->

		<!-- previous employment detail -->
		<?php if($action->previous_employment_history){ ?>
		<div class="row">
			<div class="col">
				<h4><b>PREVIOUS EMPLOYMENT DETAILS</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
			
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>DATE JOIN</th>
							<th>DATE TO</th>
							<th>DETAILS</th>
						</tr>
					</thead>
					<tbody>
							<?php if($action->previous_employment_history) foreach ($action->previous_employment_history as $key_inner => $history): ?>
								<tr>
									<!-- <td> <?php echo ($history->date_enter)?$history->date_enter:'N/A'; ?> </td> -->
									<td> <?php echo (!empty(mysql_to_date_format($history->date_enter)))?mysql_to_date_format($history->date_enter):'N/A'; ?> </td>
									<!-- <td> <?php echo ($history->date_exit)?$history->date_exit:'N/A'; ?> </td> -->
									<td> <?php echo (!empty(mysql_to_date_format($history->date_exit)))?mysql_to_date_format($history->date_exit):'N/A'; ?> </td>

									<td>
										<label><b>EMPLOYER NAME </b></label> : <?php echo ($history->employer_name)?$history->employer_name:'N/A'; ?> <br/>
										<label><b>EMPLOYER ADDRESS </b></label> : <?php echo ($history->employer_address)?$history->employer_address:'N/A'; ?> <br/>
										<label><b>POSITION </b></label> : <?php echo ($history->position)?$history->position:'N/A'; ?> <br/>
										<label><b>LENGTH OF SERVICE </b></label> : <?php echo ($history->length_of_service)?$history->length_of_service:'N/A'; ?> <br/>
										<label><b>DESCRIPTION</b></label> : <?php echo ($history->description)?$history->description:'N/A'; ?>
									</td>
								</tr>
							<?php endforeach ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- previous employment detail -->

		<!-- professional membership -->
		<?php if($action->professional_membership){ ?>
		<div class="row">
			<div class="col">
				<h4><b>PROFESSIONAL MEMBERSHIP</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>PROFESSIONAL BODIES</th>
							<th>PROFESSIONAL CERTIFICATE</th>
							<th>MEMBERSHIP</th>
							<th>MEMBERSHIP NUMBER</th>
							<th>YEAR</th>
							<th>ATTACHMENT</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->professional_membership as $key => $row): ?>
						<tr>
							<td><?php echo ($row->professional_body)?$row->professional_body:'N/A'; ?></td>
							<td><?php echo ($row->certificate)?$row->certificate:'N/A'; ?></td>
							<td><?php echo ($row->membership)?$row->membership:'N/A';  ?></td>
							<td><?php echo ($row->membership_no)?$row->membership_no:'N/A'; ?></td>
							<td><?php echo ($row->year)?$row->year:'N/A';?></td>
							<td><?php echo ($row->attachment_name)?$row->attachment_name:'N/A'; ?></td>
						</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- professional membership -->

		<!-- professional licenses -->
		<?php if($action->professional_license){ ?>
		<div class="row">
			<div class="col">
				<h4><b>PROFESSIONAL LICENSES</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>PROFESSION</th>
							<th>LICENSES NO</th>
							<th>REGISTRATION DATE</th>
							<th>RENEWAL DATE</th>
							<th>ATTACHMENT</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->professional_license as $key => $row): ?>	
						<tr>
							<td><?php echo ($row->profession)?strtoupper($row->profession):'N/A';?></td>
							<td><?php echo ($row->license_no)?strtoupper($row->license_no):'N/A';?></td>
							<!-- <td><?php echo ($row->register_date)?strtoupper(date('d-F-Y',strtotime($row->register_date))):'N/A';?></td> -->
							<td><?php echo (!empty(mysql_to_date_format($row->register_date)))?strtoupper(mysql_to_date_format($row->register_date)):'N/A';?></td>
							<!-- <td><?php echo ($row->renewal_date)?strtoupper(date('d-F-Y',strtotime($row->renewal_date))):'N/A'; ?></td> -->
							<td><?php echo (!empty(mysql_to_date_format($row->renewal_date)))?strtoupper(mysql_to_date_format($row->renewal_date)):'N/A'; ?></td>
							<td><?php echo ($row->attachment_name)?strtoupper($row->attachment_name):'N/A'; ?></td>
						</tr>
						<?php endforeach ?>

					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- professional licenses -->

		<!-- recognition -->
		<?php if($action->recognition){ ?>
		<div class="row">
			<div class="col">
				<h4><b>RECOGNITION</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>ACHIEVEMENT</th>
							<th>AWARD</th>
							<th>YEAR</th>
							<th>ATTACHMENT</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->recognition as $key => $row): ?>
							<tr>
								<td><?php echo ($row->achievement)?strtoupper($row->achievement):'N/A'; ?></td>
								<td><?php echo ($row->award)?strtoupper($row->award):'N/A'; ?></td>
								<td><?php echo ($row->year)?strtoupper($row->year):'N/A'; ?></td>
								<td><?php echo ($row->attachment_name)?strtoupper($row->attachment_name):'N/A'; ?></td>
							</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- recognition -->


		<!-- contract element -->
		<?php if($action->contract_element){ ?>
		<div class="row">
			<div class="col">
				<h4><b>CONTRACT ELEMENT</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>CONTRACT TYPE</b>
							</div>
							<div class="col">
								<P>: <?php echo ($action->contract_element->contract_type)?strtoupper($action->contract_element->contract_type):'N/A'; ?></P>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>CONFIRMATION</b>
							</div>
							<div class="col">
								<p>: <?php echo ($action->contract_element->confirmation_type)?strtoupper($action->contract_element->confirmation_type):'N/A'; ?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>CONFIRMATION DATE</b>
							</div>
							<div class="col">
								<P>: <?php echo (!empty(mysql_to_date_format($action->contract_element->confirmation_date)))?strtoupper(mysql_to_date_format($action->contract_element->confirmation_date)):'N/A';?></P>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>PROBATIONARY PERIOD</b>
							</div>
							<div class="col">
								<p>: 
									<?php echo ($action->contract_element->probation)?strtoupper($action->contract_element->probation):'';?>
									<?php 
										if ($action->contract_element->probation_duration == 0) {
											echo strtoupper('days');
										}elseif ($action->contract_element->probation_duration == 1) {
											echo strtoupper('weeks');
										}elseif ($action->contract_element->probation_duration == 2) {
											echo strtoupper('months');
										}elseif ($action->contract_element->probation_duration == 3) {
											echo strtoupper('years');
										}
									?>
								</p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYER NOTICE PERIOD</b>
							</div>
							<div class="col">
								<P>: 
									<?php echo ($action->contract_element->er_notice)?strtoupper($action->contract_element->er_notice):'';?>
									<?php 
										if ($action->contract_element->er_notice_duration == 0) {
											echo strtoupper('days');
										}elseif ($action->contract_element->er_notice_duration == 1) {
											echo strtoupper('weeks');
										}elseif ($action->contract_element->er_notice_duration == 2) {
											echo strtoupper('months');
										}elseif ($action->contract_element->er_notice_duration == 3) {
											echo strtoupper('years');
										}
									?>
								</P>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYEE NOTICE PERIOD</b>
							</div>
							<div class="col">
								<p>: 
									<?php echo ($action->contract_element->ee_notice)?strtoupper($action->contract_element->ee_notice):'';?>
									<?php 
										if ($action->contract_element->ee_notice_duration == 0) {
											echo strtoupper('days');
										}elseif ($action->contract_element->ee_notice_duration == 1) {
											echo strtoupper('weeks');
										}elseif ($action->contract_element->ee_notice_duration == 2) {
											echo strtoupper('months');
										}elseif ($action->contract_element->ee_notice_duration == 3) {
											echo strtoupper('years');
										}
									?>
								</p>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
		<?php } ?>
		<!-- contract element -->

		<!-- basic pay -->
		<?php if($action->basic_pay){ ?>
		<div class="row">
			<div class="col">
				<h4><b>BASIC PAY</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>PAY SCALE GROUP</b>
							</div>
							<div class="col">
								<P>: <?php echo ($action->basic_pay->scale_group)?$action->basic_pay->scale_group:null;?></P>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>BASIC PAY AMOUNT</b>
							</div>
							<div class="col">
								<p>: <?php echo ($action->basic_pay->amount)?'RM'.number_format($action->basic_pay->amount,2):null;?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>START DATE</b>
							</div>
							<div class="col">
								<P>: <?php echo (!empty(mysql_to_date_format($action->basic_pay->start_date)))?strtoupper(mysql_to_date_format($action->basic_pay->start_date)):'N/A'?></P>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>END DATE</b>
							</div>
							<div class="col">
								<p>: <?php echo (!empty(mysql_to_date_format($action->basic_pay->end_date)))?strtoupper(mysql_to_date_format($action->basic_pay->end_date)):'N/A';?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>REASON</b>
							</div>
							<div class="col">
								<P>: <?php echo ($action->basic_pay->reason)?strtoupper($action->basic_pay->reason):'N/A';?></P>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>STATUS</b>
							</div>
							<div class="col">
								<p>: <?php echo ($action->basic_pay->status == 1)?strtoupper('active'):strtoupper('inactive'); ?></p>
							</div>
						</div>
					</div>
				</div>

			</div>
		</div>
		<?php } ?>
		<!-- basic pay -->

		<!-- bank details -->
		<?php if($action->bank_details){ ?>
		<div class="row">
			<div class="col">
				<h4><b>BANK DETAILS</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>BANK NAME</th>
							<th>BRANCH</th>
							<th>ACCOUNT NUMBER</th>
							<th>STATUS</th>
							<th>ATTACHMENTS</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->bank_details as $key => $row): ?>
							<tr>
								<td><?php echo ($row->name)?strtoupper($row->name):'N/A';?></td>
								<td><?php echo ($row->branch)?strtoupper($row->branch):'N/A';?></td>
								<td><?php echo ($row->acc_no)?$row->acc_no:'N/A'; ?></td>
								<td><?php echo ($row->status)?strtoupper($row->status):'N/A';?></td>
								<td>
								<?php
									$list = explode('/',$row->location);
									$length = sizeof($list);
									if($length > 0)
									{
										echo strtoupper($list[$length-1]);
									}else{
										echo 'N/A';
									}
								?>
								</td>
							</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- bank details -->

		<!-- statutory details -->
		<?php if($action->statutory_details){ ?>
		<div class="row">
			<div class="col">
				<h4><b>STATUTORY DETAILS</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<div class="row">
					<div class="col-3">
						<b>EMPLOYEE EPF NUMBER</b>
					</div>
					<div class="col">
						<p>: 
							<?php echo ($action->statutory_details->ee_epf_no)?>
						</p>
					</div>
				</div>

				<div class="row">
					<div class="col-3">
						<b>EMPLOYER RATE</b>
					</div>
					<div class="col">
						<p>:
							<?php
							if ($action->statutory_details->er_rate == 0) {
								echo strtoupper('statutory rate');
							}elseif ($action->statutory_details->er_rate == 1) {
								echo strtoupper('company rate');
							}elseif ($action->statutory_details->er_rate == 2) {
								echo strtoupper('personal rate');
							}
							?>  
							(<?php echo ($action->statutory_details->er_percent)?$action->statutory_details->er_percent.'%':'N/A'; ?>) </p>
					</div>
				</div>

				<div class="row">
					<div class="col-3">
						<b>EMPLOYEE RATE</b>
					</div>
					<div class="col">
						<p>:
							<?php
							if ($action->statutory_details->ee_rate == 0) {
								echo strtoupper('statutory rate');
							}elseif ($action->statutory_details->ee_rate == 1) {
								echo strtoupper('company rate');
							}elseif ($action->statutory_details->ee_rate == 2) {
								echo strtoupper('personal rate');
							}
							?>  
							(<?php echo ($action->statutory_details->ee_percent)?$action->statutory_details->ee_percent.'%':'N/A'; ?>) </p>
						</p>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>EMPLOYEE SOCSO NO</b>
							</div>
							<div class="col">
								<p>: 
									<?php echo ($action->statutory_details->ee_socso)?strtoupper($action->statutory_details->ee_socso):null;?>
								</p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>INCOME TAX NO</b>
							</div>
							<div class="col">
								<p>: <?php echo ($action->statutory_details->ee_income_tax)?strtoupper($action->statutory_details->ee_income_tax):null;?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>PCB DEDUCTION AMOUNT</b>
							</div>
							<div class="col">
								<p>: <?php echo ($action->statutory_details->ee_pcb_deduction)?'RM'.number_format($action->statutory_details->ee_pcb_deduction,2):'N/A'; ?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>ZAKAT DEDUCTION AMOUNT</b>
							</div>
							<div class="col">
								<p>: <?php echo ($action->statutory_details->ee_zakat_deduction)?'RM'.number_format($action->statutory_details->ee_zakat_deduction,2):'N/A';?></p>
							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col">
						<div class="row">
							<div class="col">
								<b>STATUS</b>
							</div>
							<div class="col">
								<p>: <?php echo (empty($action->statutory_details->status))?'INACTIVE':'ACTIVE'; ?></p>
							</div>
						</div>
					</div>
					<div class="col">
						<div class="row">
							<div class="col">
								<b>YEAR</b>
							</div>
							<div class="col">
								<p>:  <?php echo (!empty($action->statutory_details->year))?$action->statutory_details->year:'N/A'; ?></p>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php } ?>
		<!-- statutory details -->

		<!-- recurring pay / deduction  -->
		<?php if(!empty($action->recurring_deduct )|| !empty( $action->recurring_payment)){ ?>
		<div class="row">
			<div class="col">
				<h4><b>RECURRING PAYMENT AND DEDUCTION</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>RECURRING</th>
							<th>TYPE</th>
							<th>START DATE</th>
							<th>END DATE</th>
							<th>AMOUNT</th>
							<th>STATUS</th>
						</tr>
					</thead>
					<tbody>
						
						<?php if(!empty($action->recurring_payment)) foreach ($action->recurring_payment as $key => $payment): ?>
							<tr>
								<td>PAYMENTS</td>
								<td><?php echo ($payment->type)?strtoupper($payment->type):'N/A'; ?></td>
								<!-- <td><?php echo ($payment->date_start)?strtoupper(date('d-F-Y',strtotime($payment->date_start))):'N/A'; ?></td> -->
								<td><?php echo (!empty(mysql_to_date_format($payment->date_start)))?strtoupper(mysql_to_date_format($payment->date_start)):'N/A'; ?></td>

								<!-- <td><?php echo ($payment->date_end)?strtoupper(date('d-F-Y',strtotime($payment->date_end))):'N/A'; ?></td> -->
								<td><?php echo (!empty(mysql_to_date_format($payment->date_end)))?strtoupper(mysql_to_date_format($payment->date_end)):'N/A'; ?></td>
								
								<td><?php echo ($payment->amount)?'RM'.$payment->amount:''; ?></td>
								<td><?php echo ($payment->status == 1)?strtoupper('END'):strtoupper('ongoing'); ?></td>
							</tr>
						<?php endforeach ?>

						<?php if(!empty($action->recurring_deduct)) foreach ($action->recurring_deduct as $key => $deduction): ?>
							<tr>
								<td>DEDUCTIONS</td>
								<td><?php echo ($deduction->type)?strtoupper($deduction->type):'N/A'; ?></td>
								<!-- <td><?php echo ($deduction->date_start)?strtoupper(date('d-F-Y',strtotime($deduction->date_start))):'N/A'; ?></td> -->
								<td><?php echo (!empty(mysql_to_date_format($deduction->date_start)))?strtoupper(mysql_to_date_format($deduction->date_start)):'N/A'; ?></td>

								<!-- <td><?php echo ($deduction->date_end)?strtoupper(date('d-F-Y',strtotime($deduction->date_end))):'N/A'; ?></td> -->
								<td><?php echo (!empty(mysql_to_date_format($deduction->date_end)))?strtoupper(mysql_to_date_format($deduction->date_end)):'N/A'; ?></td>

								<td><?php echo ($payment->amount)?'RM'.$payment->amount:''; ?></td>
								<td><?php echo ($deduction->status == 1)?strtoupper('END'):strtoupper('ongoing'); ?></td>
							</tr>
						<?php endforeach ?>

					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- recurring pay / deduction  -->


		<!-- third party payment -->
		<?php if($action->third_party){ ?> 
		<br>
		<div class="row">
			<div class="col">
				<b>THIRD PARTY PAYMENT</b>
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>DATE FROM</th>
							<th>DATE TO</th>
							<th>THIRD PARTY INSTITUTION / ORGANISATION</th>
							<th>STATUS</th>
							<th>AMOUNT</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->third_party as $key => $third_party): ?>
						<tr>
							<!-- <td><?php echo ($third_party->date_start)?strtoupper(date('d-F-Y',strtotime($third_party->date_start))):'N/A';?></td> -->
							<td><?php echo (!empty(mysql_to_date_format($third_party->date_start)))?strtoupper(mysql_to_date_format($third_party->date_start)):'N/A';?></td>

							<!-- <td><?php echo ($third_party->date_end)?strtoupper(date('d-F-Y',strtotime($third_party->date_end))):'N/A';?></td> -->
							<td><?php echo (!empty(mysql_to_date_format($third_party->date_end)))?strtoupper(mysql_to_date_format($third_party->date_end)):'N/A';?></td>

							<td><?php echo ($third_party->type)?strtoupper($third_party->type):'N/A'?></td>
							<td><?php echo ($third_party->status == 1)?strtoupper('end'):strtoupper('ongoing');?></td>
							<td><?php echo ($third_party->amount)?strtoupper('RM'.number_format($third_party->amount,2)):'N/A';?></td>
						</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- third party payment -->


		<!-- pcb consideration -->
		<?php if($action->pcb_consideration){ ?>
		<div class="row">
			<div class="col">
				<h4><b>PCB CONSIDERATION</b></h4>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th>NAME</th>
							<th>NRIC</th>
							<th>AGE</th>
							<th>STATUS</th>
							<th>RESPONSIBILITY</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($action->pcb_consideration as $key => $pcb): ?>
							<tr>
								<td><?php echo (!empty($pcb->name))?strtoupper($pcb->name):'N/A'; ?></td>
								<td><?php echo (!empty($pcb->ic_no))?$pcb->ic_no:'N/A'; ?></td>
								<td>
									<?php 
										$age = 0;
										if (!empty(mysql_to_date_format($pcb->birthdate))) {
											$birth = date('Y',strtotime($pcb->birthdate));
											$current = date('Y');
											$age = $current - $birth;
										}
										echo $age;
									?>
								</td>
								<td>
									<b>OKU STATUS</b>: <?php echo ($pcb->oku_status == 1)?'NO':'YES'; ?> <br>
									<b>STUDENT STATUS</b>: <?php echo ($pcb->study_status == 1)?'NO':'YES'; ?> <br>
								</td>
								<td>
									<?php echo ($pcb->responsible_id == 1)?'SPOUSE':'EMPLOYEE'; ?>
								</td>
							</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</div>
		</div>
		<?php } ?>
		<!-- pcb consideration -->
		<?php endforeach ?>
		<div class="horizontal-line">&nbsp;</div>
		
	</div>
	<!-- action details -->

	<!-- attachments -->
	<!-- <header class="d-none d-print-block">
		<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 class="report-title pull-right">
					
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-12">
				<table class="company">
					<tr>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
						<td class="details">
							<span><b>SALIHIN (AF 1426)</b></span>
							<span>555, Jalan Samudra Utara 1, Taman Samudra, Batu Caves,</span>
							<span>68100, Batu Caves, Selangor</span>
							<span>Phone: 03-6185 9970 &nbsp;&nbsp; Fax: 03-6185 9970</span>
							<span>Website: salihin.com.my</span>
						</td>
						<td class="divider">
							<span class="line">&nbsp;</span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</header>
	<div class="col-12" style="margin-top:2rem">
		<div class="row">
			<div class="col-12">
				<h3>Attachments</h3>
			</div>
		</div>

		<div class="h-line">&nbsp;</div>
	</div> -->
	<!-- attachments -->
</div>
