<html>
<head>
<link rel="stylesheet" href="css/jquery-ui.css" />
<link rel="stylesheet" href="css/jquery.autocomplete.css" type="text/css" />
<link rel="stylesheet" href="css/font.css" type="text/css" />
<script type="text/javascript" src="js/media_entry_ajax.js"></script>
<script src="js/jquery/jquery.js" type="text/javascript"></script>
<script src="js/jquery/jquery-1.8.2.js"></script>
<script src="js/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="js/jquery/autocomplete_jquery_plugin.js"></script>
<script src="js/shortcut.js"  type="text/javascript"></script>



<script>
function print_media(url)
{	
onmouseover10= window.open(url,'onmouseover10','height=400,width=650,scrollbars=no,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no');	
}

// var sm = jQuery.noConflict();
// sm().ready(function() 
// { 
// 	sm("#in_jobcard_no_media").autocomplete("include/autocomplete/jobcard_no_media_autocomplete.php", {
// 	width: 250,
// 	matchContains: true,
// 	selectFirst: true
// 	});	
// });

 function media_close()
{
window.location.href="main_fram.php?file=media_entry_list";
window.location.reaload(true);
}


</script>
<style> 
.someclass{ 
background:url(img/plus.png) no-repeat 0 0 ; 
} 
  .types_class1 { 
    height: 25px; 
    width: 250px; 
    background-color: transparent;  
    border-style: solid;  
    border-width: 0px 0px 1px 0px;  
    border-color:#CCC; 
    outline:0;
	font-size:13px;
	font-family:Verdana;
	
  }
input:focus {  border-color:#87BB07; }
select:focus {  border-color:#87BB07; } 
textarea:focus {  border-color:#87BB07; } 
</style> 
<?php
error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
include ("include/db.php");	
$from_date=$_POST['from_date'];
$to_date=$_POST['to_date'];
/******************** Auto Generated ID*********************************************/
$date=date("Y");
$st_date=substr($date,2);
$month=date("m");	   
$datee=$st_date.$month;
$edit_id=$_GET['edit_id'];
ob_start();
session_start();
function get_user_type($login_user_name,$login_pass_word)
{
    $sql_user="select * from  user_creation where user_name='$login_user_name' and password='$login_pass_word'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$user_type=$rsdata_user->user_type;
	}
	return $user_type;
}

function get_branch_names2($book_branchs1)
{
    $sql_user="select * from  branch_creation where branch_id='$book_branchs1'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$branch_name=$rsdata_user->branch_name;
	}
	return $branch_name;
}

$login_user_name=$_SESSION['login_user_name'];
$login_pass_word=$_SESSION['login_pass_word'];
$book_branchs1=$_SESSION['branch'];
$get_user_type=get_user_type($login_user_name,$login_pass_word);
$get_branch_names=get_branch_names2($book_branchs1);


function get_branch_place_names($branch_places12)
{
    $sql_user="select * from  place_creation where id='$branch_places12'";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$location=$rsdata_user->location;
	}
	return $location;
}

if($_GET['edit_id']!='')
{
$table_display_styles1='style="display:inline;"';
} 
else
{
$table_display_stylesss='style="display:none;"';
}

  $in_edit_id=$_GET['edit_id'];
 $sql="select * from media_main where main_id='$_GET[edit_id]'";
  $rs=mysql_query($sql);
  $rscount=mysql_num_rows($rs);
 
  while($rsdata=mysql_fetch_array($rs))
  {
	   $sno=$sno+1;
	   $from=$from+1;
	   $main_id=$rsdata['main_id'];
	   $jobcard_nos=$rsdata['jobcard_no'];
	   $entry_dates=$rsdata['entry_date'];
	   $created_bys=$rsdata['created_by'];
	   $cust_names=$rsdata['cust_name'];
	   $style_nos=$rsdata['style_no'];
	   $style_names=$rsdata['style_name'];
	   $cust_po_nos=$rsdata['cust_po_no'];
	   $job_types=$rsdata['job_type'];
       $fabric_types=$rsdata['fabric_type'];
	   $combos=$rsdata['combo'];
  }
  
$date=date("Y");
$st_date=substr($date,2);
$month=date("m");	   
$datee=$st_date.$month;

	$rs1=mysql_query("select customer_dc_no from  media_main order by main_id desc");
	if($res1=mysql_fetch_assoc($rs1))
	{
		$media_array=explode('-',$res1['customer_dc_no']);
	    $year1=$media_array[1];
        $year2=substr($year1, 0, 2);
	    $year='20'.$year2;
		$invoice_no=$media_array[2];
	}
	if($invoice_no=='')
		$invoice_number='INV-'.$datee.'-0001';

	else
	{
		$invoice_no+=1;
		$invoice_number='INV-'.$datee.'-'.str_pad($invoice_no, 4, '0', STR_PAD_LEFT);
	}
?>

<style type="text/css">
.style2 {color: #FF0000}
.style7{font-family: Tahoma, Arial, Helvetica, sans-serif;font-size: 13px;}
.style8{ text-align:center;font-family:Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; padding:40px; font-weight: 500;color:#32328e;letter-spacing: 1px;}
.style9{ text-align:left;font-family:Tahoma, Arial, Helvetica, sans-serif; font-size: 15px; padding:0px; font-weight: 600;letter-spacing: 1px;padding:10px; background-color:#f7f7f7; color:#000;}
.style4 {border-bottom: solid 1px;border-bottom-color: #CCCCCC;}
.style5 {border-left: solid 1px;border-left-color: #CCCCCC;}
.text {font-family: Verdana; font-size:13px;}

</style>
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<form name="media_form"  id="media_form" method="post" action=""  enctype="multipart/form-data">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border-top:solid 1px; color:#ddd;">
<tr align="left" style="font-size:14px; color:#000"><div class="style9">Media Entry Form</div></tr>
<td width="12%" align="left"><img src="img/wrong.png" name="add_button" id="add_button" title="Media Close"  onclick="javascript:media_close()" align="top" width="30" height="30" border="0"  style="cursor:pointer; margin-left:96%; margin-top:-34px;" class="button green-button" >
</td>
<tr></tr></table>
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" >
          <tr>
            <td width="58" height="35"></td>
            <td width="191" align="right" class="text" style="padding-right: 50px; font-size: 14px; color:#F03;">&nbsp;<span style="color: #C30"><strong>Jobcard No</strong></span><strong> *</strong></td>
            <td width="455" style="padding-left:30px;"><span class="text" style="font-size:14px; color:#080;">
              <!--<input type="text" class="types_class1" name="in_jobcard_no_media" id="in_jobcard_no_media" style="width:250px; height:20px; font-size:14px;" autofocus  value="<?php if($in_edit_id!='') { echo $jobcard_nos; } else { } ?>" onKeyUp="get_customer_medias(this.value),get_created_by_media(this.value),get_style_no_media(this.value),get_customer_po_media(this.value),get_style_name_media(this.value),get_combo_media(this.value),get_job_type_media(this.value),get_fabric_types_media(this.value),media_main_clear_validation(this.value),getmediajobcard(this.value),get_particulars_media(this.value)"-->
              <!--onfocus="get_customer_medias(this.value),get_created_by_media(this.value),get_style_no_media(this.value),get_customer_po_media(this.value),get_style_name_media(this.value),get_combo_media(this.value),get_job_type_media(this.value),get_fabric_types_media(this.value),media_main_clear_validation(this.value),getmediajobcard(this.value),get_particulars_media(this.value)"   tabindex="1">-->
              
              <!-- <input type="text" class="types_class1" name="in_jobcard_no_media" id="in_jobcard_no_media" style="width:250px; height:20px; font-size:14px;" autofocus  value="<?php if($in_edit_id!='') { echo $jobcard_nos; } else { } ?>" onchange-->
              <!-- ="check_farbic_f_emboss_or_not(this.value)" onKeyUp="check_farbic_f_emboss_or_not(this.value)"-->
              <!--onfocus="check_farbic_f_emboss_or_not(this.value)"   tabindex="1">-->
              
       <select class="types_class1" data-live-search="true" name="in_jobcard_no_media" id="in_jobcard_no_media" style="width:250px; height:20px; font-size:14px;" onChange="check_farbic_f_emboss_or_not(this.value)" >
    <?php if($in_edit_id!='') { ?>
        <option value="<?php echo $jobcard_nos; ?>" selected><?php echo $jobcard_nos; ?></option>
    <?php } else { ?>
        <option value="" selected>Select JobCard No</option>
    <?php } ?>
    <?php 
        $sql_user="SELECT * FROM media_main WHERE main_id!='' order by main_id desc";
        $rs_user=mysql_query($sql_user);
        while($rsdata_user=mysql_fetch_object($rs_user)) { 
            $jobcard_no=$rsdata_user->jobcard_no;
    ?>
        <option value="<?php echo $jobcard_no; ?>"><?php echo $jobcard_no; ?></option>
    <?php } ?>
</select>



              
              </span> <div id="in_jobcard_no_media_validation_div" style="color:#F00; font-size:14px; font-family:Verdana, sans-serif;"></div></td>
            <td width="270" align="right" class="text" style="padding-right: 50px; font-size: 14px;">Date &amp; Time</td>
            <td width="353" align="left" class="txt">
              <input type="datetime-local"  name="media_date" id="media_date"  <?php if($_SESSION['user_type']!=1) { ?> readonly <?php } ?>  class="types_class1"   tabindex="1" style="font-size:12px; height:25px; width:190px; " value="<?php if($in_edit_id!='') { echo $entry_dates; }  else{ echo  date('Y-m-d').'T'.date('H:i'); }?>"></td>
          </tr>
          <tr>
            <td height="32"></td>
            <td align="right" class="text" style="padding-right: 50px; font-size: 14px;">Customer Name</td>
            <td style="padding-left:30px;">
          <div id="media_customer"> <input type="hidden" class="types_class1" name="in_cust_name" id="in_cust_name"  style="width:250px; height:20px;"   value="<?php if($in_edit_id!='') { echo $cust_names; } else { } ?>" ><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $cust_names; } else { } ?></span></div>
           <div id="in_cust_name_validation_div" style="color:#F00"></div></td>
            <td class="text" align="right" style="padding-right: 50px; font-size: 14px;">Entry Created By</td>
            <td align="left" class="txt"><div id="created_by_div"><input type="hidden" class="types_class1" name="created_by" id="created_by"   style="width:250px; height:20px;" value="<?php if($in_edit_id!='') { echo $created_bys; }  ?>" ><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $created_bys; }  ?></span></div></td>
          </tr>
          <tr>
            <td height="31"></td>
          <td align="right" class="text" style="padding-right: 50px; font-family: Verdana; font-size: 14px;">Customer PO NO</td>
            <td style="padding-left:30px;"><div id="customer_po_div"><input type="hidden" class="types_class1" name="customer_po" id="customer_po" value="<?php if($in_edit_id!='') { echo $cust_po_nos; } else { } ?>" style="width:250px; height:20px;"><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $cust_po_nos; } else { } ?></span></div></td>
            <td class="text" align="right" style="padding-right: 50px; font-size: 14px;">&nbsp;Style No</td>
            <td align="left" class="txt"><div id="style_no_div"><input type="hidden" class="types_class1" name="style_no" id="style_no" value="<?php if($in_edit_id!='') { echo $style_nos; } else { } ?>" style="width:250px; height:20px;"><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $style_nos; } else { } ?></span></div></td>
          </tr>
          <tr>
            <td height="37"></td>
            <td align="right" class="text" style="padding-right: 50px; font-size: 14px;">Job Type </td>
            <td style="padding-left:30px;"><div id="job_types_div"><input type="hidden" class="types_class1" name="job_types" id="job_types" value="<?php if($in_edit_id!='') { echo $job_types; } else { } ?>" style="width:250px; height:20px;"><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $job_types; } else { } ?></span></div></td>
            <td class="text" align="right" style="padding-right: 50px; font-size: 14px;">&nbsp;Style Name</td>
            <td>
              <div id="style_name_div"><input type="hidden" class="types_class1" name="style_name" id="style_name" value="<?php if($in_edit_id!='') { echo $style_names; } else { } ?>" style="width:250px; height:20px;"><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $style_names; } else { } ?></span></div></td>
          </tr>
          <tr>
            <td height="35" >&nbsp;</td>
            <td align="right" class="text" style="padding-right: 50px; font-size: 14px;">Fabric Type</td>
            <td align="left"   class="text" style="padding-left:28px;"><div id="fabric_type_div"><input type="hidden" class="types_class1" name="fabric_type" id="fabric_type" value="<?php if($in_edit_id!='') { echo $fabric_types; } else { } ?>" style="width:250px; height:20px;"><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $fabric_types; } else { } ?></span></div></td>
            <td align="right"  class="text" style="padding-right: 50px; font-size: 14px;">Combo</td>
            <td align="left"  class="text" ><div id="combo_type_div"><input type="hidden" class="types_class1" name="combo_type" id="combo_type" value="<?php if($in_edit_id!='') { echo $combos; } else { } ?>" style="width:250px; height:20px;"><span style="font-family: Verdana, sans-serif; font-size:14px ;font-weight:bold"><?php if($in_edit_id!='') { echo $combos; } else { } ?></span></div></td>
            </tr>
          <tr>
            <td height="37" align="center" >&nbsp;</td>
            <td height="37" align="right" class="text" style="padding-right: 50px; font-size: 14px;">&nbsp;</td>
            <td height="37" align="left"   class="text" style="padding-left:28px;" >&nbsp;</td>
          
            <td align="right"  class="text" style="padding-right: 50px; font-size: 14px;">&nbsp;</td>
            <td align="left"  class="text" ></td>
            <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
           <td>&nbsp;</td>
            <td align="right"  class="text" style="padding-right: 50px; font-size: 14px;">&nbsp;</td>

            <td align="left"  class="text" ></td>
            
            
            
            </tr>
             
          </tr>
          <tr>
            <td height="327" colspan="5" align="center" ><div id="media_sub_list_div"><?php include('media_sublist.php');?></div></td>
            </tr>
          <tr>
            <td height="65" colspan="5" align="center" valign="bottom"><p>
              <input type="button" name="submit_edit"  id="submit_edit" style="background-color: #87BB07;    color: #fff;    border: 0px; font-family:verdana; font-size:14px; width:120px; height:27px; " value="<?php if($_GET['edit_id']!='') { echo "UPDATE";  } else { echo "SUBMIT"; } ?>" tabindex="7" class="button" onClick="media_main_list(in_jobcard_no_media.value,media_date.value,in_cust_name.value,style_no.value,created_by.value,style_name.value,customer_po.value,combo_type.value,job_types.value,fabric_type.value,'<?php echo $_GET['edit_id'];?>',this.value)">
            </p></td>
          </tr>
          </table>
</form>
</div>
</div>
</div>
</div>

