<link rel="stylesheet" href="css/jquery-ui.css" />
<link rel="stylesheet" href="css/jquery.autocomplete.css" type="text/css" />
<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>
function print_jobcard(url)
{
onmouseover35= window.open(url,'onmouseover35','height=650,width=1100,scrollbars=yes,left=100,top=25,toolbar=no,location=no,directories=no,status=no,menubar=no');
}
function jobcard_creation_report_overall_excel(customer_name,from_date,to_date,jobtype,job_card_num,fabric_types)
{
	
window.location.href="jobcard/jobcard_entry/jobcard_entry_excel.php?customer_name="+customer_name+"&from_date="+from_date+"&to_date="+to_date+"&jobtype="+jobtype+"&job_card_num="+job_card_num+"&fabric_types="+fabric_types;
}


function individual_print_jobcard(url)
{
onmouseover35= window.open(url,'onmouseover35','height=650,width=1100,scrollbars=yes,left=100,top=25,toolbar=no,location=no,directories=no,status=no,menubar=no');
}

function image_view(url)
{
onmouseover35= window.open(url,'onmouseover35','height=500,width=500,scrollbars=yes,left=100,top=25,toolbar=no,location=no,directories=no,status=no,menubar=no');
}

function add_purchase_order(url)
{	
onmouseover10= window.open(url,'onmouseover10','height=600,width=1050,scrollbars=no,resizable=no,left=50,top=50,toolbar=no,location=no,directories=no,status=no');	
}

function jobcard_entry_search(customer_name,from_date,to_date,jobtype,job_card_num,fabric_type,status1)
 {
     var division_ids = [];
  
   jQuery.each(jQuery('.fabric_type_co option:selected'), function() {
        division_ids.push(jQuery(this).val()); 
    });
   
    var fabric_type1=division_ids.toString(); 
  jQuery.ajax({
  type: "GET",
  url: "jobcard/jobcard_entry/jobcard_entry_list.php",
  data: "customer_name="+customer_name+"&from_date="+from_date+"&to_date="+to_date+"&jobtype="+jobtype+"&job_card_num="+job_card_num+"&fabric_type="+fabric_type1+"&status1="+status1,
  success: function(msg){jQuery("#jobcard_main_list_div").html(msg);
 }
    });
 }
 
function booking_open(quotation_no)
{
window.location.href="main_fram.php?file=jobcard_creation&quotation_no="+quotation_no+"&source_frm=jobcard_creation";
window.location.reaload(true);
}

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

var sp1 = jQuery.noConflict();
sp1().ready(function() 
{ 
	sp1("#job_card_num").autocomplete("include/autocomplete/jobcard_no_auto_complete.php", {
	width: 220,
	matchContains: true,
	selectFirst: true
	});	
});
var q = jQuery.noConflict();
sp1().ready(function() 
{ 
	sp1("#fabric_type").autocomplete("include/autocomplete/fabric_type_auto.php", {
	width: 220,
	matchContains: true,
	selectFirst: true
	});	
});
</script>
<style> 
.someclass{ 
background:url(img/plus.png) no-repeat 0 0 ; 
} 
</style> 
<?php
error_reporting(0);
$edit_id=$_GET['edit_id'];
include ("include/db.php");
ob_start();
session_start();

/******************** Auto Generated ID*********************************************/
$date=date("Y");
$st_date=substr($date,2);
$month=date("m");	   
$datee=$st_date.$month;

if(!isset($_GET['booking_no']))
{
	$rs1=mysql_query("select booking_no from  booking_main_list order by id desc");
	if($res1=mysql_fetch_assoc($rs1))
	{
		$pur_array=explode('-',$res1['booking_no']);
	
	    $year1=$pur_array[1];
        $year2=substr($year1, 0, 2);
	    $year='20'.$year2;
		$purchase_no=$pur_array[2];
	}
	if($purchase_no=='')
		$book_number='BT-'.$datee.'-0001';
	else
	{
		$purchase_no+=1;
		$book_number='BT-'.$datee.'-'.str_pad($purchase_no, 4, '0', STR_PAD_LEFT);
	}
}
   $sql="select * from  booking_sub_list where book_no='$book_number' or book_no='$_GET[book_no]'";
    $rs=mysql_query($sql);
	$rscount_book=mysql_num_rows($rs);
  
  if($edit_id1!='')
  {
	  $purchase_num= $purchase_order_no;
  }

function get_user_types1($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_names1($book_branch)
{
    $sql_user="select * from  branch_creation where branch_id='$book_branch'";
	$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_branch=$_SESSION['branch'];
$get_user_type=get_user_types1($login_user_name,$login_pass_word);
$get_branch_names=get_branch_names1($book_branch);
 
if($_GET['edit_id']!='')
{
$table_display_styles1='style="display:inline;"';
} 
else
{
$table_display_stylesss='style="display:none;"';
}
 
?>
<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;color:#333;letter-spacing: 1px;padding:10px; background-color:#f7f7f7;}
.types_class { 
    height: 25px; 
    width: 200px; 
    background-color: transparent;  
    border-style: solid;  
    border-width: 0px 0px 1px 0px;  
    border-color:#CCC; 
    outline:0;
	font-size:14px;
	font-weight:normal
  } 
  
  .types_class1 { 
    height: 25px; 
    width: 200px; 
    background-color: transparent;  
    border-style: solid;  
    border-width: 0px 0px 1px 0px;  
    border-color:#CCC; 
    outline:0;
	font-size:14px;
  } 
.textbox:focus {
    border-color: #C9C9C9;
    -webkit-box-shadow: rgba(0, 0, 0, 0.15) 0 0 8px;
}  
</style>
<div class="container">
<div class="row-fluid">
<div class="span12">
<div class="table-responsive">
<form name="company_form"  id="company_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"><div class="style9">Job Creation List</div></tr>
<td width="12%" align="left"><img src="img/plus.png" name="add_button" id="add_button" title="Add Booking Details" onclick="javascript:booking_open(quotation_no.value)" align="top" width="30" height="30" border="0" tabindex="4" style="cursor:pointer; margin-left:20%; margin-top:-34px;" class="button green-button" >
</td>
<tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="5%" height="45" align="center" class="style7"><strong> Name</strong></td>
<td width="13%" align="left" class="style15"><input type="hidden" class="types_class1" name="quotation_no" id="quotation_no" value=""  > 
  <input type="text" class="types_class1" name="customer_name" id="customer_name" style="width:150px; height:20px;" onKeyUp="jobcard_clear_validation(this.value)" tabindex="6"  value="<?php if($edit_id!='') { echo $cust_name; } else { } ?>" >  </td>
<td width="7%" align="left" class="style7"><strong>From Date</strong></td> 
<td width="14%" align="left"><input type="date" class="types_class1" name="from_date" id="from_date"  style="height:23px; width:150px" value="<?php  echo date("Y-m-d");?>"  /></td>
<td width="6%" align="left" class="style7"><strong>To Date</strong></td>
<td width="14%" align="left" class="style15"><input type="date" class="types_class1" name="to_date" id="to_date" style="height:23px;width:150px;" value="<?php echo date("Y-m-d");?>" /></td>
<td width="6%" align="left" class="style7"><strong>Jobtype</strong></td>
<td width="12%" align="left"  class="style15">
 <select id="jobtype" name="jobtype" class="types_class1"  >
                             	<option value="">All</option>
                             <?php
							 include ("../../include/db.php");
                            
									$sql="select * from job_type_creation order by job_type ASC";
								$sql123 = mysql_query($sql);
							while($fetch_sql123=mysql_fetch_array($sql123))
								{
									
									$job_type=$fetch_sql123['job_type'];
									?>
									<option value="<?php echo $job_type?>"><?php echo $job_type; ?></option>
									<?php
									}
									?>
                             
 </select></td>
  <td width="10%" align="center"  class="style15"><strong>Fabric Type</strong></td>
<td align="left"><select id="fabric_type" name="fabric_type" class=" fabric_type_co"  style="height:150px;"  multiple>
                             	<option value="">All</option>
                             <?php
							
                            
									$sql="select * from fabric_type_creation order by fabric_type ASC";
								$sql123 = mysql_query($sql);
							while($fetch_sql123=mysql_fetch_array($sql123))
								{
									$cust_create_id=$fetch_sql123['cust_create_id'];
									$fabric_type=$fetch_sql123['fabric_type'];
									?>
									<option value="<?php echo $fabric_type?>"><?php echo $fabric_type; ?></option>
									<?php
									}
									?>
                             </select></td></tr>
<tr>
<td width="8%" align="left"  class="style7"><strong>Jobcard No</strong></td>
<td align="left"><input type="text" class="types_class" name="job_card_num" id="job_card_num" style="height:23px;width:150px;" value="" /></td>

<td width="6%" align="left" class="style7"><strong>Status</strong></td>
<td width="12%" align="left"  class="style15">
 <select id="status1" name="status1" class="types_class1"  >
                             	<option value="">Select</option>
								<option value="<?php echo '1';?>"><?php echo 'Approval'; ?></option>
								<option value="<?php echo '0'; ?>"><?php echo 'Not Approval'; ?></option>
		                       
 </select></td>

<td width="3%" align="left"><a href="#"  onClick="jobcard_entry_search(customer_name.value,from_date.value,to_date.value,jobtype.value,job_card_num.value,fabric_type.value,status1.value)"><img src="img/search_icon.png" width="40" height="35" title="Search" value="Search" /></a></td>
</tr>
</table>
<table width="100%" >
    <tr>
      <td colspan="10" align="center">
      <div id="jobcard_main_list_div" >
        <?php include("jobcard_entry_list.php"); ?>
        </div>
    </td>
  </tr>
</table>
</form>
</div>
</div>
</div>
</div>
