<?php $__env->startSection('css'); ?>
	<style type="text/css">
	/* size landscape for landscape paper */
		@page{
			size: landscape;
		}
	</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
	<div class="container-print">
		<div class="row">
			<div class="col-md-12">
				<div class="UpperTitle"><img src="<?php echo e(asset('assets/images/resize')); ?>/<?php echo e($branch->branch_img); ?>" alt="Logo">
					<div class="title">
						<h2 class="com-name"><?php echo e($branch->branch_kh); ?></h2>
						<h2><?php echo e($branch->branch_en); ?></h2>
						<h3>Report Assing product to warehouse</h3>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<hr>
			</div>
		</div>
		<div class="row">
			<?php if(!empty($boq)): ?>
				<?php
					$bo =  DB::table('nso007_boq_construction')->select(DB::raw("CONCAT(nso007_boq_construction.title,'( prepared by ',nso007_boq_construction.prepared_by,' )') as boq_title"),"id")->where('id', $boq)->first();	
				?>
				<div class="col-xs-4">BOQ : <?php echo e(isset($bo->boq_title) ? $bo->boq_title : ''); ?></div>
			<?php endif; ?>
			<?php if(!empty($project)): ?>
				<?php
					$po = DB::table('nso007_project_stock')->select('project_name')->where('id', $project)->first();
				?>
				<div class="col-xs-4">Project Name : <?php echo e(isset($po->project_name) ? $po->project_name : ''); ?></div>
			<?php endif; ?>
			<?php if(!empty($product)): ?>
				<?php
					$pro = DB::table('nso007_construction_product')->select('name')->where('id', $product)->first();
				?>
				<div class="col-xs-4">Product Name: <?php echo e(isset($pro->name) ? $pro->name : ''); ?></div>
			<?php endif; ?>
			<?php if(!empty($supplier)): ?>
				<?php
					$su = DB::table('nso007_construction_suppliers')->select('name', 'phone')->where('id', $supplier)->first();
				?>
				<div class="col-xs-4">Supplier Name : <?php echo e(isset($su->name) ? $su->name : ''); ?></div>
				<div class="col-xs-4">Supplier Phone : <?php echo e(isset($su->phone) ? $su->phone : ''); ?></div>
			<?php endif; ?>
		</div>
		<div class="row">
			<div class="col-md-12">
				<table class="table table-print" width="100%">
					<tbody>
						<tr>
							<th>No</th>
							<th>Date</th>
							<?php if(empty($boq)): ?>
								<th>BOQ</th>
							<?php endif; ?>
							<?php if(empty($project)): ?>
								<th>Project Name</th>
							<?php endif; ?>
							<?php if(empty($supplier)): ?>
								<th>Supplier Name</th>
								<th>Supplier Phone</th>
							<?php endif; ?>
							<th>Request By</th>
							<th>Position</th>
							<th>Phone</th>
							<?php if(empty($product)): ?>
								<th>Product Name</th>
							<?php endif; ?>
							<th>Category</th>
							<th>Sub Category</th>
							<th>Qty</th>
                            <th>Qty add to warehouse</th>
							<th>Balance</th>
                            <th>Unit Name</th>
						</tr>
						<?php $total_price = 0;$sum_total = 0; ?>
						<?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<?php $total_price += $value->product_price;$sum_total = $value->product_price*$value->product_qty; $balance = optional($value)->product_qty - optional($value)->qty_added_to_stock;?>
						<tr>
							<td><?php echo e($key+1); ?></td>
							<td><?php echo e(date("d-m-Y",strtotime($value->date))); ?></td>
							<?php if(empty($boq)): ?>
								<td><?php echo e($value->boq_title); ?></td>
							<?php endif; ?>
							<?php if(empty($project)): ?>
								<td><?php echo e($value->project_name); ?></td>
							<?php endif; ?>
							<?php if(empty($supplier)): ?>
								<td><?php echo e($value->supplier_name); ?></td>
								<td><?php echo e($value->supplier_phone); ?></td>
							<?php endif; ?>
							<td><?php echo e($value->request_by); ?></td>
							<td><?php echo e($value->stock_position); ?></td>
							<td><?php echo e($value->phone_number); ?></td>
							<?php if(empty($product)): ?>
								<td><?php echo e($value->product_name); ?></td>
							<?php endif; ?>
							<td><?php echo e($value->category_name); ?></td>
							<td><?php echo e($value->sub_category); ?></td>
							<td><?php echo e($value->product_qty); ?></td>
                            <td><?php echo e($value->qty_added_to_stock); ?></td>
							<td>
								<?php
									if($balance<=0 || empty($balance)) echo 0;
									else echo $balance;
								?>
							</td>
                            <td><?php echo e($value->unit_name); ?></td>
						</tr>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
						<tr class="tr-right">
							<?php
								$total 			= 0;
								$boq_total 		= 0;
								$project_total 	= 0;
								$supplier_total = 0;
								$product_total 	= 0;

								if(!empty($boq)){
									$boq_total = 1;
								}
								if(!empty($project)){
									$project_total = 1;
								}
								if(!empty($supplier)){
									$supplier_total = 2;
								}
								if(!empty($product)){
									$product_total = 1;
								}
								$total = $boq_total + $project_total + $supplier_total + $product_total;
								
							?>
						</tr>
					</tbody>
				</table>
			</div>	
		</div>
		<div class="row">
			<div class="col-md-12">
				<table width="100%"​ class="tb-sign">
					<tr align="right">
						<td>
							<p>ធ្វើនៅ​ <strong>ភ្នំពេញ</strong> ថ្ងៃទី <strong><?php echo e(\Globals::date_khmers(date('Y-m-d'))); ?></strong></p>
							<p style="padding-bottom: 80px;padding-right:40px">ហត្ថលេខា</p>
							<p>______________________</p>
						</td>
					</tr>	
				</table>
			</div>
		</div>
	</div>
<?php $__env->stopSection(); ?>




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