<?php $PageSecurity = 2;
include('includes/DefineSuppTransClass.php');
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
include('includes/session.inc');
include('includes/function_lib.php');

   $data1='';
   $jobcarddate=$s->getField('job_card','id',$_REQUEST['jobid'],'job_date');


$data1.="<input name='job_card_date' type='text' id='job_card_date' style='width:100%;' value=".ConvertSQLDate($jobcarddate)." size='15' class='datepicker' />";
	
			
$data2='';

  
	$data2.="<select name='issue_req_no' style='width:100%' id='issue_req_no' onchange='Get_jobcard1(this.value)'  >
	   <option value='0'>Select</option>";
	
	//echo "Select * from job_card where wo_no='".$_REQUEST['salid']."' order by id ASC ";
	$floor_sql=DB_query("Select * from material_slip_against_job_card where job_card_id='".$_REQUEST['jobid']."' order by id ASC   ",$db);
	while($floor_row=DB_fetch_array($floor_sql))
	{
		$mm=1;
		$floor_sqlm=DB_query("Select * from material_job_item where material_slip_id='".$floor_row['id']."' order by id ASC",$db);
		while($floor_rowm=DB_fetch_array($floor_sqlm))
		{
			$floor_sqlt=DB_query("Select * from item_master where StockID='".$floor_rowm['item_code']."'",$db);
			$floor_rowt=DB_fetch_array($floor_sqlt);
		
			$mitm_sql1=DB_query("Select sum(A.issueqty) AS isum from issueqty AS A RIGHT JOIN addissue AS B ON B.id=A.issue_id where A.mst_itemid='".$floor_rowt['id']."' and B.issue_reg_no='".$floor_row['id']."'",$db);
			$mitm_row1=DB_fetch_array($mitm_sql1);
			if($mitm_row1['isum']==''){$mitm_row1['isum']=0;}
			if($mitm_row1['isum']<$floor_rowm['total_req_qty']){
				$mm=0;
			}
		}
	if($mm==0){	
	$data2.="<option value=".$floor_row['id'].">".$floor_row['mat_slip_no']."</option>";
	}
	}	

    $data2.="</select>";
	
	echo $data=$data1."__".$data2;
			
			
			
