<?php session_name('CAKEPHP'); session_start();
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
$CompanyId =$_SESSION['ACGCompanyId'];
	
 	if($_REQUEST['action']=='setItemnameAuto')
		{
          $sql_query1 = DB_query("SELECT company_id FROM quotation_app_flag where company_id='".$CompanyId."'",$db);
          $row1=DB_fetch_array($sql_query1);
	 $item_name_auto = $_POST['quotation_app_auto']; 
	
		if($item_name_auto!='1'){
			$item_name_auto=0;
		}
		if($row1['company_id']!=''){
			
			$res = DB_query("update quotation_app_flag set quotation_flag ='$item_name_auto',modified_by='".$_SESSION['UserID']."',modified_date='".date('Y-m-d')."' where company_id ='$CompanyId'",$db);
			//$s->pageLocation("index.php?route=Setup/elementmanagement&modid=9&frmid=406");	
		}
		else{
			$sql ="insert into quotation_app_flag(company_id,quotation_flag,created_by,created_date) values('$CompanyId','$item_name_auto','".$_SESSION['UserID']."','".date('Y-m-d')."')";//exit;	
			$res = DB_query($sql,$db);
			
		}
	
  }
  
  if($CompanyId) {
	    $sql_query = "SELECT * FROM quotation_app_flag where company_id='".$CompanyId."'";
		$sqlQuery =DB_query($sql_query,$db);
		$row=DB_fetch_array($sqlQuery);
		
	}
  
  //<!-------DPARTMENT HEAD APPROVAL-----START HERE-----------------23-04-2013-------LOKESH--------------------------------->
 
  
   
 
?>
<link href="css/accountbook_css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<h1>Marketing Management</h1>
<form method="post" name="nz" id="frm">
<div id="container">
 <div id="tabs">
    <ul>
	<li><a href="index.php?route=Setup/marketingmanagement&modid=<?php echo $rurl; ?>&ApprovalType=GRNApproval&tabid=1">Quotation Approval</a></li>
	<!--<li><a href="index.php?route=Setup/elementmanagement&modid=<?php echo $rurl; ?>&ApprovalType=StoreHeadApproval&tabid=2">Required GRN Approval</a></li>-->
<!--	<li><a href="index.php?route=Setup/elementmanagement&modid=<?php echo $rurl; ?>&ApprovalType=PurchaseHeadApproval&tabid=3">Other Configuration</a></li>-->
	
	</ul>
<?php if(isset($_REQUEST['tabid'])) {?>

<!-------DPARTMENT HEAD APPROVAL-----START HERE-----------------23-04-2013-------AMITSINGH------------------------------->

<?php if($_REQUEST['tabid']==1){
  
?>
<input type="hidden" name="action" value="setItemnameAuto" />
<table width="98%" cellpadding="3" cellspacing="0" border="0">
<tr class="row1">
	<td class="tabledata1"><strong>Approval Required For Quotation </strong></td>
	<td><input type="checkbox" <?php if($row['quotation_flag']=="1"){ ?> checked="checked" <?php }?> value="1" name="quotation_app_auto" id="quotation_app_auto" onclick="checkupdate(this.value);"/></td>
</tr>

</table>

<?php 
}?>
</div>


<!--<?php if($_REQUEST['tabid']==2){ ?>


<?php } ?>-->



<!-------DPARTMENT HEAD APPROVAL-----END HERE-----------------23-04-2013-------AMITSINGH--------------------------------->


<!-------DPARTMENT HEAD APPROVAL-----START HERE-----------------23-04-2013-------AMITSINGH------------------------------->
<?php //if($_REQUEST['tabid']==3){}?>


<!-------DPARTMENT HEAD APPROVAL-----END HERE-----------------23-04-2013-------AMITSINGH--------------------------------->

<?php }else{?>
<table width="98%" cellpadding="3" cellspacing="0" border="0">
<tr class="row1">
	<td class="tabledata1">&nbsp;</td>
</tr>
</table>
<?php }?>
</div>

</form>
</div>
</div>
<script language="javascript" type="text/javascript">
function isNumberKey(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}
function checkupdate(str)
{
//alert('lokesh');
		if(document.getElementById("quotation_app_auto").value=='0'){
		document.getElementById("quotation_app_auto").value==1;
		//document.frm.getElementById("Excise_Duty_value").submit();
		}
		
	document.getElementById("frm").submit();
}

wewewe
</script>