<?php 
function getSelectBox_menulist($db, $SelName, $jrequired,$Attr,$selId=null) {		
	$StrQry="select MenuId AS Id,MenuName AS Name from a_menus where IsActive = '1' order by MenuName asc";		
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$jrequired."' id='".$SelName."' name='".$SelName."'  ".$Attr." ><option value=''>Select</option>";
	
	if(!empty($resQry)) {
		foreach($resQry as $val) {
		$sel='';
			if($selId==$val['Id'])
				$sel=' selected="selected" ';
			$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
		}
	}
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}


function getSelectBox_rolelist($db, $SelName, $Attr,$selId=null) {
	$StrQry="select RoleId AS Id,RoleName AS Name from a_roles where IsActive = '1' and RoleId <> 1 order by RoleName asc";	
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$Attr."' id='".$SelName."' name='".$SelName."' ><option value=''>Select</option>";
	
	if(!empty($resQry)) {
		foreach($resQry as $val) {
		$sel='';
			if($selId==$val['Id'])
				$sel=' selected="selected" ';
			$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
		}
	}
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}


function getSelectBox_companylist($db, $SelName, $Attr,$selId=null,$prop=null) {
	$StrQry="select company_id AS Id,company_name AS Name from m_company where IsActive = '1' order by company_name asc";
	
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$Attr."' id='".$SelName."' name='".$SelName."' ".$prop." ><option value=''>Select Company</option>";
	
	if(!empty($resQry)) {
		foreach($resQry as $val) {
		$sel='';
			if($selId==$val['Id'])
				$sel=' selected="selected" ';
			$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
		}
		
	}
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}



function getSelectBoxFinancialYearlist($db, $SelName, $Attr,$selId=null,$prop=null) {
	$StrQry="select financial_id AS Id,concat(year(f_start_date),' - ',year(f_end_date)) AS Name from m_financial_year order by IsActive desc,f_end_date desc ";
	
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$Attr."' id='".$SelName."' name='".$SelName."' ".$prop." ><option value=''>Select Financial Year</option>";
	
	if(!empty($resQry)) {
		$ind=0;
		foreach($resQry as $val) {
		$sel='';
			if($selId==$val['Id'])
				$sel=' selected="selected" ';
			else if($selId==null && $ind==0)
				$sel=' selected="selected" ';
			$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
			$ind++;
		}
		
	}
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}


function getSelectStockAvailbilitylist($db, $SelName, $Attr,$selId=null,$prop=null) {
		
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$Attr."' id='".$SelName."' name='".$SelName."' ".$prop." ><option value=''>All</option>";
	
	$strSelHtml=$strSelHtml."<option value='Sold'>Sold</option>";
	$strSelHtml=$strSelHtml."<option value='Available'>Available</option>";
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}


function getSelectBox_supplierlist($db, $SelName, $Attr,$selId=null,$prop=null) {
	$StrQry="select sup_id AS Id,sup_name AS Name from m_supplier where IsActive = '1' order by sup_name asc";
	
	$resQry = $db->get_rsltset($StrQry);		
	$strSelHtml =  "<select class='form-control select2 ".$Attr."' id='".$SelName."' name='".$SelName."' ".$prop." ><option value=''>Select Supplier</option>";
	
	if(!empty($resQry)) {
		foreach($resQry as $val) {
		$sel='';
			if($selId==$val['Id'])
				$sel=' selected="selected" ';
			$strSelHtml=$strSelHtml."<option value=".$val['Id']." ".$sel.">".$val['Name']."</option>";
		}
		
	}
	
	$strSelHtml=$strSelHtml."</select>";
	
	return $strSelHtml;	
}

?>