

<?php $__env->startSection('content'); ?>
<?php
	$total_asset 		= 0;
	$total_liability 	= 0;
	$total_equity 		= 0;
?>
<div class="main-content-wrapper">
	<div class="main-box">
		<div class="main-content">
			<div class="container">
				<div class="page">
					<div class="row">
						<div class="report-capital layout-print">
							<div class="header">
								<div class="title">
									<h3>Balance Sheet</h3>
								</div>
								<div class="clear"></div>
								<div class="border-bottom"></div>
								<div class="table">
									<table>
										<thead>
											<tr>
												<th>Account #</th>
												<th>Account Name</th>
												<th>Debit</th>
												<th>Credit</th>
											</tr>
										</thead>
										<tbody>
											<?php $__currentLoopData = $assets; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $asset): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
												<?php
													$total_each_asset = 0;
												?>
												<?php if(count($account_assets) > 0): ?>
													<?php $__currentLoopData = $account_assets; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
														<?php if($asset->id == $account->acctype): ?>
															<?php
															$total_each_asset += $account->balance;
															$balance = $account->balance;
															if($balance<0){
																$balance = "(".abs($balance).")";
															}
															?>
															<tr>
																<td><?php echo e($account->id); ?></td>
																<td><?php echo e($account->acc_name); ?></td>
																<td><?php echo e($balance); ?></td>
																<td></td>
															</tr>
														<?php endif; ?>
													<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
													<tr>
														<th colspan="2">Total <?php echo e($asset->acc_name); ?></th>
														<th><?php echo e($total_each_asset); ?></th>
														<th></th>
													</tr>
													<?php
													$total_asset+=$total_each_asset;
													?>
												<?php endif; ?>
											<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
											<?php if(count($count_asset) > 0): ?>
												<tr>
													<th colspan="2">Total Asset</th>
													<th><?php echo e($total_asset); ?></th>
													<th></th>
												</tr>
											<?php endif; ?>
											<?php $__currentLoopData = $liabilities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $liability): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
											<?php
												$total_each_liability = 0;
											?>
											<?php if(count($account_liabilities) > 0): ?>
												<?php $__currentLoopData = $account_liabilities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
													<?php if($account->acctype == $liability->id): ?>
														<?php
														$balance = $account->balance;
														$total_each_liability+=$balance;
														if($balance>0){
															$balance = "(".$balance.")";
														}else{
															$balance = abs($balance);
														}
														?>
														<tr>
															<td><?php echo e($account->id); ?></td>
															<td><?php echo e($account->acc_name); ?></td>
															<td></td>
															<td><?php echo e($balance); ?></td>
														</tr>
													<?php endif; ?>
												<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
												<?php
												$total_each_liability = abs($total_each_liability);
												?>
											<tr>
												<th colspan="2">Total <?php echo e($liability->acc_name); ?></th>
												<th></th>
												<th><?php echo e($total_each_liability); ?></th>
											</tr>
											<?php
												$total_liability +=$total_each_liability;
											?>
											<?php endif; ?>
											<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
											<?php if(count($count_liability) > 0): ?>
												<tr>
													<th colspan="2">Total Liability</th>
													<th></th>
													<th><?php echo e($total_liability); ?></th>
												</tr>
											<?php endif; ?>
											<?php $__currentLoopData = $equities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $equity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
												<?php if(count($account_equities) > 0): ?>
													<?php $__currentLoopData = $account_equities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $account): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
														<?php if($account->acctype == $equity->id): ?>
															<?php
															$balance = $account->balance;
															$total_equity +=$balance;
															if($balance>0){
																$balance = "(".$balance.")";
															}else{
																$balance = abs($balance);
															}
															?>
															<tr>
																<td><?php echo e($account->id); ?></td>
																<td><?php echo e($account->acc_name); ?></td>
																<td></td>
																<td><?php echo e($balance); ?></td>
															</tr>
														<?php endif; ?>
													<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
												<?php endif; ?>
											<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
											<?php
												$income_amount 	= $income->balance;
												$expense_amount = $expense->balance;
												$net_income 	= abs($income_amount)-abs($expense_amount);
												$total_equity = abs($total_equity)+$net_income;
												$liability_equity = $total_liability+$total_equity;
											?>
											<?php if(!empty($net_income)): ?>
												<tr>
													<td>31004</td>
													<td>Retained Earnings-current period</td>
													<td></td>
													<td><?php echo e($net_income); ?></td>
												</tr>
											<?php endif; ?>
											<?php if(!empty($total_equity)): ?>
												<tr>
													<th colspan="2"></th>
													<th></th>
													<th><?php echo e($total_equity); ?></th>
												</tr>
											<?php endif; ?>
											<?php if(!empty($liability_equity)): ?>
												<tr>
													<th colspan="2">Total Liability and Equity</th>
													<th></th>
													<th><?php echo e($liability_equity); ?></th>
												</tr>
											<?php endif; ?>
										</tbody>
										<tfoot>

										</tfoot>
									</table>
									<div class="make-date">
										<p>ធ្វើនៅ​ <strong>ភ្នំពេញ</strong> ថ្ងៃទី <strong><?php echo e(\Globals::date_khmers(date('d-m-Y'))); ?></strong></p>
									</div>
									<div class="row">
										<div class="col-lg-12 col-sm-12 col-xs-12 tt">
											<div class="col-lg-4 col-sm-4 col-xs-4">
												<p>អ្នកធ្វើបញ្ជី</p>
                                                <br>
                                                <br>
												<p>_________________</p>
											</div>
											<div class="col-lg-4 col-sm-4 col-xs-4">
												<p>អ្នកពិនិត្យ</p>
                                                <br>
                                                <br>
												<p>_________________</p>
											</div>
											<div class="col-lg-4 col-sm-4 col-xs-4">
												<p>ឯកភាព</p>
                                                <br>
                                                <br>
												<p>_________________</p>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<style>
	.container {
		width: 420mm !important;
		margin-top: 10px;
	}

	@media  print {

		html,
		body {
			width: 450mm !important;
			margin: 0mm 0 0 0 !important;
			background-color: #FFFFFF;
		}

	}
</style>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.print', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/Accounting/reports/report-print-balance-sheet.blade.php ENDPATH**/ ?>