

		 <div class="table-responsive" id="previewtable" style="min-height:300px;">
					
		 <table class="table table-hover table-striped">
			<thead>
				<tr>
					<th colspan="10" style="text-align: center; background-color: #d1ecf13b;"><h4>Rekap Klentek Per Kebun<h4></th>
				</tr>
				<tr>
					<th colspan="10" style="text-align: center; background-color: #d1ecf13b;"><h5 class="text-center">Data per Tanggal: {{ $tanggal ? \Carbon\Carbon::parse($tanggal)->translatedFormat('d F Y') : \Carbon\Carbon::now()->translatedFormat('d F Y') }}</h5></th>
				</tr>
				<tr>
					<th>Kebun</th>
					<th colspan="3" style="text-align: center; background-color: #f8d7da3b;">Klentek 1</th>
					<th colspan="3" style="text-align: center; background-color: #d4edda3b;">Klentek 2</th>
					<th colspan="3" style="text-align: center; background-color: #d1ecf13b;">Klentek 3</th>
				</tr>
				<tr>
					<th></th>
					<th style="background-color: #f8d7da3b;">Sasaran</th>
					<th style="background-color: #f8d7da3b;">Real</th>
					<th style="background-color: #f8d7da3b;">% Sasaran</th>
					<th style="background-color: #d4edda3b;">Sasaran</th>
					<th style="background-color: #d4edda3b;">Real</th>
					<th style="background-color: #d4edda3b;">% Sasaran</th>
					<th style="background-color: #d1ecf13b;">Sasaran</th>
					<th style="background-color: #d1ecf13b;">Real</th>
					<th style="background-color: #d1ecf13b;">% Sasaran</th>
				</tr>
			</thead>

			<tbody>
				@php
					$totalSasaran1 = $totalReal1 = $totalPersen1 = 0;
					$totalSasaran2 = $totalReal2 = $totalPersen2 = 0;
					$totalSasaran3 = $totalReal3 = $totalPersen3 = 0;
				@endphp

				@foreach ($results as $row)
					<tr>
						<td>{{ $row->kebun }}</td>
						<td style="text-align: right; background-color: #f8d7da3b;">{{ $row->sasaran_klentek_1 && $row->sasaran_klentek_1 != 0.00 ? $row->sasaran_klentek_1 : '-' }}</td>
						<td style="text-align: right; background-color: #f8d7da3b;">{{ $row->real_klentek_1 && $row->real_klentek_1 != 0.00 ? $row->real_klentek_1 : '-' }}</td>
						<td style="text-align: right; background-color: #f8d7da3b;">{{ $row->persen_klentek_1 && $row->persen_klentek_1 != 0.000 ? $row->persen_klentek_1 : '-' }}</td>
						<td style="text-align: right; background-color: #d4edda3b;">{{ $row->sasaran_klentek_2 && $row->sasaran_klentek_2 != 0.00 ? $row->sasaran_klentek_2 : '-' }}</td>
						<td style="text-align: right; background-color: #d4edda3b;">{{ $row->real_klentek_2 && $row->real_klentek_2 != 0.00 ? $row->real_klentek_2 : '-' }}</td>
						<td style="text-align: right; background-color: #d4edda3b;">{{ $row->persen_klentek_2 && $row->persen_klentek_2 != 0.000 ? $row->persen_klentek_2 : '-' }}</td>
						<td style="text-align: right; background-color: #d1ecf13b;">{{ $row->sasaran_klentek_3 && $row->sasaran_klentek_3 != 0.00 ? $row->sasaran_klentek_3 : '-' }}</td>
						<td style="text-align: right; background-color: #d1ecf13b;">{{ $row->real_klentek_3 && $row->real_klentek_3 != 0.00 ? $row->real_klentek_3 : '-' }}</td>
						<td style="text-align: right; background-color: #d1ecf13b;">{{ $row->persen_klentek_3 && $row->persen_klentek_3 != 0.000 ? $row->persen_klentek_3 : '-' }}</td>
					</tr>
					@php
						$totalSasaran1 += $row->sasaran_klentek_1 ?: 0;
						$totalReal1 += $row->real_klentek_1 ?: 0;
						$totalPersen1 += $row->persen_klentek_1 ?: 0;
						$totalSasaran2 += $row->sasaran_klentek_2 ?: 0;
						$totalReal2 += $row->real_klentek_2 ?: 0;
						$totalPersen2 += $row->persen_klentek_2 ?: 0;
						$totalSasaran3 += $row->sasaran_klentek_3 ?: 0;
						$totalReal3 += $row->real_klentek_3 ?: 0;
						$totalPersen3 += $row->persen_klentek_3 ?: 0;
					@endphp
				@endforeach
			</tbody>

			<tfoot>
				<tr>
					<th>Total</th>
					<th style="text-align: right; background-color: #f8d7da3b;">{{ $totalSasaran1 ?: '-' }}</th>
					<th style="text-align: right; background-color: #f8d7da3b;">{{ $totalReal1 ?: '-' }}</th>
					<th style="text-align: right; background-color: #f8d7da3b;">{{ number_format((($totalReal1/$totalSasaran1)*100),2)  ?: '-' }}</th>
					<th style="text-align: right; background-color: #d4edda3b;">{{ $totalSasaran2 ?: '-' }}</th>
					<th style="text-align: right; background-color: #d4edda3b;">{{ $totalReal2 ?: '-' }}</th>
					<th style="text-align: right; background-color: #d4edda3b;">{{ number_format((($totalReal2/$totalSasaran2)*100),2) ?: '-' }}</th>
					<th style="text-align: right; background-color: #d1ecf13b;">{{ $totalSasaran3 ?: '-' }}</th>
					<th style="text-align: right; background-color: #d1ecf13b;">{{ $totalReal3 ?: '-' }}</th>
					<th style="text-align: right; background-color: #d1ecf13b;">{{ number_format((($totalReal3/$totalSasaran3)*100),2) ?: '-' }}</th>
				</tr>
			</tfoot>
		</table>
		<input type="hidden" name="md" value="" />
		</div>

		<style>
.table {  border: 1px solid #EBEBEB; width: 100%;}
.table   tr  th { font-size: 11px; }
.table   tr  td {
  border-top: 1px solid #e7eaec;
  line-height: 1.42857;
 
  font-size:11px;
 	
  vertical-align: top; 
}
	
</style>

