<?php
$getid = $link->hrefquery ();
$getdata = $db->get_row ( "salaryslipdata", array ("emp_id" => $getid [1] ) );
$companydata = $db->get_row ( "setting", array ("id" => 1 ) );
?>
<title><?php echo $companydata['c_name'];?></title>
<!--basic styles-->

<link media="all"
	href="<?php echo SITE_URL.'/assets/backend';?>/css/bootstrap.min.css"
	rel="stylesheet" />
<link media="screen"
	href="<?php echo SITE_URL.'/assets/backend';?>/css/bootstrap-responsive.min.css"
	rel="stylesheet" />
<link rel="stylesheet"
	href="<?php echo SITE_URL.'/assets/backend';?>/css/font-awesome.min.css" />

<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

<!--page specific plugin styles-->

<!--fonts-->

<link rel="stylesheet"
	href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

<!--ace styles-->

<link rel="stylesheet" media="all"
	href="<?php echo SITE_URL.'/assets/backend';?>/css/ace.min.css" />
<link rel="stylesheet"
	href="<?php echo SITE_URL.'/assets/backend';?>/css/ace-responsive.min.css" />
<link rel="stylesheet"
	href="<?php echo SITE_URL.'/assets/backend';?>/css/ace-skins.min.css" />

<!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->

<!--inline styles related to this page-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<!-- CSS Finish -->

<div class="page-content">
	<div class="page-header position-relative">
		<div class="row-fluid">
			<div class="span5">
				<h1>Salary Slip</h1>
			</div>
			<div class="span7">
				<img
					src="<?php echo SITE_URL.'/uploads/image/'.$companydata['c_logo'];?>"
					style="width: 50px; height: 50px;">
			</div>
		</div>
	</div>
	<!--/.page-header-->


	<div class="row-fluid">
		<div class="span12 center">
			<?php if($companydata['c_name'] !=''){?>
						<h1 class="red"><?php echo $companydata['c_name'];?></h1>
					<?php } if($companydata['address'] !=''){?>
						<h5 class="blue"><?php echo $companydata['address'];?></h5>
					<?php }if($companydata['telephone'] !='' || $companydata['telephone2'] !=''){?>
						<h5>
				<span class="black">Ph:</span> <span class="blue"><?php
				if ($companydata ['telephone'] != '') {
					echo $companydata ['telephone'];
				}
				if ($companydata ['telephone'] != '' && $companydata ['telephone2'] != '') {
					echo '&nbsp;' . ',' . '&nbsp;';
				}
				if ($companydata ['telephone2'] != '') {
					echo $companydata ['telephone2'];
				}
				?></span>
						
					<?php }if($companydata['fax'] !=''){?>
						, <span class="black">Fax:</span> <span class="blue"><?php echo $companydata['fax'];?></span>
					<?php }if($companydata['c_email'] !=''){?>
						, <span class="black">Email:</span> <span class="blue"><?php echo $companydata['c_email'];?></span>
					<?php }if($companydata['website'] !=''){?>
						, <span class="black">Website:</span> <span class="blue"><?php echo $companydata['website'];?></span>
					<?php }?>				
						, <span class="black">Salary Slip For The Month Of:</span> <span
					class="blue"><?php
					$current_month = date ( "F", strtotime ( "-1 Months" ) );
					echo substr ( $current_month, 0, 3 );
					echo "&nbsp;-" . date ( Y );
					?></span>
			</h5>
		</div>
	</div>


	<div class="row-fluid">
		<div class="span10 offset1">
			<div class="widget-box transparent invoice-box">
				<div class="widget-header widget-header-large">
					<h3 class="grey lighter pull-left position-relative">
						<i class="icon-leaf green"></i> Employee Salary Slip
					</h3>
					<br>
					<div class="widget-toolbar hidden-480">
						<a href="#" onClick="window.print()"> <i class="icon-print"></i>
						</a>
					</div>
				</div>

			</div>

			<!-- <div class="hr hr8 hr-double hr-dotted"></div> -->

		</div>
	</div>
	<div class="row-fluid">
		<div class="span10 offset1">
			<div class="widget-box">
				<div class="widget-header">
					<h4 class="smaller">Employees Details</h4>
				</div>

				<div class="widget-body">
					<div class="widget-main">
						<div class="row-fluid">
			<?php
			$unserialize_arr = unserialize ( $getdata ['metavalue'] );
			$upper_part = $unserialize_arr [0] [0];
			$earning_part = $unserialize_arr [0] [1];
			$deduction_part = $unserialize_arr [0] [2];
			$footer_part = $unserialize_arr [0] [3];
			
			// echo '<pre>'; print_r ( $footer_part ); echo '</pre>';
			
			// $array_count_upper= array_co
			//
			$total_firstkey = count ( $upper_part );
			$total_secondkey = count ( $earning_part );
			$total_fourthkey = count ( $footer_part );
			$firstvar = 1;
			foreach ( $upper_part as $key => $row ) {
				if ($firstvar == 1 || $firstvar % 2 == 1) {
					echo '<div class="row-fluid">';
				}
				?>
			
				<div class="span3">
								<b class="red"><?php  echo $feature->textstyler($key,1);?></b>
							</div>
							<div class="span3">
								<p class="grey"><?php
				if ($firstvar == 1) {
					$empname = $db->get_col ( "employees", array ("e_id" => $row ), "e_name" );
					echo $feature->textstyler ( $empname [0], 1 );
				} else {
					if ($key == 'basic_salary') {
						echo "Rs " . $feature->textstyler ( $row, 1 );
					} else {
						echo $feature->textstyler ( $row, 1 );
					}
				}
				?></p>
							</div>
			<?php
				if ($firstvar % 2 == 0 || $firstvar == $total_firstkey) {
					?>	
				</div>
			<?php }?>
			<?php $firstvar++; }?>
			
					</div>
					<!-- ./row-fluid -->
				</div>
			</div>
		</div>
	</div>
</div>

<div class="row-fluid">
	<div class="span10 offset1">
		<div class="widget-box">
			<div class="widget-header">
				<h4 class="smaller">Earning And Deduction Details</h4>
			</div>

			<div class="widget-body">
				<div class="widget-main">
					<div class="row-fluid">
						<div class="span6 center">
							<p class="light-green">Earning Details</p>
						</div>
						<div class="span6 center">
							<p class="light-green">Deduction Details</p>
						</div>
					</div>
					<div class="row-fluid">

						<div class="span6">
							<?php
							foreach ( $earning_part as $key => $row1 ) {
								?>
									<div class="row-fluid">
								<div class="span6">
									<b class="red"><?php  echo $feature->textstyler($key,1);?></b>
								</div>
								<div class="span6">
									<p class="grey"><?php
								// type-checking comparison
								// operator
								if (strpos ( $row1, '%' ) !== false) {
									// PERCENT SIGN FOUND
									echo $row1;
								} else {
									echo "Rs " . $row1;
								}
								?></p>
								</div>
							</div>
							<?php } ?>
							</div>
						<div class="span6 ">
							<?php
							foreach ( $deduction_part as $key => $row2 ) {
								?>
									<div class="row-fluid">
								<div class="span6">
									<b class="red"><?php  echo $feature->textstyler($key,1);?></b>
								</div>
								<div class="span6">
									<p class="grey"><?php
								// type-checking comparison
								// operator
								if (strpos ( $row2, '%' ) !== false) {
									// PERCENT SIGN FOUND
									echo $row2;
								} else {
									echo "Rs " . $row2;
								}
								?></p>
								</div>
							</div>
							<?php } ?>
							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="row-fluid">
	<div class="span10 offset1">
		<div class="widget-box">
			<div class="widget-header">
				<h4 class="smaller">Salary Details</h4>
			</div>

			<div class="widget-body">
				<div class="widget-main">
					<div class="row-fluid">
						<!-- <div class="span12 offset1"> -->
							<?php
							$lastvar = 1;
							foreach ( $footer_part as $key => $row3 ) {
								if ($lastvar == 1 || $lastvar % 2 == 1) {
									echo '<div class="row-fluid">';
								}
								?>
										<div class="span4">
											<?php
								$getkey = explode ( "a_", $key );
								?>
											<b class="red"><?php  echo $feature->textstyler($getkey[1],1);?></b>
						</div>
						<div class="span2">
							<p class="grey"><?php if(is_numeric($row3)){echo "Rs ";} echo $feature->textstyler($row3,1);?></p>
						</div>
									<?php
								
								if ($lastvar % 2 == 0 || $lastvar == $total_fourthkey) {
									echo '</div>';
								}
							}
							?>
						
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- /.page-footer -->
</div>