
<style rel="stylesheet" type="text/css">

textarea {
	  background-color: white;
	    overflow: auto;
border: none;
}

    .style1
    {
        width: 192px;
    }
    .style2
    {
        width: 177px;
    }
    .auto-style1 {
        width: 115px;
    }
</style>

</head>
<?

if (isset($_REQUEST['uid_prod'])){

	$uid = $_REQUEST['uid_prod']; 

}else{

	$uid = 1;
	
}



include("configi.php");


					$sqlps = "SELECT * FROM " . $_COOKIE['phxcrmclient_id'] . "_prod_search where sel_uid = " . $uid;


					$resultps = $conn->query($sqlps);


				// output data of each row
					while($rowps = $resultps->fetch_assoc()) {
						
						$title 					= $rowps["title"];
						$title_header			= $rowps["title_header"];						
						$barcode				= $rowps["barcode"];
						
						$prod_code				= $rowps["prod_code"];

						$price					= $rowps["price"];
						$quickpick_sel			= $rowps["quickpick_sel"];
						$sku					= $rowps["sku"];						

						$prod_image_url1		= $rowps["prod_image_url1"];						
						$Option1_Value			= $rowps["Option1_Value"];
						$qty_on_hand			= $rowps["qty_on_hand"];
						$qty_on_hand_group		= $rowps["qty_on_hand_group"];
						$qty_sold				= $rowps["qty_sold"];
						$prod_status			= $rowps["prod_status"];

						$prod_cost_price		= $rowps["prod_cost_price"];

						$prod_avg_cost_price		= $rowps["prod_avg_cost_price"];
						
						$prod_manage_stock		= $rowps["prod_manage_stock"];						
						$sales_ytd_amount		= $rowps["sales_ytd_amount"];
						$sales_ytd_qty			= $rowps["sales_ytd_qty"];

						$prod_obh				= $rowps["prod_obh"];
						
						
						$prod_suppid			= $rowps["prod_suppid"];
						$prod_suppname			= $rowps["prod_suppname"];
						$prod_suppcode			= $rowps["prod_suppcode"];
						
						$prod_weight			= $rowps["prod_weight"];
						
						$prod_weight_unit		= $rowps["prod_weight_unit"];
						
						$prod_size				= $rowps["prod_size"];
						
						$prod_size_unit			= $rowps["prod_size_unit"];
						
						$prod_date_sold			= strtotime($rowps["prod_date_sold"]);		

						$prod_date_sold			= date('d/m/Y', $prod_date_sold);
						
						if ($prod_date_sold == "01/01/1970"){
							$prod_date_sold = "";
						}
						
						$prod_descr				= $rowps["prod_descr"];
						
						$qty_boc				= $rowps["qty_boc"];
						
						
						
					}
					


				

					?>

<form id="producteditform" >



        <div class="section full mt-2">
       
                <form>
				  <div class="form-group boxed">
                        <div class="input-wrapper">

		
						<div class="row">

        <div class="col-md-6">
						<label class="label" for="title">Title:</label>
					<input readonly   type="text" class="form-control" name="title"  id="title" value="<?php echo htmlspecialchars($title_header);?>" onchange="javascript: update_field_product('title', 'input', this.value)"   class="form-control required">
		
					<input  readonly  type="hidden" class="form-control" name="cv_uid"  id="cv_uid" value="<?php echo htmlspecialchars($uid);?>" class="form-control required">
		
		
		</div>
		        <div class="col-md-3">

							
							   										<label class="label" for="comp_name_edit">Main Option Name:</label>
					<input  readonly type="text" class="form-control" name="option1_value"  id="option1_value" value="<?php echo htmlspecialchars($Option1_Value);?>" onchange="javascript: update_field_product('option1_value', 'input', this.value)"   class="form-control required">
		</div>
		
		
		  <div class="col-md-3">
		  
		   				<label class="label" for="sku">SKU:  (UID: <?php echo htmlspecialchars($uid);?>)</label>
					<input  readonly type="text" class="form-control" name="sku"  id="sku" value="<?php echo htmlspecialchars($sku);?>" onchange="javascript: update_field_product('sku', 'input', this.value)"   class="form-control required">
					

		
			</div>
		
		
		</div>
						<div class="row">

        <div class="col-md-3">
		<label class="label" for="retail_price2">Status:</label>
														<?php
include_once("../php/configi.php");

$querystatus="SELECT * FROM " . $_COOKIE['phxcrmclient_id'] . "_code_lookup  where code_type = 'stockstatus' order by code_additional";
//echo $querystaff;
$resultstatus=mysqli_query($conn, $querystatus);
	?>	
<select  readonly disabled id = "prod_status" name="prod_status"   class="form-control"   onchange="javascript: update_field_product('prod_status', 'input', this.options[this.selectedIndex].text)" >

<?



//mysql_close();



$i = 0;

while($rowstatus=mysqli_fetch_array($resultstatus)) { 

		?>

		<option <?php if ($rowstatus['code_value'] == $prod_status){echo " selected ";} ?>
		value='<?php echo $rowstatus['code_value']?>'><?php echo $rowstatus['code_value']; ?></option> 	

<?php

}


	 
?>
</select>


		
		</div>
		        <div class="col-md-3">
 				<label class="label" for="barcode">Barcode:</label>
					<input   readonly type="text" class="form-control" name="barcode"  id="barcode" value="<?php echo htmlspecialchars($barcode);?>" onchange="javascript: update_field_product('barcode', 'input', this.value)"   class="form-control required">
		
		</div>
		
			        <div class="col-md-3">
					<label class="label" for="prod_cost_price">Cost Price:</label>
					<input   readonly   type="text"  class="form-control"   style="text-align: right" id="prod_cost_price" onchange="javascript: update_field_product('prod_cost_price', 'inputint', this.value)" name="prod_cost_price"  value="<?php echo htmlspecialchars(number_format($prod_cost_price, 2, '.', ','));?>" class="form-control required">
 		
		</div>	
					        <div class="col-md-3">
		<label class="label" for="retail_price2">Sell Price:</label>
					<input  readonly    type="text"  class="form-control" style="text-align: right"   id="price" onchange="javascript: update_field_product('price', 'inputint', this.value)" name="price"  value="<?php echo htmlspecialchars(number_format($price, 2, '.', ','));?>" class="form-control required">
 		
		</div>	

		
		</div>
                  
						 <input readonly id="cv_uid_prod" type="hidden"   class="form-control"   value="<?php echo htmlspecialchars($uid); ?>">


<div class="row">

        <div class="col-md-6">
<label class="label" for="prod_code">Handle:</label>
					<input readonly type="text"  class="form-control"   id="prod_code" onchange="javascript: update_field_product('prod_code', 'input', this.value)" name="prod_code"  value="<?php echo htmlspecialchars($prod_code);?>" class="form-control required">
        </div>


         	<div class="col-md-3">
			
					<label class="label" for="retail_price2">Manage Stock ?:</label>
														<?php
include_once("../php/configi.php");

$querystatus="SELECT * FROM 1_general_codes  where code_type = 'managestock' order by code_value";
//echo $querystaff;
$resultstatus=mysqli_query($conn, $querystatus);
	?>	
<select  readonly disabled id = "prod_manage_stock" name="prod_manage_stock"   class="form-control"   onchange="javascript: update_field_product('prod_manage_stock', 'input', this.options[this.selectedIndex].text)" >

<?



//mysql_close();



$i = 0;

while($rowstatus=mysqli_fetch_array($resultstatus)) { 

		?>

		<option <?php if ($rowstatus['code_value2'] == $prod_manage_stock){echo " selected ";} ?>
		value='<?php echo $rowstatus['code_value2']?>'><?php echo $rowstatus['code_value2']; ?></option> 	

<?php

}


	 
?>
</select>



                </div>
         	<div class="col-md-3">
<label class="label" for="retail_price3">Qty On Hand:</label>
					<input  readonly    type="text"  class="form-control"  style="text-align: right"  id="qty_on_hand" onchange="javascript: update_field_product('qty_on_hand', 'inputint', this.value)" name="qty_on_hand"  value="<?php echo htmlspecialchars($qty_on_hand);?>" class="form-control required">
                </div>
                



		
        <div class="col-md-6">
			<label class="label" for="pv_supplier_main_view">Supplier:</label>
		       


                <input  readonly type="text" value="<?php echo htmlspecialchars($prod_suppname)?>"  id="pv_supplier_main"  class="form-control"  placeholder="Search Supplier ..." >
                <input  readonly type="text" style="display: none" id="tagsprodsuppnew"  class="form-control" placeholder="Search Supplier ..." >

				<input  readonly type="text" id="sel_uid_supplier" value="" style="display: none"  class="form-control" placeholder="Search Supplier ..." >




        </div>
		
      <div class="col-md-6">
						<label class="label" for="comp_name_edit">Supplier Code:</label>
					<input  readonly  type="text" class="form-control" name="prod_suppcode"  id="ce_comp_name" value="<?php echo htmlspecialchars($prod_suppcode);?>" onchange="javascript: update_field_product('prod_suppcode', 'input', this.value)"   class="form-control required">


   </div> 
   
   								            	<div class="col-md-3">
<label class="label" for="retail_price3">Weight:</label>
					<input  readonly  readonly   type="text"  class="form-control"  style="text-align: right"  id="prod_weight" onchange="javascript: update_field_product('prod_weight', 'inputint', this.value)" name="prod_weight"  value="<?php echo htmlspecialchars($prod_weight);?>" class="form-control required">
                </div>
				
								            	<div class="col-md-3">
<label class="label" for="retail_price3">Weight Unit:</label>
														<?php
include_once("../php/configi.php");

$querystatus="SELECT * FROM 1_general_codes  where code_type = 'prodweight' order by code_value";
//echo $querystaff;
$resultstatus=mysqli_query($conn, $querystatus);
	?>	
<select disabled readonly id = "prod_weight_unit" name="prod_weight_unit"   class="form-control"   onchange="javascript: update_field_product('prod_manage_stock', 'input', this.options[this.selectedIndex].text)" >

<?



//mysql_close();



$i = 0;

while($rowstatus=mysqli_fetch_array($resultstatus)) { 

		?>

		<option <?php if ($rowstatus['code_value2'] == $prod_weight_unit){echo " selected ";} ?>
		value='<?php echo $rowstatus['code_value2']?>'><?php echo $rowstatus['code_value2']; ?></option> 	

<?php

}


	 
?>
</select>


                </div>
				
												            	<div class="col-md-3">
<label class="label" for="prod_size">Size:</label>
					<input  readonly readonly   type="text"  class="form-control"  style="text-align: right"  id="prod_size" onchange="javascript: update_field_product('prod_size', 'inputint', this.value)" name="prod_size"  value="<?php echo htmlspecialchars($prod_size);?>" class="form-control required">
                </div>
				
								            	<div class="col-md-3">
<label class="label" for="retail_price3">Size Unit:</label>
					<input  prod_size_unit readonly   type="text"  class="form-control"  style="text-align: right"  id="prod_size_unit" onchange="javascript: update_field_product('prod_size_unit', 'inputint', this.value)" name="prod_size_unit"  value="<?php echo htmlspecialchars($prod_size_unit);?>" class="form-control required">
                </div>
				
            	<div class="col-md-3">
<label class="label" for="prod_avg_cost_price">Avg Cost Price:</label>
					<input   readonly   type="text"  class="form-control"  style="text-align: right"  id="prod_avg_cost_price" onchange="javascript: update_field_product('prod_avg_cost_price', 'inputint', this.value)" name="prod_avg_cost_price"  value="<?php echo htmlspecialchars(number_format($prod_avg_cost_price, 2, '.', ','));?>" class="form-control required">
                </div>
            	<div class="col-md-3">
<label class="label" for="retail_price3">BO Cust:</label>
					<input   readonly readonly  type="text"  class="form-control"  style="text-align: right"  id="qty_boc" onchange="javascript: update_field_product('qty_boc', 'inputint', this.value)" name="qty_boc"  value="<?php echo htmlspecialchars($qty_boc);?>" class="form-control required">
                </div>
				            	<div class="col-md-3">
<label class="label" for="retail_price3">Last Date Sold:</label>
					<input  readonly   type="text"  class="form-control"  style="text-align: right"  id="prod_date_sold" onchange="javascript: update_field_product('prod_date_sold', 'inputint', this.value)" name="prod_date_sold"  value="<?php echo htmlspecialchars($prod_date_sold);?>" class="form-control required">
                </div>
				            	<div class="col-md-3">
<label class="label" for="retail_price3">Qty Sold:</label>
					<input  readonly   type="text"  class="form-control"  style="text-align: right"  id="sales_ytd_qty" onchange="javascript: update_field_product('sales_ytd_qty', 'inputint', this.value)" name="sales_ytd_qty"  value="<?php echo htmlspecialchars($sales_ytd_qty);?>" class="form-control required">
                </div>
				

				
				
				
				
   </div>
        <div class="col-md-12">
   
   <label class="label" for="prod_descr">  Description:</label>
		       <textarea id="prod_descr_view"  data-height="400" data-lang="en-US" name="prod_descr" rows="4" class='form-control'><?php echo $prod_descr; ?></textarea>	
			   <br>
			   </div>
			

   			        <div class="col-md-12">

					   <label class="label" for="prod_descr">  Variants:</label>

					



<div id="divgetprodvarview">



<?php include("../php/getprodvarview.php"); ?>


</div>


		<br>
		</div>	
<div class="row">		
   			        <div class="col-md-6">
					   <label class="label" for="prod_descr">  Departments:</label>



<div id="divgetproddeptview">



<?php include("../php/getproddeptview.php"); ?>


</div>


		
		</div>

			        <div class="col-md-6">
					   <label class="label" for="prod_descr">  Categories/Tags:</label>



<div id="divgetprodcatview">



<?php include("../php/getprodcatview.php"); ?>


</div>


		
		</div>
		
	</div>		 




    </div> 




  </div>
				</form>
				

			</div>
	
		








</div>

  <input name="MM_insert" type="hidden" value="form1" />
</form>
