
<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>


<style>


.ui-autocomplete
{
    position:absolute;
    cursor:default;
    z-index:1001 !important
}


</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_condition			= $rowps["prod_condition"];
						
						$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"];
						
						$prod_gender				= $rowps["prod_gender"];
						$prod_brand_name			= $rowps["prod_brand_name"];
						$prod_colourname			= $rowps["prod_colourname"];
						$prod_sold_ref				= $rowps["prod_sold_ref"];	

						$prod_catid					= $rowps["prod_catid"];	
						$prod_deptid				= $rowps["prod_deptid"];	
						
						
						
						$prod_date_received			= strtotime($rowps["prod_date_received"]);
						
						$prod_date_received			= date('d/m/Y', $prod_date_received);
						
						if ($prod_date_received == "01/01/1970"){
							$prod_date_received = "";
						}
						
	
						$prod_date_returned			= strtotime($rowps["prod_date_returned"]);
						
						$prod_date_returned			= date('d/m/Y', $prod_date_returned);
						
						if ($prod_date_returned == "01/01/1970"){
							$prod_date_returned = "";
						}
						
						$prod_date_donated			= strtotime($rowps["prod_date_donated"]);
						
						$prod_date_donated			= date('d/m/Y', $prod_date_donated);
						
						if ($prod_date_donated == "01/01/1970"){
							$prod_date_donated = "";
						}
						
						$prod_date_paid				= strtotime($rowps["prod_date_paid"]);
						
						$prod_date_paid			= date('d/m/Y', $prod_date_paid);
						
						if ($prod_date_paid == "01/01/1970"){
							$prod_date_paid = "";
						}

						
						
					}
					


				

					?>

<form id="producteditform" >



        <div class="section full mt-2" style="margin-top: 2px;">
       
                <form>
				  <div class="form-group boxed">
                        <div class="input-wrapper">

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

		
			</div>
			</div>
			<div class="row">		
   			        <div class="col-md-6">
					   <label class="label" for="prod_descr">  Department:</label>
	<select  id = "product_cat_sel"  name="product_cat_sel"  class="form-control"    onchange="javascript: update_field_product('prod_deptid', 'input', this.options[this.selectedIndex].value)"  >
		<option selected value="0">Select department</option>

		<?
		include("configi.php");

		$querywcd1="SELECT * FROM " . $_COOKIE['phxcrmclient_id'] . "_web_dept order by dept_name";
		//echo $querycc;

		$resulttwcd1 = mysqli_query($conn, $querywcd1);
		while ($rowtwcd1 = mysqli_fetch_array($resulttwcd1)) {

			$dept_id				= $rowtwcd1["dept_id"];
			$dept_name				= $rowtwcd1["dept_name"];

			
			if ($prod_deptid == $dept_id){

		?>

			<option selected value="<? echo $dept_id; ?>"><? echo htmlspecialchars($dept_name); ?></option>

		<?php
		
			}else{
		?>

			<option  value="<? echo $dept_id; ?>"><? echo htmlspecialchars($dept_name);?></option>

		<?php
				
				
			}

		}

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


			        <div class="col-md-6">
					   <label class="label" for="prod_descr">  Category:</label>
	<select  id = "product_cat_sel"  name="product_cat_sel"  class="form-control"   onchange="javascript: update_field_product('prod_catid', 'input', this.options[this.selectedIndex].value)") >
		<option selected value="0">Select category</option>

		<?
		include("configi.php");

		$querywc="SELECT * FROM " . $_COOKIE['phxcrmclient_id'] . "_web_cat order by cat_name";
		//echo $querycc;

		$resulttwc = mysqli_query($conn, $querywc);
		while ($rowtwc = mysqli_fetch_array($resulttwc)) {

			$cat_id				= $rowtwc["cat_id"];
			$cat_name			= $rowtwc["cat_name"];

	
			
			
			if ($prod_catid == $cat_id){

		?>

			<option selected value="<? echo $cat_id; ?>"><? echo $cat_name; ?></option>

		<?php
		
			}else{
		?>

			<option  value="<? echo $cat_id; ?>"><? echo $cat_name; ?></option>

		<?php
				
				
			}

		}

	 
		?>
	</select>


		
		</div>
		
	</div>	
				<div class="row">
				
						        <div class="col-md-3">
<label class="label" for="title">Condition:</label>
			<select name='je2_prod_condition' class="form-control"  id = 'je2_prod_condition'  onchange="javascript: update_field_product('prod_condition', 'input', this.options[this.selectedIndex].text)" >
				<?php
				if ("New" == $prod_condition) {
					echo "<option value='New' SELECTED>New</option>";
					echo "<option value='2nd hand'>2nd hand</option>";
				}else if ("2nd hand" == $prod_condition) {
					echo "<option value='New'>New</option>";
					echo "<option value='2nd hand' SELECTED>2nd hand</option>";				
				}

				
				echo "</select>";
				
				?>
		</div>
		</div>
				<div class="row">	

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

		
		

		
		
		</div>
		<div class="row">	
		
        <div class="col-md-12">
   
   <label class="label" for="prod_descr">  Description:</label>
		       <textarea id="prod_descr_edit2"  onchange="javascript: update_field_product('prod_descr', 'ckeditor', this.value)"   data-height="250" data-lang="en-US" name="prod_descr" rows="2" class='form-control'><?php echo $prod_descr; ?></textarea>	
			   <br>
			   </div>
			   </div>
			   
			   
		<div class="row">	
			   
			   
			   					        <div class="col-md-3">
		<label class="label" for="retail_price2">Sell Price:</label>
					<input     type="text"  class="form-control" style="text-align: right"   id="price_edit" onchange="javascript: update_field_product('price', 'inputintprice', this.value)" name="price"  value="<?php echo htmlspecialchars(number_format($price, 2, '.', ','));?>" class="form-control required">
 		
		</div>	
		      <div class="col-md-3">
							<label class="label" for="je2_prod_split">Split%:</label>
					<input name="je2_prod_split" class="form-control" id="je2_prod_split" type="text"  onchange="javascript: new_split_price(this.value)" value="<? echo "40"?>" />
					
			</div>		
                
         	<div class="col-md-3">
					<label class="label" for="prod_cost_price">Supplier Payment:</label>
					<input     type="text"  class="form-control"   style="text-align: right" id="prod_cost_price_edit" 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>			   
			   
			   
			   
						<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 1_general_codes  where code_type = 'stockstatusobh' order by code_value";
//echo $querystaff;
$resultstatus=mysqli_query($conn, $querystatus);
	?>	
<select 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 style="display: none" class="col-md-3">
<label class="label" for="prod_gender">Gender:</label>
					<input  type="text"  class="form-control"  style="text-align: left"  id="prod_gender" onchange="javascript: update_field_product('prod_gender', 'inputint', this.value)" name="prod_gender"  value="<?php echo htmlspecialchars($prod_gender);?>" class="form-control required">
                </div>
																            	<div class="col-md-3">
<label class="label" for="prod_size">Size:</label>
					<input     type="text"  class="form-control"  style="text-align: left"  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="prod_colourname">Colour:</label>
					<input     type="text"  class="form-control"  style="text-align: left"  id="prod_colourname" onchange="javascript: update_field_product('prod_colourname', 'inputint', this.value)" name="prod_colourname"  value="<?php echo htmlspecialchars($prod_colourname);?>" class="form-control required">
                </div>

 </div>
				<div class="row">
				
								        <div class="col-md-6">
			<label class="label" for="pv_supplier_main">Supplier:</label>
		       
		
														<?php
include_once("../php/configi.php");

$querysupp="SELECT * FROM " . $_COOKIE['phxcrmclient_id'] . "_client  where c_supp = 'Yes' order by  comp_name";
//echo $querystaff;
$resultsupp=mysqli_query($conn, $querysupp);
	?>	
<select disabled readonly id = "prod_suppid" name="prod_suppid"   class="form-control"   onchange="javascript: update_field_product('prod_suppid', 'input', this.options[this.selectedIndex].value)" >

<option <?php if ('' == $prod_suppid){echo " selected ";} ?>
		value=''>Select Supplier</option> 	

<?



//mysql_close();



$i = 0;

while($rowsupp=mysqli_fetch_array($resultsupp)) { 

		?>

		<option <?php if ($rowsupp['uid_client'] == $prod_suppid){echo " selected ";} ?>
		value='<?php echo $rowsupp['uid_client']?>'><?php echo $rowsupp['comp_name']; ?></option> 	

<?php

}


	 
?>
</select>


			


        </div>
		
								   <div class="col-md-3">
		<label class="label" for="prod_obh">On Behalf of:</label>

					<select name='prod_obh' id = 'prod_obh'   class='form-control'   onchange="javascript: update_field_product('prod_obh', 'input', this.options[this.selectedIndex].text)" >";

	<?php
			

				if ($prod_obh == 'Yes') {
					echo "<option value='Yes' SELECTED>Yes</option>";
					echo "<option value='No'>No</option>";
				}elseif ($prod_obh == 'No') {
					echo "<option value='Yes'>Yes</option>";
					echo "<option value='No' SELECTED>No</option>";
				}else {
					echo "<option value='Yes'>Yes</option>";
					echo "<option value='No'>No</option>";
				}
				
echo "</select>";
?>




        </div>
		
		</div>
		<div class="row">
            	<div class="col-md-3">
<label class="label" for="prod_date_received">Date Received:</label>
					<input     type="text"  class="form-control"  style="text-align: right"  id="prod_date_received" onchange="javascript: update_field_product('prod_date_received', 'inputdate', this.value)" name="prod_date_received"  value="<?php echo htmlspecialchars($prod_date_received);?>" class="form-control required">
                </div>
            	<div class="col-md-3">
<label class="label" for="prod_date_sold">Last Date Sold:</label>
					<input     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="prod_date_returned">Date Returned:</label>
					<input     type="text"  class="form-control"  style="text-align: right"  id="prod_date_returned" onchange="javascript: update_field_product('prod_date_returned', 'inputint', this.value)" name="prod_date_returned"  value="<?php echo htmlspecialchars($prod_date_returned);?>" class="form-control required">
                </div>
				            	<div class="col-md-3">
<label class="label" for="prod_date_returned">Date Donated:</label>
					<input     type="text"  class="form-control"  style="text-align: right"  id="prod_date_donated" onchange="javascript: update_field_product('prod_date_donated', 'inputint', this.value)" name="prod_date_donated"  value="<?php echo htmlspecialchars($prod_date_donated);?>" class="form-control required">
                </div>
				
</div>		



         





		
	

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


<div class="row">

     
                


   

				
								            	<div style="display: none" class="col-md-3">
<label class="label" for="prod_brand_name">Brand Name:</label>
					<input     type="text"  class="form-control"  style="text-align: left"  id="prod_brand_name" onchange="javascript: update_field_product('prod_brand_name', 'inputint', this.value)" name="prod_brand_name"  value="<?php echo htmlspecialchars($prod_brand_name);?>" class="form-control required">


                </div>
				

				


				
				        <div style="display: none" class="col-md-3">
 				<label class="label" for="barcode">Barcode:</label>
					<input   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>

			

	
	 



						<div class="row">


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

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

			</div>
	
		
    </div> 







</div>

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