 
<?php $__env->startSection('content'); ?>
	<table style="width: 100%;">
		<tr class="title">
			<td style="">
				Income Statement - 3 Year <?php echo e(ucfirst($data['type'])); ?>

				 &nbsp;&nbsp;|&nbsp;&nbsp;
				<?php echo e(\App\Budget_company::where('number','=',$data['company'])->first()->name); ?>

			</td>
		</tr>
	</table>
	<table style="width: 100%;">
		<thead>
			<tr class="header">
				<th style="width: 44%;">&nbsp;</th>
				<th style="width: 12%;"><?php echo e($data['year']); ?></th>
				<th style="width: 12%;"><?php echo e($data['year']+1); ?></th>
				<th style="width: 12%;"><?php echo e($data['year']+2); ?></th>

				<th style="width: 20%;">Total</th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($all as $parent_order => $parent_ids): ?>
				<?php foreach($parent_ids as $parent_id => $child_orders): ?>
					<?php $totals = array($data['year']=>0.00,$data['year']+1=>0.00,$data['year']+2=>0.00); ?>
					<tr class="parent_row">
						<td class="parent">
							<?php echo e($parents[$parent_id]); ?>

						</td>
						<td colspan="13">&nbsp;</td>
					</tr> 
					<?php foreach($child_orders as $child_order => $children_ids): ?>
						<?php foreach($children_ids as $child_id => $years): ?>
							<tr>
								<td class="child">
									<?php echo e($children[$child_id]); ?>

								</td>
								<?php $total = 0.00; ?>
								<?php foreach($years as $year => $value): ?>
									<?php 
										$total += $value; 
										$totals[$year] += $value;
									?>
									<td class="value">
										<?php echo e(number_format($value,2)); ?>

									</td>
								<?php endforeach; ?>
								<td class="total">
									<?php echo e(number_format($total,2)); ?>

								</td>
							</tr>
						<?php endforeach; ?>
					<?php endforeach; ?>
					<tr class="totals">
						<td>
							&nbsp;
						</td>
						<?php $parent_total = 0.00; ?>
						<?php for($i=$data['year'];$i<=$data['year']+2;$i++): ?>
							<td class="value">
								<?php echo e(number_format($totals[$i],2)); ?>

							</td>
							<?php $parent_total += $totals[$i]; ?>
						<?php endfor; ?>
						<td class="value">
							<?php echo e(number_format($parent_total,2)); ?>

						</td>
					</tr>	
				<?php endforeach; ?>
				<?php if($budgetCalc = \App\Budget_calc::where('company','=',$data['company'])->where('after','=',$parent_order)->first()): ?>
					<tr class="parent_row">
						<td class="parent">
							<?php echo e($budgetCalc->name); ?>

						</td>
						<td colspan="13">&nbsp;</td>
					</tr> 
					<tr>
						<td class="child">
							&nbsp;
						</td>
						<?php $totalCalc = 0.00; ?>
						<?php for($i=$data['year'];$i<=$data['year']+2;$i++): ?>
							<?php 
								$tempCalc = $budgetCalc->getTotal($i); 
								$totalCalc += $tempCalc;
							?>
							<td class="value">
								<?php echo e(number_format($tempCalc,2)); ?>

							</td>
						<?php endfor; ?>
						<td class="total">
							<?php echo e(number_format($totalCalc,2)); ?>

						</td>
					</tr>
				<?php endif; ?>
			<?php endforeach; ?>
		</tbody>
	</table>



<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	<style>
		.parent{
			font-size: .8em;
			font-weight: 600;
			overflow: hidden;
			white-space: nowrap;
		}
		.child{
			font-size: .7em;
			overflow: hidden;
			white-space: nowrap;
		}
		.value{
			font-size: .6em;
			overflow: visible;
			white-space: nowrap;
			text-align: right;
		}
		.total{
			font-size: .6em;
			text-align: right;
		}
		.header th{
			font-size: .8em;
			text-align: right;
			border-bottom: 2px solid black;
		}
		.parent_row td{
			border-bottom: 1px solid black;
		}
		.title td{
			font-weight: 600;
			border-bottom: 2px solid black;
		}
		.totals td{
			border-top: 1px solid lightgray;
		}

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



<?php echo $__env->make('pdfs.pdf_template', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>