@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>Report Commission Project Owner Detail</h3>
								</div>
								<div class="clear"></div>
								<div class="border-bottom"></div>
								<div class="table">
									<table>
										<thead>
						                    <tr>
												<th>No</th>
												<th>Date Commission Receive</th>
												<th>Project Name</th>
												<th>Client Name</th>
												<th>Item Name</th>
												<th>Item Price</th>
												<th>Commission Receive</th>
						                    </tr>
						                </thead>
										<tbody>
											@foreach($commission as $key => $value)
												<?php
                                                $commissions=0;
                                                $commission_total=0;
                                                $commission_balance=0;
                                                $sale_discount_commis=0;
													if($value->commission_amount!=0){
														$commissions = $value->commission_amount;
													}else{
														$commissions = ($value->commission*$value->item_price)/100;
													}
													$sale_discount_commis = $value->discount_commis;
													$commission_total = $commissions-$sale_discount_commis;

                                                	$commission_balance = $value->commission_amount-$value->commission_received;
												?>
											<tr>
												<td>{{$key+1}}</td>
												<td>{{date('d-m-Y',strtotime($value->created_at))}}</td>
												<td>{{$value->project_name}}</td>
												<td>{{$value->client_fullname}}</td>
												<td>{{$value->item_house}}</td>
												<td class="right">$ {{number_format($value->sale_amount,2)}}</td>
												<td class="right">$ {{number_format($value->commission_amount,2)}}</td>
											</tr>
											@endforeach()
										</tbody>
										<tfoot>
											<tr>
												<th colspan="6">Total</th>
												<th class="right">${{number_format($commission_received,2)}}</th>
											</tr>
										</tfoot>
									</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: 330mm !important;
		margin-top: 10px;
	}
	@media print {
		html, body {
			width: 360mm !important;
			margin: 0mm 0 0 0 !important;
			background-color:#FFFFFF;
		}

	}
</style>
@endsection


