<?php
	function GetStateName($s,$t) {
		if(!$t) return NULL;
		$r = NULL;
		foreach($t as $key=>$value) {
			$i = (isset($value->fldid)) ? $value->fldid : 0;
			$d = (isset($value->fldname)) ? $value->fldname : 0;
			if($i == $s) {
				$r = $d;
				break;
			}
		}
		return $r;
	}
	
	function GetPositionName($s,$t) {
		if(!$t) return NULL;
		$r = NULL;
		foreach($t as $key=>$value) {
			$i = (isset($value->posID)) ? $value->posID : 0;
			$d = (isset($value->posMal)) ? $value->posMal : 0;
			if($i == $s) {
				$r = $d;
				break;
			}
		}
		return $r;
	}
?>
<script type="text/javascript">
var fr = '<?php echo $from; ?>';
$(document).ready(function() {
  $('.dtable').DataTable();
	$('.datepick').datetimepicker({ format: 'DD/MM/YYYY' });
	
	$('#copyCorres').off('change').on('change',function() {
		var ischecked = $(this).is(':checked');
		
		if(ischecked) {
			$('#permAddress').val( $('#corrAddress').val() );
			$('#permPostCode').val( $('#corrPostCode').val() );
			$('#permCity').val( $('#corrCity').val() );
			$('#permState').val( $('#corrState').val() );
			$('#permLatitude').val( $('#corrLatitude').val() );
			$('#permLongitude').val( $('#corrLongitude').val() );
		}
	});
	
	$('input[type="radio"][name="changeName"]').off('change').on('change',function() {
		var ischecked = $(this).is(':checked');
		var val = Number($(this).val());
		
		if(ischecked && val) {
			$('#changeNameOld, #changeNameDT').removeAttr('disabled');
		} else {
			$('#changeNameOld, #changeNameDT').attr('disabled', 'disabled');
		}
	});
	
	$('input[type="radio"][name="changeAddress"]').off('change').on('change',function() {
		var ischecked = $(this).is(':checked');
		var val = Number($(this).val());
		
		if(ischecked && val) {
			$('#changeAddressOld, #changeAddressDT').removeAttr('disabled');
		} else {
			$('#changeAddressOld, #changeAddressDT').attr('disabled', 'disabled');
		}
	});
	
	$('input[type="radio"][name="anotherShare"]').off('change').on('change',function() {
		var ischecked = $(this).is(':checked');
		var val = Number($(this).val());
		
		if(ischecked && val) {
			$('#anotherShareTable').slideDown();
		} else {
			$('#anotherShareTable').slideUp();
		}
	});
	
	$('input[type="radio"][name="changeShareholder"]').off('change').on('change',function() {
		var ischecked = $(this).is(':checked');
		var val = Number($(this).val());
		
		if(ischecked && val) {
			$('#changeShareholderTable').slideDown();
		} else {
			$('#changeShareholderTable').slideUp();
		}
	});
	
	$('input[type="radio"][name="changeDirector"]').off('change').on('change',function() {
		var ischecked = $(this).is(':checked');
		var val = Number($(this).val());
		
		if(ischecked && val) {
			$('#changeDirectorTable').slideDown();
		} else {
			$('#changeDirectorTable').slideUp();
		}
	});

	if(fr) {		
		var frMain = fr.replace('#tab_','').split("_");
		if(frMain.length > 1) {
			var parTab = '#tab_'+frMain[0];
		
			$('a[href="'+parTab+'"]').click();
			$('a[href="'+parTab+'"]').parent().addClass('active');
			
			var tab = '#tab_'+frMain[0]+'_'+frMain[1];		
			$('a[href="'+tab+'"]').click();
			$('a[href="'+tab+'"]').parent().addClass('active');
			
		} else {
			var tab = '#tab_'+frMain[0];
		
			$('a[href="'+tab+'"]').click();
			$('a[href="'+tab+'"]').parent().addClass('active');
		}
		
		var d = Number(($.trim( tab.replace(tab.substring(0,5),'') )).substr(0,1));
		if(d == 4) $('a:not([href*="#tab_4"])').off('click',CheckUnbalance).on('click',CheckUnbalance);
	}
	
	$('a[href*="#tab_4"]').off('click').on('click',function() {
		InitCheckUnbalance();
	});

	PNotify.prototype.options.delay = 500;
	
	$('input[name="yearCurr"]').datetimepicker({
			'viewMode': 'years',
			'format': 'YYYY'
	}).on('dp.change',onYearChange);		
});
	
/**
* @title : OnYearChange
* @desc	 : Repopulate table after year change
* @author : Zul Zolkaffly
* @last-update : Zul Zolkaffly (22/08/2016)
*/
function onYearChange(e) {
	var y = e.date._d.getFullYear();
	var p = y-1;
	
	$('input[name="yearCurr"], input#year0').val(y); $('.year_curr').html(y);
	$('input[name="yearPrev"], input#year1').val(p); $('.year_prev').html(p);
	
	LoadingOpen();
	
	OpeningBalanceYearChange();
	FinPosYearChange();
	PNLYearChange();
	
	LoadingClose();
}

function OpeningBalanceYearChange() {
	var y = $('input[name="yearCurr"], input#year0').val();
	var p = $('input[name="yearPrev"], input#year1').val();
	
	$.post('<?php echo base_url(); ?>apply/openingBalanceAjax',{ y:y, p:p },function(result) {			
		var obj = (result) ? JSON.parse(result) : null;
		if ( $.isEmptyObject( obj ) ) return;
		
		$('tr').show();
		$('input.item').val('');
		fnGetTotal();
		
		var years = (obj.hasOwnProperty('years') && obj['years'].length) ? obj['years'] : null;
		var balance = (obj.hasOwnProperty('balance') && !$.isEmptyObject( obj['balance'] )) ? obj['balance'] : null;
		var profit = (obj.hasOwnProperty('profit') && !$.isEmptyObject( obj['profit'] )) ? obj['profit'] : null;
		
		if ( !$.isEmptyObject( balance ) ) {
			$.each(balance, function(k,year) {					
				var $row = $('#item_'+k);					
				if ($row.length) {
					$.each(year, function(y,v) {
						if ( !$.isEmptyObject( v ) ) {
							$row.find('input[id*="bal_b_'+y+'"]').val(v['openingBalanceId']);
							$row.find('input[id*="debit_b_'+y+'"]').val(	accounting.formatNumber(v['openingBalanceDr'],2)	);
							$row.find('input[id*="credit_b_'+y+'"]').val(	accounting.formatNumber(v['openingBalanceCr'],2)	);
						}							
					});
				}
			});
		}
		
		if ( !$.isEmptyObject( profit ) ) {
			$.each(profit, function(k,year) {					
				var $row = $('#item_'+k);					
				if ($row.length) {
					$.each(year, function(y,v) {
						if ( !$.isEmptyObject( v ) ) {
							$row.find('input[id*="bal_p_'+y+'"]').val(v['openingBalanceId']);
							$row.find('input[id*="debit_p_'+y+'"]').val(	accounting.formatNumber(v['openingBalanceDr'],2)	);
							$row.find('input[id*="credit_p_'+y+'"]').val(	accounting.formatNumber(v['openingBalanceCr'],2)	);
						}							
					});
				}
			});
		}
		
		fnGetTotal();
		InitCheckUnbalance();
	});
	
}

function FinPosYearChange() {
	var y = $('input[name="yearCurr"], input#year0').val();
	var p = $('input[name="yearPrev"], input#year1').val();
	
	$.post('<?php echo base_url(); ?>apply/financialpositionAjax',{ y:y, p:p },function(result) {	
		var obj = (result) ? JSON.parse(result) : null;
		if ( $.isEmptyObject( obj ) ) return;
		
		$.each(obj, function(k,v) {			
			var key = k.split("_");			
			var $td = $('td#item_'+key[0]+'_'+key[1]+'_'+key[2]);			
			if($td.length) $td.html(		accounting.formatNumber(	Number(v)	,2)		);
		});
		fnGetTotalFinPos();
		InitCheckUnbalance();
	});
}

function PNLYearChange() {
	var y = $('input[name="yearCurr"], input#year0').val();
	var p = $('input[name="yearPrev"], input#year1').val();
	
	$.post('<?php echo base_url(); ?>apply/profitNlossAjax',{ y:y, p:p },function(result) {	
		var obj = (result) ? JSON.parse(result) : null;
		if ( $.isEmptyObject( obj ) ) return;
				
		$.each(obj, function(k,v) {			
			var key = k.split("_");			
			var $td = $('td#pnl_item_'+key[0]+'_'+key[1]);			
			if($td.length) $td.html(		accounting.formatNumber(	Number(v)	,2)		);
		});
		fnGetTotalPNL();
		InitCheckUnbalance();
	});
}


/**
* @title : LoadingOpen
* @desc	 : Load PNotify
* @author : Zul Zolkaffly
* @last-update : Zul Zolkaffly (22/08/2016)
*/
function LoadingOpen() {
	new PNotify({
			title: "Tunggu Sebentar",
			type: 'info',
			icon: 'fa fa-spinner fa-spin'
	});
}	

/**
* @title : LoadingClose
* @desc	 : Unload PNotify
* @author : Zul Zolkaffly
* @last-update : Zul Zolkaffly (22/08/2016)
*/
function LoadingClose() {
	PNotify.removeAll();
}	

function InitCheckUnbalance() {	
	$('a:not([href*="#tab_4"])').off('click',CheckUnbalance).on('click',CheckUnbalance);
}

function CheckUnbalance() {
	var $link = $(this);
	var href = $(this).attr('href');
	var block = false;
	$('input[id*="grand_debit_"]').each(function() {
		var y = this.id.replace('grand_debit_','');
		var year = Number($('input#year'+y).val());
		
		var crt = $('#grand_credit_'+y).val();
		var dbt = $(this).val();
		
		if (accounting.unformat(dbt) != accounting.unformat(crt)) {
			block = true;
			return;
		}
	});
	
	if(block) {		
		$('#unbalModal').modal('show');
		
		$('#unbalLeave').off('click').on('click',function() {			
			$('a:not([href*="#tab_4"])').off('click',CheckUnbalance);
			
			if(href.indexOf('#tab_') >= 0) {
				$link.click();
			} else {
				window.location.href = href;
			}
			
			$('#unbalModal').modal('hide');
			return true;
		});
		return false;
	} else {
		$('a:not([href*="#tab_4"])').off('click',CheckUnbalance);
	}
}

// SHARED FUNCTION FOR MODAL DIALOG
function OpenModal(category,id) {
	var $m = $('#modal');
	if( category && $m.length ) {
		$.post('<?php echo base_url(); ?>apply/openModal', { category: category, id : id }, function(res) {
			$m.find('.modal-content').html(res);
			$m.modal('show');	
			
			$('.datepick').datetimepicker({ format: 'DD/MM/YYYY' });
		});
	}
	return false;
}

function PromptDelete() {
	if(!confirm('Adakah anda pasti untuk memadam?')) return false;
}
</script>
<style>
/**
* CREATED BY ZUL ZOLKAFFLY (09/08/2016)
* CUSTOMIZED CHECKBOX STYLE
*/
._input_chosen { padding-left: 20px; cursor: pointer; }
._input_chosen ._in_checkbox,
._input_chosen ._in_radio { opacity: 0; position: absolute; margin-left: -20px; }
._input_chosen ._in_checkbox:checked + i,
._input_chosen ._in_radio:checked + i { }
._input_chosen ._in_checkbox:checked + i:before,
._input_chosen ._in_radio:checked + i:before {
	left: 0;
	top: 0;
	right:0;
	bottom:0;
	margin:0 auto;
	text-align:center;
	width: 100%;
	height: 100%;		
	vertical-align:middle;
	background-color: #2D3C49;
	border: 1px solid rgba(255,255,255,1);	
}
._input_chosen ._in_radio + i, ._input_chosen ._in_radio + i:before { border-radius: 50%; }
._input_chosen input[disabled] + i, fieldset[disabled] ._input_chosen ._in_checkbox + i { border-color: #dee5e7; }
._input_chosen input[disabled] + i:before, fieldset[disabled] ._input_chosen ._in_checkbox + i:before { background-color: #dee5e7; }
._input_chosen > i {
	width: 20px;
	height: 20px;
	line-height: 1;
	border: 1px solid #2D3C49 !important;
	background-color:rgba(255,255,255,0.5);   
	margin-top: -2px;
	display: inline-block;
	margin-right: 4px;
	border:0;
	position: relative;
}
._input_chosen > i:before {
    content: "";
    position: absolute;
    top: 10px;
    width: 0px;
    height: 0px;
    background-color: transparent;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
}
input[type="text"].in_number { width: 8vw !important; text-align: center !important; }
@media only screen and (max-width: 767px) {
	input[type="text"].in_number { width: 20vw !important; text-align: center !important; }
	/*.box-body { overflow: hidden !important; }*/
}
</style>
<div class="content-wrapper">
	<section class="content-header">
		<h1><?php echo $this->lang->line('newrequest'); ?></h1>
		<ol class="breadcrumb">
			<li><a href="#"><i class="fa fa-dashboard"></i><?php echo $this->lang->line('request'); ?></a></li>
			<li class="active"><?php echo $this->lang->line('new'); ?></a></li>
		</ol>
	</section>
	
	<section class="content">
	
		<!-- REQUEST DETAIL -->
		<div class="box">
			<div class="box-header with-border">
				<h3 class="box-title"><?php echo $this->lang->line('applicationDetail'); ?></h3>
				<div class="box-tools pull-right">
					<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
				</div>
			</div>
			
			<div class="box-body">
				<div class="box-sm pull-left">
					<button class="btn btn-xs btn-primary btn-block"><i class="fa fa-print"></i>&nbsp;Cetak</button>
				</div>
			</div>
			
			<div class="box-body">
				<div class="nav-tabs-custom">
					<!-- TAB MENU -->
					<ul class="nav nav-tabs">
						<li class="hidden-xs active"><a href="#tab_1" data-toggle="tab"><strong>A) 	JENIS PERMOHONAN</strong></a></li>
						<li class="hidden-xs"><a href="#tab_2" data-toggle="tab"><strong>B) PROFIL SYARIKAT MEMOHON</strong></a></li>
						<li class="hidden-xs"><a href="#tab_3" data-toggle="tab"><strong>C) MAKLUMAT PEMEGANG SAHAM & AHLI LEMBAGA PENGARAH</strong></a></li>
						<li class="hidden-xs"><a href="#tab_4" data-toggle="tab"><strong>D) MAKLUMAT KEWANGAN</strong></a></li>
						<li class="dropdown hidden-lg">
							<a class="dropdown-toggle" data-toggle="dropdown" href="Javascript:void(0);"><strong><i class="fa fa-bars"></i><span class="caret"></span></strong></a>
							<ul class="dropdown-menu">
								<li role="presentation"><a role="menuitem" tabindex="1" href="#tab_1" data-toggle="tab"><strong>A) JENIS PERMOHONAN</strong></a></li>
								<li role="presentation"><a role="menuitem" tabindex="2" href="#tab_2" data-toggle="tab"><strong>B) PROFIL SYARIKAT MEMOHON</strong></a></li>
								<li role="presentation"><a role="menuitem" tabindex="3" href="#tab_3" data-toggle="tab"><strong>C) MAKLUMAT PEMEGANG SAHAM & AHLI LEMBAGA PENGARAH</strong></a></li>
								<li role="presentation"><a role="menuitem" tabindex="4" href="#tab_4" data-toggle="tab"><strong>D) MAKLUMAT KEWANGAN</strong></a></li>
							</ul>
						</li>
					</ul>
					
					<!-- TAB CONTENT -->
					<div class="tab-content">
						<!-- A) JENIS PERMOHONAN -->
						<div class="tab-pane active" id="tab_1">
							<form class="form-vertical" action="<?php echo base_url(); ?>apply/save" method="post" id="form1">
								<input type="hidden" name="category" value="MAIN" />
								<input type="hidden" name="from" value="#tab_1" />
								<div class="row">
									<div class="col-md-12">
										<div class="form-group">
											<span class="_custom_input">
												<label class="_input_chosen">
												<input type="checkbox" value="1" id="typeCar" name="typeCar" class="_in_checkbox" <?php echo ($company['main']->typeCar) ? "checked=\"checked\" " : ""; ?>><i></i>
												</label>
												<span>Kereta</span>
											</span>
											&nbsp;&nbsp;
											<span class="_custom_input">
												<label class="_input_chosen">
													<input type="checkbox" value="1" id="typeMotor" name="typeMotor" class="_in_checkbox"  <?php echo ($company['main']->typeMotor) ? "checked=\"checked\" " : ""; ?>><i></i>
												</label>
												<span>Motosikal</span>
											</span>
										</div>
									</div>
								</div>

								<div class="box-footer">
									<div class="pull-right box-sm">
										<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
										<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
									</div>
								</div>
							</form>
						</div>
						
						<!-- B) PROFIL SYARIKAT -->
						<div class="tab-pane" id="tab_2">
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
									<li class="hidden-xs active"><a href="#tab_2_1" data-toggle="tab"><strong>i) Muka 1</strong></a></li>
									<li class="hidden-xs"><a href="#tab_2_2" data-toggle="tab"><strong>ii) Muka 2</strong></a></li>
									<li class="dropdown hidden-lg">
										<a class="dropdown-toggle" data-toggle="dropdown" href="Javascript:void(0);"><strong><i class="fa fa-bars"></i><span class="caret"></span></strong></a>
										<ul class="dropdown-menu">
											<li role="presentation"><a role="menuitem" tabindex="1" href="#tab_2_1" data-toggle="tab"><strong>i) Muka 1</strong></a></li>
											<li role="presentation"><a role="menuitem" tabindex="2" href="#tab_2_2" data-toggle="tab"><strong>ii) Muka 2</strong></a></li>
										</ul>
									</li>
								</ul>
								
								<div class="tab-content">
									<div class="tab-pane active" id="tab_2_1">
										<!-- NAMA DAN NO PENDAFTARAN -->
										<div class="box box-warning">
											<form class="form-vertical" action="<?php echo base_url(); ?>apply/save" method="post" id="form211">
												<input type="hidden" name="category" value="MAIN" />
												<input type="hidden" name="from" value="#tab_2_1" />
												<div class="box-header with-border">
													<h3 class="box-title">Nama dan Nombor Pendaftaran</h3>
													<div class="box-tools pull-right">
														<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
													</div>
												</div>
												
												<div class="box-body">
													<div class="row">
														<div class="col-md-6">
															<!-- COMPANY NAME -->
															<div class="form-group">
																<label for="companyName" class="col-sm-4 control-label"><?php echo $this->lang->line('companyName'); ?></label>
																<div class="col-sm-8">
																	<input type="text" class="form-control" id="companyName" name="companyName"
																	value="<?php echo ($company['main'] && $company['main']->companyName) ? $company['main']->companyName : NULL; ?>"
																	placeholder="<?php echo $this->lang->line('companyName'); ?>" value="">
																</div>
															</div>
														</div>
														
														<div class="col-md-6">
															<!-- COMPANY REGISTRATION NO -->
															<div class="form-group">
																<label for="companyNo" class="col-sm-4 control-label"><?php echo $this->lang->line('companyNo'); ?></label>
																<div class="col-sm-8">
																	<input type="text" class="form-control" id="companyNo" name="companyNo"
																	value="<?php echo ($company['main'] && $company['main']->companyNo) ? $company['main']->companyNo : NULL; ?>"
																	placeholder="<?php echo $this->lang->line('companyNo'); ?>" value="">
																</div>
															</div>
														</div>
													</div>
												</div>
								
												<div class="box-footer">
													<div class="pull-right box-sm">
														<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
														<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
													</div>
												</div>
											</form>
										</div>
										
										<!-- AKTIVITI UTAMA SYARIKAT -->
										<div class="box box-warning">
											<div class="box-header with-border">
												<h3 class="box-title">Aktiviti Utama Syarikat</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<div style="overflow: auto; padding: 0.25%">
													<button class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('activity',0);">
														<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
													</button>
												</div>
												<table id="compActTable" class="table dtable table-striped">
													<thead><tr><th>Bil</th><th>Keterangan</th><th>Tempoh (Tahun)</th><th>&nbsp;</th></tr></thead>
													<tbody>
														<?php
														if($company['activities']) {
															foreach($company['activities'] as $key=>$value) {
																?>
																	<tr>
																		<td><?php echo ($key+1); ?></td>
																		<td><a href="javascript:OpenModal('activity',<?php echo $value->ID; ?>);"><?php echo $value->description; ?></a></td>
																		<td><?php echo $value->year; ?></td>
																		<td><a class="btn btn-xs bg-red"
																					onclick="return PromptDelete();"
																					href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/activity"><i class="fa fa-trash"></i></a></td>
																	</tr>
																<?php
															}
														}
														?>
													</tbody>
												</table>
											</div>
										</div>
										
										<!-- ALAMAT SURAT MENYURAT -->
										<div class="box box-warning">
											<form class="form-vertical" action="<?php echo base_url(); ?>apply/save" method="post" id="form213">
											<input type="hidden" name="category" value="ADDRESS" />
											<input type="hidden" name="corrType" value="CORRES" />
											<input type="hidden" name="from" value="#tab_2_1" />
											<div class="box-header with-border">
												<h3 class="box-title">Alamat Surat Menyurat</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<!-- CORRESPONDENCE ADDRESS -->
												<div class="row">
													<div class="col-md-6">
														<!-- ADDRESS -->
														<div class="form-group">
															<label for="address" class="col-sm-4 control-label"><?php echo $this->lang->line('address'); ?></label>
															<div class="col-sm-8">
																<?php $address = ($company['address']['corres'] && $company['address']['corres']->address) ? $company['address']['corres']->address : NULL; ?>
																<textarea type="text" class="form-control" row="30" id="corrAddress" name="address"><?php echo $address ?></textarea>
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- POSTCODE -->
														<div class="form-group">
															<label for="postCode" class="col-sm-4 control-label"><?php echo $this->lang->line('postCode'); ?></label>
															<div class="col-sm-8">
																<?php $postCode = ($company['address']['corres'] && $company['address']['corres']->postCode) ? $company['address']['corres']->postCode : NULL; ?>
																<input type="text" class="form-control" id="corrPostCode" name="postCode"
																	placeholder="<?php echo $this->lang->line('postCode'); ?>" value="<?php echo $postCode; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- CITY -->
														<div class="form-group">
															<label for="city" class="col-sm-4 control-label"><?php echo $this->lang->line('city'); ?></label>
															<div class="col-sm-8">
																<?php $city = ($company['address']['corres'] && $company['address']['corres']->city) ? $company['address']['corres']->city : NULL; ?>
																<input type="text" class="form-control" id="corrCity" name="city"
																	placeholder="<?php echo $this->lang->line('city'); ?>" value="<?php echo $city; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
													
													<div class="col-md-6">
														<!-- STATE -->
														<div class="form-group">
															<label for="stateID" class="col-sm-4 control-label"><?php echo $this->lang->line('stateID');?></label>
															<div class="col-sm-8">
																<select id="corrState" name="stateID" class="form-control">
																<option disabled selected>---</option>
																<?php
																$stateID = ($company['address']['corres'] && $company['address']['corres']->stateID) ? $company['address']['corres']->stateID : NULL;
																if (isset($states) && $states) {
																	foreach($states as $state)  {
																	?>
																		<option value="<?php echo $state->fldid;?>"
																			<?php echo ($state->fldid == $stateID) ? " selected=\"selected\" " : ""; ?>
																		><?php echo $state->fldname;?></option>
																	<?php
																	}
																}
																?>
																</select>
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- LATITUDE -->
														<div class="form-group">
															<label for="latitude" class="col-sm-4 control-label"><?php echo $this->lang->line('latitude'); ?></label>
															<div class="col-sm-8">
																<div class="row">
																	
																	<?php $latitude = ($company['address']['corres'] && $company['address']['corres']->latitude) ? $company['address']['corres']->latitude : NULL; ?>
																	<input type="text" class="form-control" id="corrLatitude" name="latitude" placeholder="<?php echo $this->lang->line('latitude'); ?>" value="<?php echo $latitude; ?>">
																	
																</div>
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- LONGITUDE -->
														<div class="form-group">
															<label for="longitude" class="col-sm-4 control-label"><?php echo $this->lang->line('longitude'); ?></label>
															<div class="col-sm-8">
																<div class="row">
																	<?php $longitude = ($company['address']['corres'] && $company['address']['corres']->longitude) ? $company['address']['corres']->longitude : NULL; ?>
																	<input type="text" class="form-control" id="corrLongitude" name="longitude" placeholder="<?php echo $this->lang->line('longitude'); ?>" value="<?php echo $longitude; ?>">
																	
																</div>
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="pull-right box-sm">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
										
										<!-- PHONE/FAX/EMAIL/WEBSITE -->
										<div class="box box-warning">
											<form class="form-vertical" action="<?php echo base_url(); ?>apply/save" method="post" id="form214">
											<input type="hidden" name="category" value="MAIN" />
											<input type="hidden" name="from" value="#tab_2_1" />
											<div class="box-header with-border">
												<h3 class="box-title">Telefon, Fax, Emel dan Laman Web</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<div class="row">
													<div class="col-md-6">
														<!-- PHONE NO -->
														<div class="form-group">
															<label for="phoneNo" class="col-sm-4 control-label"><?php echo $this->lang->line('phoneNo'); ?></label>
															<div class="col-sm-8">
																<?php $phoneNo = ($company['main'] && $company['main']->phoneNo) ? $company['main']->phoneNo : NULL; ?>
																<input type="text" class="form-control" id="phoneNo" name="phoneNo" placeholder="<?php echo $this->lang->line('phoneNo'); ?>" value="<?php echo $phoneNo; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
														<!-- EMAIL -->
														<div class="form-group">
															<label for="email" class="col-sm-4 control-label"><?php echo $this->lang->line('email'); ?></label>
															<div class="col-sm-8">
																<?php $email = ($company['main'] && $company['main']->email) ? $company['main']->email : NULL; ?>
																<input type="text" class="form-control" id="email" name="email" placeholder="<?php echo $this->lang->line('email'); ?>" value="<?php echo $email; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
													
													<div class="col-md-6">
														<!-- FAX NO -->
														<div class="form-group">
															<label for="faxNo" class="col-sm-4 control-label"><?php echo $this->lang->line('faxNo'); ?></label>
															<div class="col-sm-8">
																<?php $faxNo = ($company['main'] && $company['main']->faxNo) ? $company['main']->faxNo : NULL; ?>
																<input type="text" class="form-control" id="faxNo" name="faxNo" placeholder="<?php echo $this->lang->line('faxNo'); ?>" value="<?php echo $faxNo; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
														<!-- WEBSITE -->
														<div class="form-group">
															<label for="website" class="col-sm-4 control-label"><?php echo $this->lang->line('website'); ?></label>
															<div class="col-sm-8">
																<?php $website = ($company['main'] && $company['main']->website) ? $company['main']->website : NULL; ?>
																<input type="text" class="form-control" id="website" name="website" placeholder="<?php echo $this->lang->line('website'); ?>" value="<?php echo $website; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="pull-right box-sm">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
									</div>	
										
									<div class="tab-pane" id="tab_2_2">
										<!-- PERMANENT ADDRESS -->
										<div class="box box-warning">
											<form class="form-vertical" action="<?php echo base_url(); ?>apply/save" method="post" id="form221">
											<input type="hidden" name="category" value="ADDRESS" />
											<input type="hidden" name="corrType" value="PERM" />
											<input type="hidden" name="from" value="#tab_2_2" />
											<div class="box-header with-border">
												<h3 class="box-title">Alamat Ibu Pejabat/Berdaftar</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<div class="row">
													<div class="col-md-12">
														<span class="form-group _custom_input">
															<label class="_input_chosen">
																<?php $copyCorres = ($company['address']['perm'] && $company['address']['perm']->copyCorres) ? $company['address']['perm']->copyCorres : NULL; ?>
																<input type="checkbox" value="1"
																		<?php echo ($copyCorres) ? " checked=\"checked\" " : ""; ?>
																		id="copyCorres" name="copyCorres" class="_in_checkbox" ><i></i>
															</label>
															<span>Sama dengan alamat surat-menyurat</span>
															<div>&nbsp;</div>
														</span>
													</div>
													
													<div class="col-md-6" id="permAddLeft" >
														<!-- ADDRESS -->
														<div class="form-group">
															<label for="address" class="col-sm-4 control-label"><?php echo $this->lang->line('address'); ?></label>
															<div class="col-sm-8">
																<?php $address = ($company['address']['perm'] && $company['address']['perm']->address) ? $company['address']['perm']->address : NULL; ?>
																<textarea type="text" class="form-control" row="30" id="permAddress" name="address"><?php echo $address ?></textarea>
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- POSTCODE -->
														<div class="form-group">
															<label for="postCode" class="col-sm-4 control-label"><?php echo $this->lang->line('postCode'); ?></label>
															<div class="col-sm-8">
																<?php $postCode = ($company['address']['perm'] && $company['address']['perm']->postCode) ? $company['address']['perm']->postCode : NULL; ?>
																<input type="text" class="form-control" id="permPostCode" name="postCode"
																	placeholder="<?php echo $this->lang->line('postCode'); ?>" value="<?php echo $postCode; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- CITY -->
														<div class="form-group">
															<label for="city" class="col-sm-4 control-label"><?php echo $this->lang->line('city'); ?></label>
															<div class="col-sm-8">
																<?php $city = ($company['address']['perm'] && $company['address']['perm']->city) ? $company['address']['perm']->city : NULL; ?>
																<input type="text" class="form-control" id="permCity" name="city"
																	placeholder="<?php echo $this->lang->line('city'); ?>" value="<?php echo $city; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
													
													<div class="col-md-6" id="permAddRight" >
														<!-- STATE -->
														<div class="form-group">
															<label for="stateID" class="col-sm-4 control-label"><?php echo $this->lang->line('stateID');?></label>
															<div class="col-sm-8">
																<select id="permState" name="stateID" class="form-control">
																<option disabled selected>---</option>
																<?php
																$stateID = ($company['address']['perm'] && $company['address']['perm']->stateID) ? $company['address']['perm']->stateID : NULL;
																if (isset($states) && $states) {
																	foreach($states as $state)  {
																	?>
																		<option value="<?php echo $state->fldid;?>"
																			<?php echo ($state->fldid == $stateID) ? " selected=\"selected\" " : ""; ?>
																		><?php echo $state->fldname;?></option>
																	<?php
																	}
																}
																?>
																</select>
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- LATITUDE -->
														<div class="form-group">
															<label for="latitude" class="col-sm-4 control-label"><?php echo $this->lang->line('latitude'); ?></label>
															<div class="col-sm-8">
																<?php $latitude = ($company['address']['perm'] && $company['address']['perm']->latitude) ? $company['address']['perm']->latitude : NULL; ?>
																<input type="text" class="form-control" id="permLatitude" name="latitude" placeholder="<?php echo $this->lang->line('latitude'); ?>" value="<?php echo $latitude; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
														
														<!-- LONGITUDE -->
														<div class="form-group">
															<label for="longitude" class="col-sm-4 control-label"><?php echo $this->lang->line('longitude'); ?></label>
															<div class="col-sm-8">
																<?php $longitude = ($company['address']['perm'] && $company['address']['perm']->longitude) ? $company['address']['perm']->longitude : NULL; ?>
																<input type="text" class="form-control" id="permLongitude" name="longitude" placeholder="<?php echo $this->lang->line('longitude'); ?>" value="<?php echo $longitude; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="pull-right box-sm">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
										
										<!-- BRANCH -->
										<div class="box box-warning">
											<div class="box-header with-border">
												<h3 class="box-title">Alamat Cawangan, Ruang Pameran atau/dan Ruang Simpanan</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<div style="overflow: auto; padding: 0.25%">
													<button class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('branch',0);">
														<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
													</button>
												</div>
												<table id="compActTable" class="table dtable table-striped">
												<thead><tr><th>Bil</th><th>Alamat</th><th>&nbsp;</th></tr></thead>
												<tbody>
													<?php
													if($company['branches']) {
														foreach($company['branches'] as $key=>$value) {
															?>
															<tr>
																<td><?php echo ($key+1); ?></td>
																<td>
																<?php
																$address = ($value->address) ? $value->address : NULL;
																$address .= ($value->city) ? (($address)?", ":"").$value->city : NULL;
																$address .= ($value->postCode) ? (($address)?", ":"").$value->postCode : NULL;
																$address .= ($value->stateID) ? (($address)?", ":"").(GetStateName($value->stateID,$states)) : NULL;
																
																$address .= ($value->latitude) ? (($address)?",<br />Latitud: ":"").$value->latitude : NULL;
																$address .= ($value->longitude) ? (($address)?",<br />Longitud: ":"").$value->longitude : NULL;
																?>
																<a href="javascript:OpenModal('branch',<?php echo $value->ID; ?>);"><?php echo nl2br($address); ?></a>
																</td>
																<td><a class="btn btn-xs bg-red"
																			onclick="return PromptDelete();"
																			href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/branch"><i class="fa fa-trash"></i></a></td>
															</tr>
															<?php
														}
													}
													?>
												</tbody>
												</table>
											</div>
											
										</div>
										
										<!-- MODAL -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form223">
											<input type="hidden" name="from" value="#tab_2_2" />
											<input type="hidden" name="category" value="MAIN" />
											<div class="box-header with-border">
												<h3 class="box-title">Modal Berbayar Terkini</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<div class="row">
													<div class="col-md-12" style="padding: 0 20%;">
														<div class="form-group">
															<label for="compModal" class="col-sm-4 control-label">RM&nbsp;</label>
															<div class="col-sm-8">
																<?php $capital = ($company['main'] && $company['main']->capital) ? $company['main']->capital : 0; ?>
																<input type="text" class="form-control" id="capital" name="capital" placeholder="1000000" value="<?php echo number_format($capital,2); ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
										
										<!-- EMPLOYEE -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form224">
											<input type="hidden" name="from" value="#tab_2_2" />
											<input type="hidden" name="category" value="EMPLOYEE" />
											<div class="box-header with-border">
												<h3 class="box-title">Pekerja</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<h5>Bilangan Pekerja Tetap/Kontrak Sama Ada Sepenuh Masa Atau Sambilan</h5>
												<table id="compActTable" class="table table-striped">
												<thead>
													<tr>
														<th class="col-sm-6">Ibu Pejabat/Cawangan</th>
														<th>Tetap & Sepenuh Masa</th>
														<th>Tetap & Sambilan</th>
														<th>Kontrak & Sepenuh Masa</th>
														<th>Kontrak & Sambilan</th>
													</tr>
												</thead>
												<tbody>
													<?php
													$ehq = ($company['employee']['hq']) ? $company['employee']['hq'][0] : NULL;
													$ebr = ($company['employee']['branch']) ? $company['employee']['branch'] : 0;
													?>
													<tr>
														<td class="col-sm-6">
															<strong>Ibu Pejabat</strong>
															<?php $empID = ($ehq && $ehq->ID) ? $ehq->ID : 0; ?>
															<input type="hidden" name="empID[0]" value="<?php echo $empID; ?>">
															<input type="hidden" name="type[0]" value="HQ" />
															<input type="hidden" name="branchID[0]" value="0" />
														</td>
														<td>
															<?php $empPermFull = ($ehq && $ehq->empPermFull) ? $ehq->empPermFull : 0; ?>
															<input type="text" class="form-control in_number" id="empPermFull_0" name="empPermFull[0]" placeholder="1" value="<?php echo $empPermFull; ?>">
														</td>
														<td>
															<?php $empPermPart = ($ehq && $ehq->empPermPart) ? $ehq->empPermPart : 0; ?>
															<input type="text" class="form-control in_number" id="empPermPart_0" name="empPermPart[0]" placeholder="1" value="<?php echo $empPermPart; ?>">
														</td>
														<td>
															<?php $empConFull = ($ehq && $ehq->empConFull) ? $ehq->empConFull : 0; ?>
															<input type="text" class="form-control in_number" id="empConFull_0" name="empConFull[0]" placeholder="1" value="<?php echo $empConFull; ?>">
														</td>
														<td>
															<?php $empConPart = ($ehq && $ehq->empConPart) ? $ehq->empConPart : 0; ?>
															<input type="text" class="form-control in_number" id="empConPart_0" name="empConPart[0]" placeholder="1" value="<?php echo $empConPart; ?>">
														</td>
													</tr>
													<?php
													
													if($company['branches']) {
														foreach($company['branches'] as $key=>$value) {
															$b = ($ebr && isset($ebr[$value->ID])) ? $ebr[$value->ID] : NULL;
															$k = $key+1;
															?>
															<tr>
																<td class="col-sm-6">
																<?php $empID = ($b && $b->ID) ? $b->ID : 0; ?>
																<input type="hidden" name="empID[<?php echo $k; ?>]" value="<?php echo $empID; ?>" />
																<input type="hidden" name="type[<?php echo $k; ?>]" value="BRANCH" />
																<input type="hidden" name="branchID[<?php echo $k; ?>]" value="<?php echo $value->ID; ?>" />
																<?php
																$address = ($value->address) ? $value->address : NULL;
																$address .= ($value->city) ? (($address)?", \n":"").$value->city : NULL;
																$address .= ($value->postCode) ? (($address)?", ":"").$value->postCode : NULL;
																$address .= ($value->stateID) ? (($address)?", ":"").(GetStateName($value->stateID,$states)) : NULL;
																echo nl2br($address);
																?>
																</td>
																<td>
																	<?php $empPermFull = ($b && $b->empPermFull) ? $b->empPermFull : 0; ?>
																	<input type="text" class="form-control in_number" id="empPermFull_<?php echo $k; ?>" name="empPermFull[<?php echo $k; ?>]" placeholder="1" value="<?php echo $empPermFull; ?>">
																</td>
																<td>
																	<?php $empPermPart = ($b && $b->empPermPart) ? $b->empPermPart : 0; ?>
																	<input type="text" class="form-control in_number" id="empPermPart_<?php echo $k; ?>" name="empPermPart[<?php echo $k; ?>]" placeholder="1" value="<?php echo $empPermPart; ?>">
																</td>
																<td>
																	<?php $empConFull = ($b && $b->empConFull) ? $b->empConFull : 0; ?>
																	<input type="text" class="form-control in_number" id="empConFull_<?php echo $k; ?>" name="empConFull[<?php echo $k; ?>]" placeholder="1" value="<?php echo $empConFull; ?>">
																</td>
																<td>
																	<?php $empConPart = ($b && $b->empConPart) ? $b->empConPart : 0; ?>
																	<input type="text" class="form-control in_number" id="empConPart_<?php echo $k; ?>" name="empConPart[<?php echo $k; ?>]" placeholder="1" value="<?php echo $empConPart; ?>">
																</td>
															</tr>
															<?php
														}
													}
													
													?>
												</tbody>
												<tfoot>
												</tfoot>
												</table>
												
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
										
										<!-- CHANGE OF NAME -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form225">
											<input type="hidden" name="from" value="#tab_2_2" />
											<input type="hidden" name="category" value="MAIN" />
											<div class="box-header with-border">
												<h3 class="box-title">Perubahan Nama</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<h5>Perubahan Nama Syarikat Dalam Tempoh Tiga (3) Tahun Kebelakangan</h5>
												<div class="row">
													<div class="col-md-6">
														<div class="form-group">
															<?php $changeName = ($company['main'] && $company['main']->changeName) ? $company['main']->changeName : 0; ?>
															<label for="changeName" class="col-sm-4 control-label">&nbsp;</label>
															<div class="col-sm-8">
																<span class="_custom_input">
																	<label class="_input_chosen">
																	<input type="radio" value="1" id="changeName_1" name="changeName"
																				<?php echo ($changeName) ? " checked=\"checked\" " : ""; ?>
																				class="_in_radio" ><i></i>
																	</label>
																	<span>Ada</span>
																</span>
																<span class="_custom_input">
																	<label class="_input_chosen">
																		<input type="radio" value="0" id="changeName_2" name="changeName"
																				<?php echo (!$changeName) ? " checked=\"checked\" " : ""; ?>
																				class="_in_radio" ><i></i>
																	</label>
																	<span>Tiada</span>
																</span>
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<?php $changeNameOld = ($company['main'] && $company['main']->changeNameOld) ? $company['main']->changeNameOld : NULL; ?>
															<label for="changeNameOld" class="col-sm-4 control-label">Nama syarikat sebelum perubahan</label>
															<div class="col-sm-8">
																<input
																	<?php echo (!$changeName) ? " disabled=\"disabled\" " : ""; ?>
																	type="text" class="form-control" id="changeNameOld" name="changeNameOld" placeholder="" value="<?php echo $changeNameOld; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<?php $changeNameDT = ($company['main'] && $company['main']->changeNameDT) ? $company['main']->changeNameDT : NULL; ?>
															<label for="changeNameDT" class="col-sm-4 control-label">Tarikh kuat kuasa perubahan nama syarikat</label>
															<div class="col-sm-8">
																<input
																	<?php echo (!$changeName) ? " disabled=\"disabled\" " : ""; ?>
																	type="text" class="form-control datepick" id="changeNameDT" name="changeNameDT" placeholder="" value="<?php echo $changeNameDT; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
										
										<!-- CHANGE OF ADDRESS -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form226">
											<input type="hidden" name="from" value="#tab_2_2" />
											<input type="hidden" name="category" value="MAIN" />
											<div class="box-header with-border">
												<h3 class="box-title">Perubahan Alamat</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<h5>Perubahan Alamat Ibu Pejabat Syarikat Dalam Tempoh Tiga (3) Tahun Kebelakangan</h5>
												<div class="row">
													<div class="col-md-6">
														<div class="form-group">
															<label for="changeAddress" class="col-sm-4 control-label">&nbsp;</label>
															<div class="col-sm-8">
																<?php $changeAddress = ($company['main'] && $company['main']->changeAddress) ? $company['main']->changeAddress : 0; ?>
																<span class="_custom_input">
																	<label class="_input_chosen">
																	<input type="radio" value="1" id="changeAddress_1" name="changeAddress"
																				<?php echo ($changeAddress) ? " checked=\"checked\" " : ""; ?>
																				class="_in_radio" ><i></i>
																	</label>
																	<span>Ada</span>
																</span>
																<span class="_custom_input">
																	<label class="_input_chosen">
																		<input type="radio" value="0" id="changeAddress_2" name="changeAddress"
																				<?php echo (!$changeAddress) ? " checked=\"checked\" " : ""; ?>
																				class="_in_radio" ><i></i>
																	</label>
																	<span>Tiada</span>
																</span>
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<label for="changeAddressOld" class="col-sm-4 control-label">Alamat Ibu Pejabat sebelum perubahan</label>
															<div class="col-sm-8">
																<?php $changeAddressOld = ($company['main'] && $company['main']->changeAddressOld) ? $company['main']->changeAddressOld : NULL; ?>
																<textarea
																	<?php echo (!$changeAddress) ? " disabled=\"disabled\" " : ""; ?>
																	class="form-control" id="changeAddressOld" name="changeAddressOld"><?php echo $changeAddressOld; ?></textarea>
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<label for="changeAddressDT" class="col-sm-4 control-label">Tarikh kuat kuasa perubahan alamat Ibu Pejabat</label>
															<div class="col-sm-8">
																<?php $changeAddressDT = ($company['main'] && $company['main']->changeAddressDT) ? $company['main']->changeAddressDT : NULL; ?>
																<input
																	<?php echo (!$changeAddress) ? " disabled=\"disabled\" " : ""; ?>
																	type="text" class="form-control datepick" id="changeAddressDT" name="changeAddressDT" placeholder="" value="<?php echo $changeAddressDT; ?>">
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
										
									</div>
								</div>
							</div>
						</div>
						
						<!-- C) PEMEGANG SAHAM -->
						<div class="tab-pane" id="tab_3">
							<div class="nav-tabs-custom">
								<ul class="nav nav-tabs">
									<li class="hidden-xs active"><a href="#tab_3_1" data-toggle="tab"><b>i) Muka 1</b></a></li>
									<li class="hidden-xs"><a href="#tab_3_2" data-toggle="tab"><b>ii) Muka 2</b></a></li>
									<li class="dropdown hidden-lg">
										<a class="dropdown-toggle" data-toggle="dropdown" href="Javascript:void(0);">Menu<span class="caret"></span></a>
										<ul class="dropdown-menu">
											<li role="presentation"><a role="menuitem" tabindex="1" href="#tab_3_1" data-toggle="tab"><b>i) Muka 1</b></a></li>
											<li role="presentation"><a role="menuitem" tabindex="2" href="#tab_3_2" data-toggle="tab"><b>ii) Muka 2</b></a></li>
										</ul>
									</li>
								</ul>
														
								
								<div class="tab-content">
									<div class="tab-pane active" id="tab_3_1">
										<!-- PEMEGANG SAHAM -->
										<div class="box box-warning">
											<div class="box-header with-border">
												<h3 class="box-title">Senarai Pemegang Saham</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<div style="overflow: auto; padding: 0.25%">
													<button id="addNewShareholder" class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('shareholder',0);">
														<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
													</button>
												</div>
												<table id="shareholderTable" class="table dtable table-striped">
													<thead>
														<tr>
															<th>Bil</th>
															<th>Nama</th>
															<th>Kad Pengenalan</th>
															<th>Unit Saham (RM)</th>
															<th>Peratusan (%)</th>
															<th>Bumiputera</th>
															<th>&nbsp;</th>
														</tr>
													</thead>
													<tbody>
													<?php
													if($company['shareholders']) {
														foreach($company['shareholders'] as $key=>$value) {
															?>
															<tr>
																<td><?php echo ($key+1); ?></td>
																<td><a href="Javascript:OpenModal('shareholder',<?php echo $value->ID; ?>)"><?php echo $value->name; ?></a></td>
																<td><?php echo $value->ic; ?></td>
																<td><?php echo number_format($value->unit,2); ?></td>
																<td><?php echo $value->percent; ?></td>
																<td><?php echo ($value->bumi) ? "<i class=\"fa fa-check\"></i>" : "<i class=\"fa fa-times\"></i>"; ?></td>
																<td><a class="btn btn-xs bg-red"
																			onclick="return PromptDelete();"
																			href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/shareholder"><i class="fa fa-trash"></i></a></td>
															</tr>
															<?php
														}
													}
													?>
													</tbody>
												</table>
											</div>
										</div>
										
										<!-- PENGARAH -->
										<div class="box box-warning">
											<div class="box-header with-border">
												<h3 class="box-title">Senarai Ahli Lembaga Pengarah</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<div style="overflow: auto; padding: 0.25%">
													<button id="addNewDirector" class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('director',0);">
														<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
													</button>
												</div>
												<table id="directorTable" class="table dtable table-striped">
													<thead>
														<tr>
															<th>Bil</th>
															<th>Nama</th>
															<th>Kad Pengenalan</th>
															<th>Bumiputera</th>
															<th>&nbsp;</th>
														</tr>
													</thead>
													<tbody>
													<?php
													if($company['directors']) {
														foreach($company['directors'] as $key=>$value) {
															?>
															<tr>
																<td><?php echo ($key+1); ?></td>
																<td><a href="Javascript:OpenModal('director',<?php echo $value->ID; ?>)"><?php echo $value->name; ?></a></td>
																<td><?php echo $value->ic; ?></td>
																<td><?php echo ($value->bumi) ? "<i class=\"fa fa-check\"></i>" : "<i class=\"fa fa-times\"></i>"; ?></td>
																<td><a class="btn btn-xs bg-red"
																			onclick="return PromptDelete();"
																			href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/director"><i class="fa fa-trash"></i></a></td>
															</tr>
															<?php
														}
													}
													?>
													</tbody>
												</table>
											</div>
										</div>
										
										<!-- MANAGEMENT -->
										<div class="box box-warning">
											<div class="box-header with-border">
												<h3 class="box-title">Senarai Pengurusan Tertinggi Syarikat</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
											
											<div class="box-body">
												<div style="overflow: auto; padding: 0.25%">
													<button id="addNewMgmt" class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('mgmt',0);">
														<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
													</button>
												</div>
												<table id="mgmtTable" class="table dtable table-striped">
													<thead>
														<tr>
															<th>Bil</th>
															<th>Nama</th>
															<th>Kad Pengenalan</th>
															<th>Jawatan</th>
															<th>Bumiputera</th>
															<th>&nbsp;</th>
														</tr>
													</thead>
													<tbody>
													<?php
													if($company['mgmts']) {
														foreach($company['mgmts'] as $key=>$value) {
															?>
															<tr>
																<td><?php echo ($key+1); ?></td>
																<td><a href="Javascript:OpenModal('mgmt',<?php echo $value->ID; ?>)"><?php echo $value->name; ?></a></td>
																<td><?php echo $value->ic; ?></td>
																<td><?php echo (GetPositionName($value->position,$positions)); ?></td>
																<td><?php echo ($value->bumi) ? "<i class=\"fa fa-check\"></i>" : "<i class=\"fa fa-times\"></i>"; ?></td>
																<td><a class="btn btn-xs bg-red"
																			onclick="return PromptDelete();"
																			href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/mgmt"><i class="fa fa-trash"></i></a></td>
															</tr>
															<?php
														}
													}
													?>
													</tbody>
												</table>
											</div>
										</div>
									</div>
									
									<div class="tab-pane" id="tab_3_2">
										<!-- OTHER COMPANY -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form321">
											<input type="hidden" name="from" value="#tab_3_2" />
											<input type="hidden" name="category" value="MAIN" />
											<div class="box-header with-border">
												<h3 class="box-title">Kepentingan di Syarikat Lain</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<div class="row">
													<div class="col-md-12">
														<div class="form-group">
															<label for="otherShare" class="col-sm-4 control-label">Pemegang Saham/Ahli Lembaga Pengarah/Pengurusan Tertinggi Mempunyai Kepentingan/ Jawatan Di Syarikat AP Terbuka Yang Lain</label>
															<div class="col-sm-8">
																<?php $anotherShare = ($company['main'] && $company['main']->anotherShare) ? $company['main']->anotherShare : NULL; ?>
																<span class="_custom_input pull_left">
																	<label class="_input_chosen">
																		<input type="radio" value="1"
																				<?php echo ($anotherShare) ? " checked=\"checked\" " : ""; ?>
																				id="anotherShare_1" name="anotherShare" class="_in_radio" ><i></i>
																	</label>
																	<span>Ada</span>
																</span>
																<span class="_custom_input pull_left">
																	<label class="_input_chosen">
																		<input type="radio" value="0"
																				<?php echo (!$anotherShare) ? " checked=\"checked\" " : ""; ?>
																				id="anotherShare_2" name="anotherShare" class="_in_radio" ><i></i>
																	</label>
																	<span>Tiada</span>
																</span>
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<div class="col-sm-12"><strong>Nama Syarikat AP Terbuka Yang Lain</strong></div>
															<div class="col-sm-12">
																<div id="anotherShareTable" <?php echo (!$anotherShare) ? " style=\"display:none;\" " : ""; ?>>
															
																<div style="overflow: auto; padding: 0.25%">
																	<button type="button" class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('another',0);">
																		<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
																	</button>
																</div>
																
																<table class="table dtable table-striped">
																	<thead>
																		<tr>
																			<th>Bil</th>
																			<th>Nama</th>
																			<th>&nbsp;</th>
																		</tr>
																	</thead>
																	<tbody>
																	<?php
																	if($company['anothers']) {
																		foreach($company['anothers'] as $key=>$value) {
																			?>
																			<tr>
																				<td><?php echo ($key+1); ?></td>
																				<td><a href="Javascript:OpenModal('another',<?php echo $value->ID; ?>);"><?php echo $value->name; ?></a></td>
																				<td><a class="btn btn-xs bg-red"
																							onclick="return PromptDelete();"
																							href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/another"><i class="fa fa-trash"></i></a></td>
																			</tr>
																			<?php
																		}
																	}
																	?>
																	</tbody>
																</table>
																</div>
															</div>
															<div>&nbsp;</div>
														</div>
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
									
										<!-- CHANGE OF SHAREHOLDER -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form322">
											<input type="hidden" name="from" value="#tab_3_2" />
											<input type="hidden" name="category" value="MAIN" />
											<div class="box-header with-border">
												<h3 class="box-title">Perubahan Pemegang Saham</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<div class="row">
													<div class="col-md-12">
														<div class="form-group">
															<label for="changeShareholder" class="col-sm-4 control-label">Perubahan Pemegang Saham Dalam Tempoh Tiga (3) Tahun Kebelakangan</label>
															<div class="col-sm-8">
																<?php $changeShareholder = ($company['main'] && $company['main']->changeShareholder) ? $company['main']->changeShareholder : NULL; ?>
																<span class="_custom_input pull_left">
																	<label class="_input_chosen">
																		<input type="radio" value="1"
																				<?php echo ($changeShareholder) ? " checked=\"checked\" " : ""; ?>
																				id="changeShareholder_1" name="changeShareholder" class="_in_radio" ><i></i>
																	</label>
																	<span>Ada</span>
																</span>
																
																<span class="_custom_input pull_left">
																	<label class="_input_chosen">
																		<input type="radio" value="0"
																				<?php echo (!$changeShareholder) ? " checked=\"checked\" " : ""; ?>
																				id="changeShareholder_2" name="changeShareholder" class="_in_radio" ><i></i>
																	</label>
																	<span>Tiada</span>
																</span>
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<div class="col-sm-12"><strong>Nama Pemegang Saham Terdahulu</strong></div>
															<div class="col-sm-12">
															
																<div id="changeShareholderTable" <?php echo (!$changeShareholder) ? " style=\"display:none;\" " : ""; ?>>
																<div style="overflow: auto; padding: 0.25%">
																	<button type="button" class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('shareholder_old',0);">
																		<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
																	</button>
																</div>
																
																<table class="table dtable table-striped">
																	<thead>
																		<tr>
																			<th>Bil</th>
																			<th>Nama</th>
																			<th>Unit Saham (RM)</th>
																			<th>Peratusan (%)</th>
																			<th>Tarikh Kuatkuasa</th>
																			<th>&nbsp;</th>
																		</tr>
																	</thead>
																	<tbody>
																	<?php
																	if($company['shareholder_old']) {
																		foreach($company['shareholder_old'] as $key=>$value) {
																			?>
																			<tr>
																				<td><?php echo ($key+1); ?></td>
																				<td><a href="Javascript:OpenModal('shareholder_old',<?php echo $value->ID; ?>);"><?php echo $value->name; ?></a></td>
																				<td><?php echo number_format($value->unit,2); ?></td>
																				<td><?php echo $value->percent; ?></td>
																				<td><?php echo $value->effDT; ?></td>
																				<td><a class="btn btn-xs bg-red"
																							onclick="return PromptDelete();"
																							href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/shareholder_old"><i class="fa fa-trash"></i></a></td>
																			</tr>
																			<?php
																		}
																	}
																	?>
																	</tbody>
																</table>
																</div>
															</div>
															<div>&nbsp;</div>
														</div>
														
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
									
										<!-- CHANGE OF DIRECTOR -->
										<div class="box box-warning">
											<form class="form-horizontal" action="<?php echo base_url(); ?>apply/save" method="post" id="form322">
											<input type="hidden" name="from" value="#tab_3_2" />
											<input type="hidden" name="category" value="DIROLD" />
											<div class="box-header with-border">
												<h3 class="box-title">Perubahan Ahli Lembaga Pengarah</h3>
												<div class="box-tools pull-right">
													<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
												</div>
											</div>
									
											<div class="box-body">
												<div class="row">
													<div class="col-md-12">
														<div class="form-group">
															<label for="changeDirector" class="col-sm-4 control-label">Perubahan Ahli Lembaga Pengarah Dalam Tempoh Tiga (3) Tahun Kebelakangan</label>
															<div class="col-sm-8">
																<?php $changeDirector = ($company['main'] && $company['main']->changeDirector) ? $company['main']->changeDirector : NULL; ?>
																<span class="_custom_input pull_left">
																	<label class="_input_chosen">
																		<input type="radio" value="1"
																				<?php echo ($changeDirector) ? " checked=\"checked\" " : ""; ?>
																				id="changeDirector_1" name="changeDirector" class="_in_radio" ><i></i>
																	</label>
																	<span>Ada</span>
																</span>
																
																<span class="_custom_input pull_left">
																	<label class="_input_chosen">
																		<input type="radio" value="0"
																				<?php echo (!$changeDirector) ? " checked=\"checked\" " : ""; ?>
																				id="changeDirector_2" name="changeDirector" class="_in_radio" ><i></i>
																	</label>
																	<span>Tiada</span>
																</span>
															</div>
															<div>&nbsp;</div>
														</div>
														<div class="form-group">
															<div class="col-sm-12"><strong>Nama Ahli Lembaga Pengarah Terdahulu</strong></div>
															<div class="col-sm-12">
															
																<div id="changeDirectorTable" <?php echo (!$changeDirector) ? " style=\"display:none;\" " : ""; ?>>
																<div style="overflow: auto; padding: 0.25%">
																	<button type="button" class="btn btn-sm bg-red pull-right" onclick="javascript:OpenModal('director_old',0);">
																		<span class="glyphicon glyphicon-plus"></span> <?php echo $this->lang->line('Add'); ?>
																	</button>
																</div>
																<table class="table dtable table-striped">
																	<thead>
																		<tr>
																			<th>Bil</th>
																			<th>Nama</th>
																			<th>&nbsp;</th>
																		</tr>
																	</thead>
																	<tbody>
																	<?php
																	if($company['director_old']) {
																		foreach($company['director_old'] as $key=>$value) {
																			?>
																			<tr>
																				<td><?php echo ($key+1); ?></td>
																				<td><a href="Javascript:OpenModal('director_old',<?php echo $value->ID; ?>);"><?php echo $value->name; ?></a></td>
																				<td><a class="btn btn-xs bg-red"
																							onclick="return PromptDelete();"
																							href="<?php echo base_url(); ?>apply/delete/<?php echo $value->ID; ?>/director_old"><i class="fa fa-trash"></i></a></td>
																			</tr>
																			<?php
																		}
																	}
																	?>
																	</tbody>
																</table>
																</div>
															</div>
															<div>&nbsp;</div>
														</div>
														
													</div>
												</div>
											</div>
											
											<div class="box-footer">
												<div class="box-sm pull-right">
													<a href="<?php echo base_url(); ?>" class="btn btn-default"><?php echo $this->lang->line('Cancel'); ?></a>
													<button type="submit" class="btn btn-info"><?php echo $this->lang->line('SaveAndProceed'); ?></button>
												</div>
											</div>
											</form>
										</div>
									</div>
								</div>
							</div>
						</div>
				
						<!-- D) FINANCIAL INFO -->
						<div class="tab-pane" id="tab_4">
							<div id="result"></div>
							<?php
							if (!$years) {
								$years[0] = date("Y");
								$years[1] = date("Y") - 1;
							}
							
							foreach($years as $y=>$year) {
								echo "<input type=\"hidden\" id=\"year".$y."\" value=\"".$year."\" />\n";
							}
							?>
							
							<div class="box box-solid box-warning">
								<div class="box-body">
									<div class="row no-padding" style="margin: 0;">
										<div class="col-md-2"><strong>Pilih Tahun</strong></div>
										
										<div class="col-md-4">
											<div class="form-group">
												<div class="row">
													<label class="col-md-2">Tahun</label>
													<div class="col-md-10">
														<input id="yearCurr" name="yearCurr" class="form-control" value="<?php echo ($years && $years[0]) ? $years[0] : NULL; ?>" onChange="fnLoadTahun()">
													</div>
												</div>
											</div>
										</div>
										
										<div class="col-md-4">
											<div class="form-group">
												<div class="row">
													<label class="col-md-2">Tahun Sebelum</label>
													<div class="col-md-10">
														<input id="yearCurr" name="yearPrev" class="form-control" value="<?php echo ($years && $years[1]) ? $years[1] : NULL; ?>" readonly>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
													
							<div class="nav-tabs-custom">
								<!-- TAB MENU -->
								<ul class="nav nav-tabs">
									<li class="hidden-xs active"><a href="#tab_4_1" data-toggle="tab"><strong>i) Baki Awal</strong></a></li>
									<li class="hidden-xs"><a href="#tab_4_2" data-toggle="tab"><strong>ii) Penyata Kunci Kira-kira</strong></a></li>
									<li class="hidden-xs"><a href="#tab_4_3" data-toggle="tab"><strong>iii) Penyata Untung Rugi</strong></a></li>
									<li class="hidden-xs"><a href="#tab_4_4" data-toggle="tab"><strong>iv) Prestasi Kewangan</strong></a></li>
									<li class="hidden-xs"><a href="#tab_4_5" data-toggle="tab"><strong>v) Nisbah Kewangan</strong></a></li>
									<li class="dropdown hidden-lg">
										<a class="dropdown-toggle" data-toggle="dropdown" href="Javascript:void(0);"><strong><i class="fa fa-bars"></i><span class="caret"></span></strong></a>
										<ul class="dropdown-menu">
											<li role="presentation"><a role="menuitem" tabindex="1" href="#tab_4_1" data-toggle="tab"><strong>i) Baki Awal</strong></a></li>
											<li role="presentation"><a role="menuitem" tabindex="2" href="#tab_4_2" data-toggle="tab"><strong>ii) Penyata Kunci Kira-kira</strong></a></li>
											<li role="presentation"><a role="menuitem" tabindex="3" href="#tab_4_3" data-toggle="tab"><strong>iii) Penyata Untung Rugi</strong></a></li>
											<li role="presentation"><a role="menuitem" tabindex="4" href="#tab_4_4" data-toggle="tab"><strong>iv) Prestasi Kewangan</strong></a></li>
											<li role="presentation"><a role="menuitem" tabindex="4" href="#tab_4_5" data-toggle="tab"><strong>v) Nisbah Kewangan</strong></a></li>
										</ul>
									</li>
								</ul>
								
								<!-- TAB CONTENT -->
								<div class="tab-content">
									<?php $CI =& get_instance(); ?>
									<div class="tab-pane active" id="tab_4_1">
										<?php $CI->openingBalance(); ?>
									</div>
									
									<div class="tab-pane" id="tab_4_2">
										<?php
										//$CI->financialposition();  // <-- ORIGINAL: from glreports controller
										$CI->financialposition2();		// <-- NEW: Zul testing to display balance sheet
										?>
									</div>
									
									<div class="tab-pane" id="tab_4_3">
										<?php
										// $CI->profitNloss();  // <-- ORIGINAL: from glreports controller
										$CI->profitNloss2();		// <-- NEW: Zul testing to display PNL
										?>
									</div>
									
									<div class="tab-pane" id="tab_4_4">
										<?php $CI->financialperformance(); ?>
									</div>
									
									<div class="tab-pane" id="tab_4_5">
										<?php $CI->financialratio(); ?>
									</div>
								</div>
							</div>
						</div>	
			
					</div>
				</div>
			</div>
		</div>
	
	
	</section>
</div>


<div class="modal fade in" id="modal" role="dialog">
	<div class="modal-dialog">
		<div class="modal-content">
		</div>
	</div>
</div>

<!-- MODAL CONFIRMATION UNBALANCE -->

<div class="modal fade in" id="unbalModal" role="dialog" data-backdrop="static">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h3 class="modal-title">Baki Pembukaan Tidak Seimbang</h3>
			</div>

			<div class="modal-body">
				<p>
					Adakah anda pasti untuk pergi ke muka lain?
				</p>
			</div>

			<div class="modal-footer">
				<div class="box-sm pull-right">
					<button type="button" id="unbalStay" class="btn btn-danger btn-sm" data-dismiss="modal"><i class="fa fa-times"></i> Tidak</button>
					<button type="button" id="unbalLeave" class="btn bg-olive 	btn-sm"><i class="fa fa-check"></i> Pasti</button>
				</div>
			</div>
		</div>
	</div>
</div>






