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

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

				 &nbsp;&nbsp;|&nbsp;&nbsp;
				<?php echo e($data['year']); ?>

			</td>
		</tr>
	</table>
	<table style="width: 100%;">
		<thead>
			<tr class="header">
				<th style="width: 22%;">&nbsp;</th>
				<th style="width: 6%;">Period 1</th>
				<th style="width: 6%;">Period 2</th>
				<th style="width: 6%;">Period 3</th>
				<th style="width: 6%;">Period 4</th>
				<th style="width: 6%;">Period 5</th>
				<th style="width: 6%;">Period 6</th>
				<th style="width: 6%;">Period 7</th>
				<th style="width: 6%;">Period 8</th>
				<th style="width: 6%;">Period 9</th>
				<th style="width: 6%;">Period 10</th>
				<th style="width: 6%;">Period 11</th>
				<th style="width: 6%;">Period 12</th>
				<th style="width: 6%;">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(1=>0.00,2=>0.00,3=>0.00,4=>0.00,5=>0.00,6=>0.00,7=>0.00,8=>0.00,9=>0.00,10=>0.00,11=>0.00,12=>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 => $gls): ?>
							<tr class="child_row">
								<td class="child">
									<?php echo e($children[$child_id]); ?>

								</td>
								<td colspan="13">&nbsp;</td>
							</tr>
							<?php foreach($gls as $gl => $suffixes): ?>
								<tr class="gl_row">
									<td class="gl">
										<?php echo e($gl); ?>

									</td>
									<td colspan="13">&nbsp;</td>
								</tr>
								<?php foreach($suffixes as $suffix => $months): ?>
									<tr class="suffix_row">
										<td class="suffix">
											<?php echo e($suffix); ?>

										</td>
										<?php $total = 0.00; ?>
										<?php foreach($months as $month => $value): ?>
											<?php 
												$total += $value; 
												$totals[$month] += $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; ?>
						<?php endforeach; ?>
					<?php endforeach; ?>
					<tr class="totals">
						<td>
							&nbsp;
						</td>
						<?php $parent_total = 0.00; ?>
						<?php for($i=1;$i<=12;$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 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;
			font-weight: 500;
			overflow: hidden;
			white-space: nowrap;
		}
		.gl{
			font-size: .7em;
			overflow: hidden;
			white-space: nowrap;
			padding-left: 15px;
		}
		.suffix{
			font-size: .7em;
			overflow: hidden;
			white-space: nowrap;
			padding-left: 30px;
		}
		.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;
		}
		.child_row td{
			border-top: 1px solid lightgray;
		}
		.title td{
			font-weight: 600;
			border-bottom: 2px solid black;
		}
		.totals td{
			border-top: 1px solid gray;
		}

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



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