<?php 
session_start();
include('../includes/dbcon.php');

$str=" ";

$data = array();

$edate=date("Y-m-d");
$userid=$_SESSION['hrm_id'];
//$loc_id=$_SESSION['loc_id_bill'];



if (isset($_POST['inv'])) {
    $inv = $_POST['inv'];



if (empty($inv)){   $item=0;   $error=1;       }   


if ( $error<>1){

///////////////opening inv header //////////////////////

	$sqlinv=mysqli_query($con,"SELECT inv_header.inv_id, inv_header.loc_id,stock_locations.loc_name
 FROM inv_header 
 LEFT JOIN stock_locations ON inv_header.loc_id=stock_locations.loc_id where inv_id='$inv'  ")or die(mysqli_error($con));
	        	$countinv=mysqli_num_rows($sqlinv);	
	        	if ($countinv>0) {
	        		 $options = '<option value="0">~~~Select ~~~~</option>';
	        		while($row=mysqli_fetch_array($sqlinv)){			
					//$loc_id =$row['loc_id'];
	        			  $options .= '<option value="' . $row['loc_id'] . '"selected>' . $row['loc_name'] . '</option>';
							
				   }
				    echo $options;
				}
				else {  echo '<option value="0">~~~Select ~~~~</option>'; }
///////  end of inv header


} /// if ( $error<>1){


} /////if (isset($_POST['cus_id'])) {
				else {  echo '<option value="0">~~~Select ~~~~</option>'; }
	

?>