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

DB_query("insert into setup_groupmaster(group_code,group_name,created_by,created_date,CompanyId) values('".$_REQUEST['group_code']."','".$_REQUEST['group_name']."','".$_SESSION['UserID']."','".date('Y-m-d')."','".$_SESSION['ACGCompanyId']."' )",$db);
$last=DB_Last_Insert_ID($db, 'setup_groupmaster', 'id');
$sql=DB_query("select * from setup_groupmaster where CompanyId='".$_SESSION['ACGCompanyId']."' ",$db);
$data='<option>Select</option>';
while($res=DB_fetch_assoc($sql))
{
    if($last==$res['id']){
    $data.='<option value="'.$res['id'].'" selected>'.$res['group_name'].'</option>';
    }else{
        $data.='<option value="'.$res['id'].'">'.$res['group_name'].'</option>';
    }
}
echo $data;
?>


