<?php

echo "<div class='form_panel' align=left >";
	echo "<div class='form_panel_title'>";
	
					
		echo "<div class='fa-stack fa-lg'  style='cursor:pointer;float:left;'  onclick=\"document.".$this_form_name.".ui_action.value='ADD_ITEM_OK';document.".$this_form_name.".add_item_id.value='".$_REQUEST["add_item_id"]."';mon_submit_form('".$this_form_name."','".$this_url."')\" >";
			echo "<i class='fa fa-square fa-stack-2x color_green'  ></i><i class='fa fa-check fa-stack-1x color_white' ></i>";
		echo "</div>";
			
	
		
		echo "<div class='fa-stack fa-lg'  style='cursor:pointer;float:right;'  onclick=\"document.".$this_form_name.".ui_action.value='';mon_submit_form('".$this_form_name."','".$this_url."')\" >";
			echo "<i class='fa fa-square fa-stack-2x color_red'  ></i><i class='fa fa-times fa-stack-1x color_white' ></i>";
		echo "</div>";

	
	
	
	echo "</div>";
	echo "<div class='form_panel_content'>";
		
		
		$query_product = " select * from t_".$key_table_prefix."_product 
				where pdt_id ='".$_REQUEST["add_item_id"]."'  ";
		$result_product = mysqli_query($dbconn,$query_product);
		if($line_product = mysqli_fetch_array($result_product,MYSQLI_ASSOC))
		{
			
			
			
			
			
		
		
		
			echo "<div class='form_field_separator' >";
				echo "<font size=3><b>Add Item</b></font>";	
			echo "</div>";
			
			// item code--------------------------
			echo "<div class='form_field_row' >";
				//------------------------label--------------------------------------------------				
				echo "<div class='form_field_label' >";
					echo "<b>Code</b>";
				echo "</div>";
				//-------------------------input-------------------------------------------------
				echo "<div class='form_field_input' >";
					echo $line_product["pdt_code"];
				echo "</div>";
			echo "</div>";	
			
			// item name--------------------------
			echo "<div class='form_field_row' >";
				//------------------------label--------------------------------------------------				
				echo "<div class='form_field_label' >";
					echo "<b>Name</b>";
				echo "</div>";
				//-------------------------input-------------------------------------------------
				echo "<div class='form_field_input' >";
					echo $line_product["pdt_name"];
				echo "</div>";
			echo "</div>";	
			
			// barcode--------------------------
			echo "<div class='form_field_row' >";
				//------------------------label--------------------------------------------------				
				echo "<div class='form_field_label' >";
					echo "<b>Barcode</b>";
				echo "</div>";
				//-------------------------input-------------------------------------------------
				echo "<div class='form_field_input' >";
					echo $line_product["pdt_barcode"];
				echo "</div>";
			echo "</div>";	
			
			
			echo "<div class='form_field_separator' >";
				echo "<font size=3><b>Costing</b></font>";	
			echo "</div>";
			
			
			// unit price--------------------------
			echo "<div class='form_field_row' >";
				//------------------------label--------------------------------------------------				
				echo "<div class='form_field_label' >";
					echo "<b>Unit Cost</b>";
				echo "</div>";
				//-------------------------input-------------------------------------------------
				echo "<div class='form_field_input' >";
					
					if($_REQUEST["add_item_unit_price"]=="")
					{
						$_REQUEST["add_item_unit_price"]=$line_product["pdt_cost"];
					}
					
						echo "<input type='text' class='textbox textbox-s' name='add_item_unit_price' value=\"".$_REQUEST["add_item_unit_price"]."\"  >";
				echo "</div>";
				
			echo "</div>";	
			
			
			echo "<div class='form_field_separator' >";
				echo "<font size=3><b>Quantity</b></font>";	
			echo "</div>";
			
			
			// unit price--------------------------
			echo "<div class='form_field_row' >";
				//------------------------label--------------------------------------------------				
				echo "<div class='form_field_label' >";
					echo "<b>Quantity</b>";
				echo "</div>";
				//-------------------------input-------------------------------------------------
				echo "<div class='form_field_input' >";
						echo "<input type='text' class='textbox textbox-s' name='add_item_quantity' value=\"".$_REQUEST["add_item_quantity"]."\"  >";
				echo "</div>";
				
			echo "</div>";	
			
			echo "<div class='form_field_separator' >";
	    		 	echo "<font size=3><b>Tax Info</b></font>";	
	    	 	echo "</div>";
		 
			// gst code--------------------------
	    		 echo "<div class='form_field_row' >";
	    			 //------------------------label--------------------------------------------------				
	    			 echo "<div class='form_field_label' >";
	    				 echo "<b>Tax Code</b>";
	    			 echo "</div>";
	    			 //-------------------------input-------------------------------------------------
	    			 echo "<div class='form_field_input' >";
				 
				 
				 //default value:
					 if($_REQUEST["add_item_gst_code"]=="")
					 {
						 $_REQUEST["add_item_gst_code"]=$line_product["pdt_gst_code"];
					 }
					 
					 
					 
				 	echo "<select class='dropdown dropdown-auto' name='add_item_gst_code'  >";
					echo "<option value=''></option>";
				 	$query_gst="select * from t_".$key_table_prefix."_gst ";
					$result_gst= mysqli_query($dbconn,$query_gst);
					while($line_gst = mysqli_fetch_array($result_gst,MYSQLI_ASSOC))
					{
						
						if($_REQUEST["add_item_gst_code"]==$line_gst["gst_code"])
						{
							echo "<option value='".$line_gst["gst_code"]."' selected >";
						}
						else {
							echo "<option value='".$line_gst["gst_code"]."' >";
						}
						
							echo $line_gst["gst_code"];
							echo " - ";
							echo $line_gst["gst_name"];
							
						echo "</option>";
					}
					echo "</select>";
					
				 	
	    					 
	    			 echo "</div>";
	    			 
	    		 echo "</div>";	
			 
			 
			 
			 // gst mode--------------------------
 	    		 echo "<div class='form_field_row' >";
 	    			 //------------------------label--------------------------------------------------				
 	    			 echo "<div class='form_field_label' >";
 	    				 echo "<b>Mode</b>";
 	    			 echo "</div>";
 	    			 //-------------------------input-------------------------------------------------
 	    			 echo "<div class='form_field_input' >";
				 
					 //default value:
					 if($_REQUEST["add_item_gst_mode"]=="")
					 {
						 $_REQUEST["add_item_gst_mode"]=$line_product["pdt_gst_mode"];
					 }
					 
					 echo "<select class='dropdown dropdown-auto' name='add_item_gst_mode'  >";
					 echo "<option value=''></option>";
					foreach($mon_keyword_list["key_gst_mode"] as $key=>$value)
					{
						
						if($_REQUEST["add_item_gst_mode"]==$key)
						{
							echo "<option value='".$key."' selected >";
						}
						else {
							echo "<option value='".$key."' >";
						}
						
							echo $value;
							
							
						echo "</option>";
					}
					echo "</select>";
					
					
 	    			 echo "</div>";
 	    			 
 	    		 echo "</div>";	
			 
			 
			 
			 
			 //============Internal Inventory Management==========================================================================
			 
			 if($sys_system_master_setting_line["set_module_internal_inventory_management_with_stock_posting"]=="YES")
			 {
				 
				 
				echo "<div class='form_field_separator' >";
					echo "<font size=3><b>Internal Inventory Management Info</b></font>";	
				echo "</div>";
				
				
				
				echo "<div class='form_field_row' >";
					//------------------------label--------------------------------------------------				
					echo "<div class='form_field_label' >";
						echo "<b>Storage Location</b>";
					echo "</div>";
					//-------------------------input-------------------------------------------------
					echo "<div class='form_field_input' >";
						echo "<select class='dropdown dropdown-auto' name='add_item_storage_location'  >";
						echo "<option value=''></option>";
						$query_info="select * from t_".$key_table_prefix."_storage_location ";
						$result_info= mysqli_query($dbconn,$query_info);
						while($line_info = mysqli_fetch_array($result_info,MYSQLI_ASSOC))
						{
							
							if($_REQUEST["add_item_storage_location"]==$line_info["loc_code"])
							{
								echo "<option value='".$line_info["loc_code"]."' selected >";
							}
							else {
								echo "<option value='".$line_info["loc_code"]."' >";
							}
							
								echo $line_info["loc_code"];
								echo " - ";
								echo $line_info["loc_name"];
								
							echo "</option>";
						}
						echo "</select>";
						
					echo "</div>";
					
				echo "</div>";	
				
			 }
			
			
			
			
			 
			 
			 
	 
	 
			echo "<div class='form_field_separator' >";
	    		 	echo "<font size=3><b>Additional Info</b></font>";	
	    	 	echo "</div>";
	 
	 		if($line_product["pdt_select_pattern"]=="YES")
	 		{
				// unit price--------------------------
				echo "<div class='form_field_row' >";
					//------------------------label--------------------------------------------------				
					echo "<div class='form_field_label' >";
						echo "<b>Pattern</b>";
					echo "</div>";
					//-------------------------input-------------------------------------------------
					echo "<div class='form_field_input' >";
						echo "<select class='dropdown dropdown-auto' name='add_item_pattern'  >";
						echo "<option value=''></option>";
						$query_info="select * from t_".$key_table_prefix."_pattern ";
						$result_info= mysqli_query($dbconn,$query_info);
						while($line_info = mysqli_fetch_array($result_info,MYSQLI_ASSOC))
						{
							
							if($_REQUEST["add_item_pattern"]==$line_info["ptn_code"])
							{
								echo "<option value='".$line_info["ptn_code"]."' selected >";
							}
							else {
								echo "<option value='".$line_info["ptn_code"]."' >";
							}
							
								echo $line_info["ptn_code"];
								echo " - ";
								echo $line_info["ptn_code"];
								
							echo "</option>";
						}
						echo "</select>";
						
					echo "</div>";
					
				echo "</div>";	
				
			}
			
			if($line_product["pdt_select_color"]=="YES")
	 		{
				// unit price--------------------------
				echo "<div class='form_field_row' >";
					//------------------------label--------------------------------------------------				
					echo "<div class='form_field_label' >";
						echo "<b>Color</b>";
					echo "</div>";
					//-------------------------input-------------------------------------------------
					echo "<div class='form_field_input' >";
						echo "<select class='dropdown dropdown-auto' name='add_item_color'  >";
						echo "<option value=''></option>";
						$query_info="select * from t_".$key_table_prefix."_color ";
						$result_info= mysqli_query($dbconn,$query_info);
						while($line_info = mysqli_fetch_array($result_info,MYSQLI_ASSOC))
						{
							
							if($_REQUEST["add_item_color"]==$line_info["clr_code"])
							{
								echo "<option value='".$line_info["clr_code"]."' selected >";
							}
							else {
								echo "<option value='".$line_info["clr_code"]."' >";
							}
							
								echo $line_info["clr_code"];
								echo " - ";
								echo $line_info["clr_name"];
								
							echo "</option>";
						}
						echo "</select>";
					echo "</div>";
					
				echo "</div>";	
				
			}
			
			if($line_product["pdt_select_size"]=="YES")
	 		{
				// unit price--------------------------
				echo "<div class='form_field_row' >";
					//------------------------label--------------------------------------------------				
					echo "<div class='form_field_label' >";
						echo "<b>Size</b>";
					echo "</div>";
					//-------------------------input-------------------------------------------------
					echo "<div class='form_field_input' >";
						echo "<select class='dropdown dropdown-auto' name='add_item_size'  >";
						echo "<option value=''></option>";
						$query_info="select * from t_".$key_table_prefix."_size ";
						$result_info= mysqli_query($dbconn,$query_info);
						while($line_info = mysqli_fetch_array($result_info,MYSQLI_ASSOC))
						{
							
							if($_REQUEST["add_item_size"]==$line_info["siz_code"])
							{
								echo "<option value='".$line_info["siz_code"]."' selected >";
							}
							else {
								echo "<option value='".$line_info["siz_code"]."' >";
							}
							
								echo $line_info["siz_code"];
								echo " - ";
								echo $line_info["siz_name"];
								
							echo "</option>";
						}
						echo "</select>";
					echo "</div>";
					
				echo "</div>";	
				
			}
	 
	 
	 	}
	 
	
	
echo "</div>";
echo "</div>";

?>