@extends('layouts.print')
 
@section('content')
<style>
    table.m-table th,table.m-table td{
        text-align: center !important;
    }
    .table-inv-head td {
        border: none;
    }
    span.boq-header{
        margin-left:20px !important;
    }
    table.boq-header-tb tr th,table.boq-header-tb tr td{
        line-height:150% !important;
        font-size: 18px !important;
    }
    .report-capital.layout-print .table tr td{
        font-size: 17px !important;
    }
    .report-capital.layout-print .table tr th,.fdiv {
        font-size: 18px !important;
    }
</style>
<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="logo">
									<img src="{{asset('assets/images/resize')}}/{{$branch->branch_img}}" alt="" width="150px">
								</div>
								<div class="title">
									<h2>{{$branch->branch_kh}}</h2>
									<h2>{{$branch->branch_en}}</h2>
                                    {{-- 
                                        <h3>របាយការណ៍ សំភារៈទឹកសម្រាប់ប្រើប្រាស់លើអគារ{{ $data->building_type }}</h3>
                                     --}}
                                     <h3>{{ $data->title }}</h3>
								</div>  
                                
                                <div>
                                    <table border='0' class='boq-header-tb'>
                                        <tr>
                                            <td style="width: 200px;">
                                                NUMBER
                                            </td>
                                            <td>: <span class="boq-header">{{strtoupper(str_pad($data->id,6,"0",STR_PAD_LEFT))}}</span></td>
                                        </tr>
                                        <tr>
                                            <td style="width: 200px;">
                                                PROJECT NAME
                                            </td>
                                            <td>: <span class="boq-header">{{ $data->project_name }}</span></td>
                                        </tr>
                                        @if(!empty($data->zone_name))
                                        <tr>
                                            <td style="width: 200px;">
                                                ZONE NAME
                                            </td>
                                            <td>: <span class="boq-header">{{ $data->zone_name }}</span></td>
                                        </tr>
                                        @endif
                                        @if($data->sub_category_house)
                                        <tr>
                                            <td style="width: 200px;">
                                                House Category
                                            </td>
                                            <td>: <span class="boq-header">{{ $data->sub_category_house }}</span></td>
                                        </tr>
                                        @endif
                                        <tr>
                                            <td style="width: 200px;">
                                                PREPARED BY
                                            </td>
                                            <td>: <span class="boq-header">{{ $data->prepared_by }}</span></td>
                                        </tr>
                                        <tr>
                                            <td style="width: 200px;">
                                               BUILDING TYPE
                                            </td>
                                            <td>: <span class="boq-header">{{ $data->building_type }}</span></td>
                                        </tr>
                                        <tr>
                                            <td style="width: 250px;">
                                                AMOUNT OF HOUSE USED
                                            </td>
                                            <td>: <span class="boq-header">{{ strtoupper($data->amount_of_house_used." units") }}</span></td>
                                        </tr>
                                    </table>
                                </div>
								<br/>
								<div class="table">
									<table class="m-table">
										<thead >
						                    <tr >
                                                <th rowspan="2">ល.រ</th>
                                                <th colspan="2">បរិយាយសំភារៈ</th>
                                                <th rowspan="2">ឯកតា</th>
                                                <th rowspan="2">បរិមាណ១ផ្ទះ</th>
                                                <th rowspan="2">កំហាតបង់</th>
                                                <th rowspan="2">បរិមាណ{{ \Globals::LatinnumberTokhnumber($data->amount_of_house_used) }}ផ្ទះ</th>
                                                <th rowspan="2">ផ្សេងៗ</th>
                                            </tr>
                                            <tr>
                                                <th>ឈ្មោះសំភារៈ</th>
                                                <th>ប្រភេទ</th>
                                            </tr>
						                </thead>
										<tbody>
											<?php $index = 1; ?>
                                                @foreach($titles as $k=>$val)
                                                    <tr><td colspan="8"><h4 style="font-weight: normal;font-size:99%">{{ $val->title }}</h4></td></tr>
                                                    
                                                    @foreach($data_detail as $key=>$value)
                                                        @if($val->title==$value->title)
                                                            <tr>
                                                                <td>{{ $index++ }}</td>
                                                                <td>
                                                                    {{ $value->product_name }}
                                                                </td>
                                                                <td>
                                                                    {{ $value->subcategory_name }}
                                                                </td>
                                                                <td>
                                                                    {{ $value->unit_name }}
                                                                </td>
                                                                <td>
                                                                    {{ $value->qty_used_one_house }}
                                                                </td>
                                                                <td>
                                                                    {{ $value->loss_percentage }} %
                                                                </td>
                                                                <td>
                                                                    {{ $value->qty_used_all_amount_of_house }}
                                                                    
                                                                </td>
                                                                <td>{{ $value->description }}</td>
                                                            </tr>
                                                        @else
                                                            <?php $index=1; ?>
                                                        @endif
                                                    @endforeach
                                                @endforeach
										</tbody>
									</table>
									<div class="make-date fdiv">
										<p>ធ្វើនៅ​ <strong>ភ្នំពេញ</strong> ថ្ងៃទី <strong>{{\Globals::date_khmers(date('Y-m-d'))}}</strong></p>
                                    </div>
                                    
									<div class="row fdiv" style="text-align: center;">
                                        <div class="col-xs-4">គណនា និងរៀបរៀងដោយ</div>
                                        <div class="col-xs-4">ត្រួតពិនិត្យដោយ</div>
                                        <div class="col-xs-4" style="font-weight: bold;">ឯកភាពដោយ</div>
                                    </div>
                                    <br><br/><br/><br>
                                    <div class="row fdiv" style="text-align: center;">
                                        <div class="col-xs-4"><p>_________________</p></div>
                                        <div class="col-xs-4"><p>_________________</p></div>
                                        <div class="col-xs-4"><p>_________________</p></div>
                                    </div>
                                    <div class="row fdiv" style="text-align: center;">
                                        <div class="col-xs-4"><p>{{ $data->prepared_by }}</p></div>
                                        <div class="col-xs-4"><p>ប្រធានគម្រោង</p></div>
                                        <div class="col-xs-4"><p>អគ្គនាយករង</p></div>
                                    </div>
								</div>
							</div>
						</div>
							
						
					</div>
					
					
				</div>
			</div>
		</div>
	</div>
</div>
<style>
</style>

@endsection


