<?php
ob_start();
$PageSecurity = 11;
$title = _('Item Maintenance');
include('includes/SQL_CommonFunctions.inc');
$date=date('d/m/Y');
$sql="Select * from item_master where id='".$_REQUEST['id']."'";
$result=DB_query($sql,$db);
$myrow=DB_fetch_array($result);
$get_field="select * from item_master_setup where item_master='".$myrow['CategoryID']."'";
$field_res=DB_query($get_field,$db);
$z=1;
while($field_row=DB_fetch_array($field_res))
{
	$field_id[$z]=$field_row['field'];
	//echo $field_id[$z];
	$get_sql="Select ".$field_id[$z]." from item_master where id='".$_REQUEST['id']."'";
	$get_result=DB_query($get_sql,$db);
	$get_row=DB_fetch_array($get_result);
	$field[$z]=$get_row[''.$field_id[$z].''];
	$z++;
}
?>
<h2 align="center"><font face="Georgia, Times New Roman, Times, serif"><strong>Details of<br><?php echo $myrow['StockID']." - ".$myrow['item_name'];?></strong></font></h2>
<br>
<?php if($myrow['image_pdf']!='') {?>
<table border="0" align="center">
<tr>
<td><strong><h3 align="center">Item Image</h3></strong></td>
</tr>
<tr>
<td><fieldset>
<img src="uploaded_images/<?php echo $myrow['image_pdf'];?>" width="90" height="140"/></fieldset>
</td>
</tr>
</table>
<?php }?>
<?php 
if($myrow['CategoryID']=='FG')
{?>
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center" style="border:1px solid #CCC;" bgcolor="#FFFFFF">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="2">
	<tr>
    <th><strong>ITEM SUB GROUP </strong></th>
    <td><input type="text" value="<?php echo $s->GetFieldValue('stockcategory',"id='".$myrow['SubCategoryID']."'" ,'categorydescription');  ?>" size="30" style="width:100%;" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>ITEM CODE</strong></th>
    <td>
      <input name="text" type="text" value="<?php echo $myrow['StockID'];?>" size="30" style="width:100%;" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>ITEM NAME</strong></th>
    <td>
      <input name="text2" type="text" value="<?php echo $myrow['item_name'];?>" size="30"  style="width:100%;"/></td>
  </tr>
   <tr>
    <th scope="row"><strong>ITEM DESCRIPTION </strong></th>
    <td>
      <input name="text3" type="text" value="<?php echo $myrow['item_desc'];?>" size="30" style="width:100%;" /></td>
   </tr>
   <tr>
     <th><strong>LABEL</strong></th>
     <td nowrap="nowrap"><strong>Height</strong> - 
       <input name="text4" type="text" value="<?php echo $myrow['height'];?>" size="10" style="width:33%;" />
       <strong>Width - </strong>
       <input name="text5" type="text" value="<?php echo $myrow['width'];?>" size="10" style="width:32%;" /></td>
   </tr>

  <tr>
    <th scope="row"><strong>TEETH</strong></th>
    <td>
      <input name="text6" type="text" value="<?php echo $myrow['teeth'];?>" size="30"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>UPS</strong></th>
    <td>
      <input name="text7" type="text" value="<?php echo $myrow['ups'];?>" size="30"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>FOIL SIZE </strong></th>
    <td>
      <input name="text8" type="text" value="<?php echo $myrow['foil_size'];?>" size="30" style="width:100%;" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>PAPER SIZE </strong></th>
    <td><?php 
	$size_sql=DB_query("select name from size_master where id ='".$myrow['paper_size']."'",$db);
	$size_res=DB_fetch_array($size_sql);
	?>
      <input name="text9" type="text" value="<?php echo $size_res['name'];?>" size="30" style="width:100%;" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>PAPER NAME </strong></th>
    <td>
      <input name="text10" type="text" value="<?php echo $myrow['paper_name'];?>" size="30" style="width:100%;" /></td>
  </tr>
  <tr>
    <th ><strong>PRINT SIZE </strong></th>
    <td><input name="text10" type="text" value="<?php echo $myrow['print_size'];?>" size="30" style="width:100%;" /></td>
    </tr>
    <tr>
    <th><strong>UNIT</strong></th>
    <td><input name="text10" type="text" value="<?php echo $myrow['unit'];?>" size="30" style="width:100%;" />
    </td>
  </tr>
  </table></td>
    <td valign="top" style="border-left:1px solid #CCC; border-right:1px solid #CCC;"><table width="100%" border="0" cellspacing="1" cellpadding="2">
    	<tr>
    <th  width="60%"><strong>FLEXO/OFFSET</strong></th>
    <td><input name="text11" type="text" value="<?php echo $myrow['flexo_offset'];?>" size="30"  style="width:100%;"/>
	</td>
  </tr>
      <tr>
        <th><strong>FRT/BR</strong></th>
        <td>
          <input name="text11" type="text" value="<?php echo $myrow['frt_br'];?>" size="30"  style="width:100%;"/></td>
      </tr>
  <tr>
    <th scope="row"><strong>EMBOSSING</strong></th>
    <td><select name="embossing" id="embossing" style="width:100%">
      <option value="000">Select</option>
      <option value="YES" <?php echo ($myrow['embossing']=='YES'?'selected':'')?>>YES</option>
      <option value="NO" <?php echo ($myrow['embossing']=='NO'?'selected':'')?>>NO</option>
    </select></td>
  </tr>
  <tr>
    <th scope="row"><strong>SPOT</strong></th>
    <td><select name="spot" id="spot" style="width:100%;">
      <option value="000">Select</option>
      <option value="YES" <?php echo ($myrow['spot']=='YES'?'selected':'')?>>YES</option>
      <option value="NO" <?php echo ($myrow['spot']=='NO'?'selected':'')?>>NO</option>
    </select></td>
  </tr>
  <tr>
    <th scope="row"><strong>PARTY CODE </strong></th>
    <td>
      <input name="text15" type="text" value="<?php echo $myrow['party'];?>" size="30" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>OVERPRINT</strong></th>
    <td><select name="overprint" id="overprint" style="width:100%;">
      <option value="000">Select</option>
      <option value="YES" <?php echo ($myrow['overprint']=='YES'?'selected':'')?>>YES</option>
      <option value="NO" <?php echo ($myrow['overprint']=='NO'?'selected':'')?>>NO</option>
    </select></td>
  </tr>
  <tr>
    <th scope="row"><strong>SHADE FOIL</strong></th>
    <td>
      <input name="text17" type="text" value="<?php echo $myrow['foil'];?>" size="30" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>CUT</strong></th>
    <td><select name="cut" id="cut" style="width:100%;">
      <option value="000">Select</option>
      <option value="POLAR"<?php echo($myrow['cut']=='POLAR'?'selected':'')?>>POLAR</option>
      <option value="DIE"<?php echo($myrow['cut']=='DIE'?'selected':'')?>>DIE</option>
    </select></td>
  </tr>
  <tr>
    <th scope="row"><strong>VARNISH</strong></th>
    <td nowrap="nowrap"><?php if($myrow['varnish']=='')
			{$s="selected"; $q=''; $d="disabled";} 
			else 
			{$s=''; $q="selected"; $d='';}?>
      <select name="varnish_yn" id="varnish_yn" style="width:50px" onchange="get_option1(this.value)">
        <option value="YES" <?php echo $q;?>>YES</option>
        <option value="NO" <?php echo $s;?>>NO</option>
      </select>
      <select name="varnish" id="varnish" style="width:65%" <?php echo $d;?>>
        <option value="000">Select</option>
        <option value="GLOSS" <?php echo($myrow['varnish']=='GLOSS'?'selected':'')?>>GLOSS</option>
        <option value="MATT" <?php echo($myrow['varnish']=='MATT'?'selected':'')?>>MATT</option>
      </select></td>
  </tr>
  <tr>
    <th scope="row"><strong>UV</strong></th>
    <td nowrap="nowrap"><?php if($myrow['uv']==''){$s="selected"; $q=''; $d="disabled";} else {$s=''; $q="selected"; $d='';}?>
      <select name="uv_yn" id="uv_yn" style="width:50px" onchange="get_option2(this.value)">
        <option value="YES" <?php echo $q;?>>YES</option>
        <option value="NO" <?php echo $s;?>>NO</option>
      </select>
      <select name="uv" id="uv" style="width:65%" <?php echo $d;?>>
        <option value="000">Select</option>
        <option value="GLOSS" <?php echo($myrow['uv']=='GLOSS'?'selected':'')?>>GLOSS</option>
        <option value="MATT" <?php echo($myrow['uv']=='MATT'?'selected':'')?>>MATT</option>
      </select></td>
  </tr>
    <?php 
    $get_column_sql=DB_query("Select * from item_master_setup where item_master='".$myrow['CategoryID']."' ",$db);
	$i=1;
	while($column_res=DB_fetch_array($get_column_sql))
	{?>
	<tr>
	<th><strong><?php echo $column_res['field'];?><input type="hidden" name="field_id[<?php echo $i;?>]" value="<?php echo $column_res['field'];?>" /></strong></th>
	<td>
	  <input name="text21" type="text" value="<?php echo $field[$i];?>" size="30" /></td>
	</tr>
	<?php 
	$i++;}
  ?>
  </table></td>
    <td valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="2">
   <?php
   //echo "select * from item_color_master where item_master_id='".$_REQUEST['id']."' and color!='0'";
   $color_sql=DB_query("select * from item_color_master where item_master_id='".$_REQUEST['id']."' and color!='0'",$db);
  	$i=1;
   while($color_res=DB_fetch_array($color_sql))
	{
	?>
	<tr>
      <th scope="row" nowrap="nowrap"><strong>COLOR <?php echo $i;?> </strong></th>
      <td><?php 
	  $get_color=DB_query("Select color from product_color where id='".$color_res['color']."'",$db);
	  $get_res=DB_fetch_array($get_color);
	  ?>
        <input name="text22" type="text" value="<?php echo $get_res['color'];?>" style="width:100%;" /></td>
	</tr>
	<?php $i++;} ?>
  </table></td>
  </tr>
</table>	
<?php }
else{
?>
<table>
<tr>
<th>Main Category</th>
<td><input type="text" name="" value="<?php echo $s->getField('stockmaincategory','id',$myrow['CategoryID'],'stockmaincategoryname');?>" /></td>
</tr>
</table>
<table width="70%" border="0" cellspacing="1" cellpadding="0" align="center" style="border:1px solid #CCC;" bgcolor="#FFFFFF">
  <tr>
    <td valign="top" style="border-right:1px solid #CCC;"><table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr>
    <th><strong>ITEM SUB GROUP </strong></th>
    <td><input type="text" value="<?php echo $s->GetFieldValue('stockcategory',"id='".$myrow['SubCategoryID']."'" ,'categorydescription');  ?>" size="30"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>ITEM CODE</strong></th>
    <td><input name="Input" type="text" value="<?php echo $myrow['StockID'];?>" size="30"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>ITEM NAME</strong></th>
    <td>
      <input name="Input2" type="text" value="<?php echo $myrow['item_name'];?>" size="30"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>ITEM DESCRIPTION </strong></th>
    <td>
      <input name="Input3" type="text" value="<?php echo $myrow['item_desc'];?>" size="30"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>ITEM NO. </strong></th>
    <td>
      <input name="Input4" type="text" value="<?php echo $myrow['item_no'];?>" size="30"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>FLEXO/OFFSET</strong></th>
    <td>
      <input name="Input5" type="text" value="<?php echo $myrow['flexo_offset'];?>" size="30"/></td>
  </tr>
  <tr>
    <th scope="row"><strong>UNIT</strong></th>
    <td><?php 
	$unit_sql=DB_query("select unitname from unitsofmeasure where unitid ='".$myrow['unit']."'",$db);
	$unit_res=DB_fetch_array($unit_sql);
	?>  <input type="text" name="Input6" value="<?php echo $unit_res['unitname'];?>"  style="width:100%;"/>    </tr>
  
  <tr>
    <th><strong>WIDTH</strong></th>
    <td>
      <input name="Input8" type="text" value="<?php echo $myrow['width'];?>" size="30"/></td>
  </tr>
  <tr>
    <th><strong>LENGTH</strong></th>
    <td>
      <input name="Input9" type="text" value="<?php echo $myrow['length'];?>" size="30"/></td>
  </tr>
  <tr>
  <tr>
    <th scope="row"><strong>OD</strong></th>
    <td>
      <input name="Input11" type="text" value="<?php echo $myrow['od'];?>" size="30"/></td>
  </tr>
  <tr>
        <th width="57%"><strong>SERIAL NO. </strong></th>
        <td width="43%">
          <input type="text" name="Input15" value="<?php echo $myrow['serial_no'];?>" size="30"/></td>
      </tr>

</table></td>
<td valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
      
      <tr>
        <th><strong>ORIGINAL/LOCAL</strong></th>
        <td>
          <input type="text" name="Input16" value="<?php echo $myrow['orig_local'];?>"  style="width:100%;"/></td>
      </tr>
  <tr>
    <th><strong>TYPE </strong></th>
    <td><?php 
	$type_sql=DB_query("select name from type_master where id ='".$myrow['type_name']."'",$db);
	$type_res=DB_fetch_array($type_sql);
	?>
      <input type="text" name="Input17" value="<?php echo $type_res['name'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th><strong>SHADE</strong></th>
    <td>
      <input type="text" name="Input18" value="<?php echo $myrow['shade'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th><strong>
	<?php if($myrow['flexo_offset']=='Flexo'){?>
	RUNNING METER<?php }
	else
	{?>
	ROLL
	<?php } ?>
	</strong></th>
    <td>
      <input type="text" name="Input19" value="<?php echo $myrow['running_roll'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th><strong>VOLUME</strong></th>
    <td><?php 
	$vol_sql=DB_query("select name from volume_master where id ='".$myrow['volume']."'",$db);
	$vol_res=DB_fetch_array($vol_sql);
	?>
      <input type="text" name="Input20" value="<?php echo $vol_res['name'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th><strong>TEETH</strong></th>
    <td>
      <input type="text" name="Input21" value="<?php echo $myrow['teeth'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th><strong>BCM</strong></th>
    <td>
      <input type="text" name="Input22" value="<?php echo $myrow['bcm'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th><strong>UPS</strong></th>
    <td>
      <input type="text" name="Input23" value="<?php echo $myrow['ups'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th height="26"><strong>QUALITY</strong></th>
    <td><?php 
	$q_sql=DB_query("select name from quality_master where id ='".$myrow['quality']."'",$db);
	$q_res=DB_fetch_array($q_sql);
	?>
      <input type="text" name="Input24" value="<?php echo $q_res['name'];?>"  style="width:100%;"/></td>
  </tr>
  <tr>
    <th height="26"><strong>MRN Tolerance</strong></th>
    <td><input type="text" name="Input241" value="<?php echo $myrow['tolerance'];?>"  style="width:85%;"/>&nbsp;%</td>
  </tr>
  <?php 
    $get_column_sql=DB_query("Select * from item_master_setup where item_master='".$myrow['CategoryID']."' ",$db);
	$i=1;
	while($column_res=DB_fetch_array($get_column_sql))
	{?>
	<tr>
	<th height="24"><strong><?php echo $column_res['field'];?>
	  <input type="hidden" name="field_id[<?php echo $i;?>]" value="<?php echo $column_res['field'];?>"  style="width:100%;"/></strong></th>
	<td>
	  <input type="text" name="Input25" value="<?php echo $field[$i];?>"  style="width:100%;"/></td>
	</tr>
	<?php 
	$i++;}
  ?>
 
</table></td>
</tr>
<tr>
<td colspan="2">
<table width="55%" border="0" cellspacing="2" cellpadding="2" align="center" style="border:1px solid #CCC;">
  <tr>
    <th colspan="5"><div align="center"><strong>ITEM SPECIFICATIONS </strong></div></th>
    </tr>
  <tr>
    <th><strong>MAKE</strong></th>
    <th><strong>GRADE</strong></th>
    <th><strong>COLOR</strong></th>
    <th><strong>SIZE</strong></th>
    <th><strong>GSM</strong></th>
    </tr>
	<?php 
	$specs_sql="select * from item_specification where proc_id='".$myrow['StockID']."'";
	$specs_result=DB_query($specs_sql,$db);
	while($specs_row=DB_fetch_array($specs_result))
	{
	?>
  <tr>
    <td>
	<?php if($specs_row['manufacture']!='0'){
	$make=$s->getField('product_manufacture','id',$specs_row['manufacture'],'manufacturer');}else{$make='N/A';}
	?>
	<input type="text" name="" value="<?php echo $make;?>" readonly/></td>
    <td>
	<?php if($specs_row['grade']!='0'){
	$grade=$s->getField('product_grade','id',$specs_row['grade'],'grade');}else{$grade='N/A';}
	?>
	<input type="text" name="" value="<?php echo $grade;?>" readonly/></td>
    <td>
	<?php if($specs_row['color']!='0'){ 
	$color=$s->getField('product_color','id',$specs_row['color'],'color');}else{$color='N/A';}
	?>
	<input type="text" name="" value="<?php echo $color;?>" readonly/></td>
	<td>
	<?php if($specs_row['size']!='0'){ 
	$size=$s->getField('size_master','id',$specs_row['size'],'name');}else{$size='N/A';}
	?>
	<input type="text" name="" value="<?php echo $size;?>" readonly/></td>
	<td>
	<?php if($specs_row['gsm']!='0'){ 
	$gsm=$s->getField('gsm','id',$specs_row['gsm'],'gsm');}else{$gsm='N/A';}
	?>
	<input type="text" name="" value="<?php echo $gsm;?>" readonly/></td>
  </tr>
  <?php } ?>
</table>

</td>
</tr>
</table>
<?php }
include('includes/footer.inc');
?>