logincheck()) //header("Location:index.php"); $cdpid=$_REQUEST['id']; $uid = $_SESSION['user_id']; $from=$_SESSION['deid']; $page=$_SESSION['page_ss']; $by=$_GET['by']; $order=$_GET['order']; $nfl=0; if($_GET['serch']==true||$_GET['type']=="approve") $nfl=1; $sql_id = $conn->execute($dbconn,"select * from coa_cdp where cdp_id='$cdpid'"); $sql_id1 = $conn->fetch_array($sql_id); $cdp_name=$sql_id1[cdp_name]; $dp_prj_manager=$sql_id1[cdp_prj_manager]; $cdp_description=$sql_id1[cdp_description]; $cdp_programname=$sql_id1[cdp_programname]; $cdp_projecttype=$sql_id1[cdp_prj_type_id]; $dep_id=$sql_id1[dep_id]; $cdp_status=$sql_id1[cdp_status]; $cdp_update=$sql_id1[cdp_update]; $cdp_ordinance_date=$sql_id1[cdp_ordinance_date]; $cdp_capital_program=$sql_id1[cdp_capital_program]; if($cdp_ordinance_date!=0) $ordinance_date = $cdp_ordinance_date; if($cdp_update!=0) $update_date = formatdate($cdp_update); $prj_type=$conn->execute($dbconn,"select prj_type from coa_project_types where prj_type_id='$cdp_projecttype'"); $sql_id22 = $conn->fetch_array($prj_type); $prj_type_name=$sql_id22[prj_type]; $dep=$conn->execute($dbconn,"select dep_name from coa_departments where dep_id='$dep_id'"); $sql_id2 = $conn->fetch_array($dep); $dep_name=$sql_id2[dep_name]; $cdp_prj_sponsor=$sql_id1[cdp_prj_sponsor]; $cdp_bureau=$sql_id1[cdp_bureau]; $cdp_area=$sql_id1[cdp_area]; $cdp_councildistrict=$sql_id1[cdp_councildistrict]; $cdp_npu=$sql_id1[cdp_npu]; $cdplegislation=$sql_id1[cdp_legislation]; $cdp_initiationyear=$sql_id1[cdp_initiationyear]; $cdp_completionyear=$sql_id1[cdp_completionyear]; $cdp_fundingsource=$sql_id1[cdp_fundingsource]; $cdp_costofestimate=$sql_id1[cdp_costofestimate]; $cdp_ordinancenumber=$sql_id1[cdp_ordinancenumber]; $cdp_start_date=$sql_id1[cdp_start_date]; if($cdp_start_date!=0) $cdp_start_date = formatdate($cdp_start_date); $cdp_end_date=$sql_id1[cdp_end_date]; if($cdp_end_date!=0) $cdp_end_date = formatdate($cdp_end_date); $cdp_source=$sql_id1[cdp_source]; $prj_priority=$sql_id1[cdp_priority]; $cdp_state=$sql_id1[cdp_state]; $cdp_justification=$sql_id1[cdp_justification]; $cdp_priority=$sql_id1[cdp_priority]; $squery="select plan_id, name from coa_cdp_studies ccs JOIN coa_studies cs on ccs.study_id=cs.plan_id and ccs.cdp_id='$cdpid'"; $cdp_cip=$conn->execute($dbconn,"SELECT prj_id FROM coa_cdp_cip where cdp_id='$cdpid' "); while ($sql_cdp_cip = $conn->fetch_array($cdp_cip)) { $value=$sql_cdp_cip[prj_id]; $cdp_ids=$conn->execute($dbconn,"SELECT cdp_start_date FROM coa_cdp where cdp_id='$value'"); //$start_date = $conn->fetch_array($cdp_ids); //$str_dt=substr($start_date[cdp_start_date], 2, 2); $href=""; if ($prj_cdp_cip=="") $prj_cdp_cip=$href."CIP #".$sql_cdp_cip[prj_id].""; else $prj_cdp_cip=$prj_cdp_cip.",".$href." CDP #".$sql_cdp_cip[prj_id].""; } // error mesage handling $request=$_REQUEST['msg']; if($request=='suc') // requst for approval by user $msg="Your request is successfully posted"; else if($request=='snd') // sending reminder - user $msg="Your Reminder has been sent successfully"; else if ($request=='rej') // reject project - admin $msg="Selected project is successfully rejected"; $request=$_REQUEST['add']; // project added from user side if($request=='suc') $msg="New project is successfully added"; //to enable and disable send reminder button after every 2 days /* $sqlreq=$conn->execute($dbconn,"SELECT * FROM coa_cdp_requests WHERE cdp_id='$cdpid'"); $req=$conn->fetch_array($sqlreq); $reqst=$req['cdp_req_update']; $sql=$conn->execute($dbconn,"SELECT DATE_ADD('$reqst',INTERVAL 2 DAY) AS dt"); $sql=$conn->execute($dbconn,"SELECT cdp_req_update+2 AS dt from coa_cdp_requests "); $result_set=$conn->fetch_array($sql); $dateagg=$result_set['dt']; echo $dateagg; $reqst='2008-02-20'; $sqldate=$conn->execute($dbconn,"SELECT sysdate-cdp_req_update AS dat FROM coa_cdp_requests WHERE cdp_id='$cdpid'"); $sqldate=$conn->execute($dbconn,"SELECT DATEDIFF(CURRENT_DATE(),'$reqst') AS dat"); $result_date=$conn->fetch_array($sqldate); $dateres=$result_date['dat']; echo $dateres; */ //function to generate sql to find previous and next cdp function create_stmt($sby,$swith,$sorder,$sfrom,$direction) { global $dbconn; $conn = new mysql(); $frmstmt=""; if($sorder=="") $sorder="asc"; if($sby=="name") { $sby="a.cdp_name"; $k=0; } else if($sby=="type") { $sby="c.prj_type"; $k=1; } else if($sby=="dept") { $sby="d.dep_name"; $k=1; } else { $sby="a.cdp_name"; $k=0; } if($sby=="d.dep_name") $myvar=" left join coa_departments d on a.dep_id=d.dep_id "; else $myvar=""; if($sby=="c.prj_type") $myvar02=" left join COA_PROJECT_TYPES c on a.cdp_prj_type_id=c.prj_type_id "; else $myva02=""; $kby=$sby; $sby="upper(".$sby.")"; $stmt1="select * from ("; $whrstmt=" where a.cdp_id!=0"; if($sfrom!="") { $frmstmt=" and a.dep_id='$sfrom'"; } $fstmt="FROM coa_cdp a ".$myvar.$myvar02; $ordrstmt=" order by ".$sby." ".$sorder; if($k==1) { $ordrstmt.=",upper(a.cdp_name) ".$sorder; } $ordrstmt.=",a.cdp_id ".$sorder; $subqstmt="select a.cdp_id,ROW_NUMBER() OVER ( ".$ordrstmt.") ordernum ".$fstmt.$whrstmt.$frmstmt; $stmt=$stmt1.$subqstmt.") where cdp_id=$swith"; $sql_rowno = $conn->execute($dbconn,$stmt); $sql_rowno1 = $conn->fetch_array($sql_rowno); $rowno=$sql_rowno1[ordernum]; if($direction=="next") { $stmt=$stmt1.$subqstmt.") where ordernum=$rowno+1"; } if($direction=="prev") { $stmt=$stmt1.$subqstmt.") where ordernum=$rowno-1"; } return $stmt; } //building back page url if($nfl!=1)// 1 if coming from search results or approve list { $back_page="cdp_projects.php?page=".$page."&by=".$by."&order=".$order."&id=".$from; } else { $back_page="$_SERVER[HTTP_REFERER]"; } $cip_name_no=$cdpid; //$cip_name_no=strtoupper($cip_name_no); //$cip_name_no.=" ".$cdpid; //to get id of previous cdp $sstmt=create_stmt($by,$cip_name_no,$order,$from,"prev"); $sql_prev_id = $conn->execute($dbconn,$sstmt); $sql_prev_id1 = $conn->fetch_array($sql_prev_id); $prev_id=$sql_prev_id1[cdp_id]; //to get id of next cdp $sstmt=create_stmt($by,$cip_name_no,$order,$from,"next"); $sql_prev_id = $conn->execute($dbconn,$sstmt); $sql_prev_id1 = $conn->fetch_array($sql_prev_id); $next_id=$sql_prev_id1[cdp_id]; ?>
usercheck($cdpid,$uid)) { // security check?>
Approvals  
Back-to-list      
Updated: | Status:
Project Description
Project Justification
Department
Category
Program
Functional Area
Funding Source
Type
Responsible Party
Priority
Project State
Source Plan/Study execute($dbconn,$squery); $count=$conn->get_count($source); $source=$conn->execute($dbconn,$squery); $i=1; while($source1=$conn->fetch_array($source)) { echo "$source1[name]"; if($i<$count) echo " , "; $i++; } ?>
CIP Projects
Estimated Cost $
Council District
NPU(s)
Start Date
End Date
Ordinance # >
Ordinance Date
=2)){ ?> disabled="disabled" border="0"/>
Back-to-list