<script type="text/javascript" src="<?php echo base_url();?>assets/js/inventory_purchase_receive.js"></script>
<form class="form-horizontal">
<aside class="right-side">
  <section class="content-header">
    <div class="title_bar">
      <h1 class="major_txt_color">Inventory – Purchase Received Details</h1>
    </div>
  </section>
  <section class="content">
    <div class="row">
    <div class="col-md-12">
      <div class="form-group">
        <div class="col-md-7">
            <span class="first-coln" style="min-height: 20px;">Purchase Ref No</span>
            <span class="seperator" style="min-height: 20px;">:</span>
            <span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
                <?php echo text($purchase_order->purchase_ref_no);?>
            </span>
        </div>
      </div>
      <div class="form-group">
        <div class="col-md-7">
		   	<span class="first-coln" style="min-height: 20px;">Invoice No</span>
            <span class="seperator" style="min-height: 20px;">:</span>
            <span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
                <?php echo text($purchase_order->invoice_no);?>
            </span>
        </div>        
      </div>
	  <div class="form-group">
	  	<div class="col-md-7">           
			<span class="first-coln" style="min-height: 20px;">Invoice Date</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo date('d-m-Y',strtotime($purchase_order->invoice_date));?>
			</span>
        </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-md-7">  
			<?php $purChase		= $this->purchase_management_model->get_purchase_order($purchase_order->id); ?>         
			<span class="first-coln" style="min-height: 20px;">Total Qty</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo $purChase->total_qty;?>
			</span>
        </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-md-7">    
			<?php $ref_no   	= $purchase_order->purchase_ref_no; ?>
			<?php $recRecords	= $this->purchase_management_model->purchase_received_qty($ref_no); ?> 
			<span class="first-coln" style="min-height: 20px;">Received Qty</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo $recRecords;?>
			</span>
        </div>
	  </div>
	  <div class="col-md-7" style="padding-left:0px;">
		<h5 class="major_txt_color"><strong>Supplier Details</strong></h5>
	  </div>
      <div class="form-group">
	  	<div class="col-md-7">
			<span class="first-coln" style="min-height: 20px;">Supplier Name</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo text($purchase_order->supplier_name);?>
			</span>
        </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-md-7">
			<span class="first-coln" style="min-height: 20px;">Supplier Contact Person</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo text($supplier->ven_contact_name);?>
			</span>
        </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-md-7">
			<span class="first-coln" style="min-height: 20px;">Supplier Contact No</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo text($supplier->ven_contact_no);?>
			</span>
        </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-md-7">
			<span class="first-coln" style="min-height: 20px;">Supplier Email</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo text($supplier->ven_email_id);?>
			</span>
        </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-md-7">
			<span class="first-coln" style="min-height: 20px;">Supplier Address</span>
			<span class="seperator" style="min-height: 20px;">:</span>
			<span class="second-coln" style="min-height: 20px; margin-bottom: 0px;">
				<?php echo text($supplier->ven_address);?>
			</span>
        </div>
	  </div>
    </div>

    <div class="col-xs-12">
        <div class="col-md-7" style="padding-left:0px;">
            <h4 class="major_txt_color">Purchase Order Received Details</h4>
        </div>
    </div>

    <div class="col-xs-12 item_container">
        <?php foreach($purchase_received as $k=> $rec_order) { ?>			
			 <div class="col-xs-12">
				<div class="row">
					<div class="col-xs-12 blck">     
						<div class="sub-title"><h4><i class="fa fa-fire" style="font-size: 14px;"></i> <?php echo "POR_".$rec_order->id." / ".date("d-m-Y", strtotime($rec_order->received_date)); ?></h4><i class="ctrl opener fa fa-chevron-down" style="float: right; margin-top: -25px;"></i></div>   
							<div class="blck-content col-xs-12" style="display: none;">
								<div class=" float-clear">				
									<div class="col-md-1">
										<div class="form-group"><label>S.No</label></div>
									</div> 
												
									<div class="col-md-3">
										<div class="form-group"><label>Category Name</label></div>
									</div> 
									
									<div class="col-md-3">
										<div class="form-group"><label>Item Name</label></div>
									</div>
																	
									<div class="col-md-2">
										<div class="form-group"><label>Received Qty</label></div>
									</div>
								</div>
								<?php $recId		= $rec_order->id; ?>
								<?php $recRecords	= $this->purchase_management_model->purchase_received_order_details($recId); //echo "<pre>"; print_r($recRecords); exit;?>
								<?php foreach($recRecords as $k=> $rec_order) { //echo "<pre>"; print_r($rec_order); exit;?>
								<div class="item float-clear">
									<div class="item_details">
										<div class="col-md-1">
											<div class="form-group">												
												<?php echo ++$k; ?>
											</div>
										</div>
										
										<div class="col-md-3">
											<div class="form-group">
												<?php $category	= $this->purchase_management_model->get_category_name($rec_order->category_Id); ?>
												<?php echo $category; ?>
											</div>
										</div> 
										
										<div class="col-md-3">
											<div class="form-group">
												<?php $item	= $this->purchase_management_model->get_item_name($rec_order->item_Id); ?>
												<?php echo $item; ?>
											</div>
										</div>
																		
										<div class="col-md-2">
											<div class="form-group">
												<div class="input-group cls-w-100">
													<?php echo $rec_order->received_qty; ?>
												</div>
											</div>
										</div>            
									</div>
								</div>							
							<?php } ?>
						</div>
					</div>
				</div>
			</div>
        <?php } ?>
    </div>
  </section>
  <!-- /.content --> 
</aside>
</form>