@extends('layouts.print')
 
@section('content')
<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="200px">
								</div>
								<div class="title">
									<h2>{{$branch->branch_kh}}</h2>
									<h2>{{$branch->branch_en}}</h2>
									<h3>Client List</h3>
								</div>
								<div class="clear"></div>
								<div class="border-bottom"></div>
								<div class="table">
									<table>
										<thead>
						                    <tr>
												<th>No</th>
												<th>Date</th>
												<th>Client Name</th>
												<th>Gender</th>
												<th>Phone</th>
												<th>Project</th>
												<th>Category</th>
												<th>Item Code</th>
												<th>Item Price</th>
												<th>Paid Amount</th>
												<th>Paid Percent</th>
												<th>Status</th>
						                    </tr>
						                </thead>
										<tbody>
											@foreach($client as $key => $value)
                                                <?php
                                                $gen='';
												  switch ($value->client_gender) {
													  case '1':
                                                          $gen= "Male";
														  break;

													  default:
                                                          $gen= "Female";
														  break;
												  }
                                                $status='';
                                                $sale_amount_paid_percent = ($value->sale_payment * 100 / $value->sale_amount);
                                                if ($value->status == 1) {
                                                    if ($sale_amount_paid_percent >= $value->admin_commission_condition) {
                                                        $status= '<i class="fa fa-check"></i> Completed';
                                                    } else {
                                                        $status= '<i class="fa fa-spinner"></i> Pending';
                                                    }
                                                } else {
                                                    $status= '<i class="fa fa-close"></i> Cancelled';
                                                }
                                                ?>
											<tr>
												<td>{{$key+1}}</td>
												<td>{{date('d-m-Y',strtotime($value->created_at))}}</td>
												<td>{{$value->client_fullname}}</td>
												<td>{{$gen}}</td>
												<td>{{$value->client_phone1}}</td>
												<td>{{$value->project_name}}</td>
												<td>{{$value->category_name}}</td>
												<td>{{$value->item_name}}</td>
												<td class="right">$ {{number_format($value->sale_amount,2)}}</td>
												<td style="text-align: center !important;">$ {{number_format($value->sale_payment,2)}}</td>
												<td class="right">{{number_format($value->sale_payment * 100 / $value->sale_amount,2)}} %</td>
												<td class="right"><?php echo $status?></td>

											</tr>
											@endforeach()
										</tbody>

									</table>
									<div class="make-date">
										<p>ធ្វើនៅ​ <strong>ភ្នំពេញ</strong> ថ្ងៃទី <strong>{{\Globals::date_khmers(date('Y-m-d'))}}</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>
												<p>ថាយ ម៉ាណែល</p>
											</div>
											<div class="col-lg-4 col-sm-4 col-xs-4">
												<p>អ្នកពិនិត្យ</p>
												<p>_________________</p>
											</div>
											<div class="col-lg-4 col-sm-4 col-xs-4">
												<p>ឯកភាព</p>
												<p>ស៊ីន មុំ  យ៉ែន សុខលីន</p>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
							
						
					</div>
					
					
				</div>
			</div>
		</div>
	</div>
</div>
<style>
	.container{
		width: 300mm !important;
		margin-top: 10px;
	}
	@media print {
		html, body {
			width: 330mm !important;
			margin: 0mm 0 0 0 !important;
			background-color:#FFFFFF;
		}

	}
</style>
@endsection


