==x byMD =".$byMD."
"; if($type_ref!=""){ $wheis.=" AND j.type_ref='".mysql_real_escape_string($type_ref)."' "; } if($emp_code!="" and $emp_code!="all"){ $wheis.=" AND jt.emp_code='".mysql_real_escape_string($emp_code)."' "; } if(strlen($job_start)==8 and strlen($job_end)==8){ //$wheis.=" AND j.job_start BETWEEN '".mysql_real_escape_string($job_start)."' AND '".mysql_real_escape_string($job_end)."' "; $wheis.=" AND (j.job_start <= '".mysql_real_escape_string($job_end)."' and j.job_end >= '".mysql_real_escape_string($job_start)."') "; // update 2014-04-28 }else if(strlen($job_start)==0 and strlen($job_end)==8){ $wheis.=" AND j.job_end <= ".$job_end ; }else if(strlen($job_start)==8 and strlen($job_end)==0){ $wheis.=" AND j.job_start >= ".$job_start ; }else{ } $wHord=''; if($ordby!="" and $ordby!="job_name"){ $wHord= $ordby." , "; } $sqlData2="SELECT pp.* , j.*,jt.emp_code,jt.job_postion FROM job j LEFT JOIN job_temp jt ON ( j.job_code = jt.job_code ) LEFT JOIN job_plan_status pp ON ( j.job_code = pp.job_code ) WHERE j.type_ref='plan' AND pp.yearBudget='".mysql_real_escape_string($yearB)."' ".$wheis." ORDER BY ".$wHord." job_name, job_postion "; //$sqlData2="SELECT pp.byMD, pp.emp_group, pp.* , j.*,jt.emp_code,jt.job_postion FROM job j LEFT JOIN job_temp jt ON ( j.job_code = jt.job_code ) LEFT JOIN job_plan_status pp ON ( j.job_code = pp.job_code ) WHERE j.type_ref='plan' ".$wheis." ORDER BY ".$wHord." job_name, job_postion "; //echo "==>".$sqlData2; $rsData=mysql_query($sqlData2); if($rsData){ $rowh=''; $i=0; $totalBD=0; $totalBDbyMD=0; $total_spendAllow=0; $countStAcp=0; $countStDo=0; $countStCa=0; while($rowD=mysql_fetch_assoc($rsData) ){ if($rowh!=$rowD['job_code']) { $i++; $k=0; $Ljob_code[$i]=trim($rowD['job_code']); $LbyMD[$i]=trim($rowD['byMD']); $Lfile_ref[$i]= (is_file("../hobby/".trim($rowD['file_ref'])) ? ' ' : ' '); $Ljob_name[$i]=htmlspecialchars(trim(stripslashes($rowD['job_name']))) ; $Ltype_ref[$i]=htmlspecialchars(trim(stripslashes($arrJobType2[$rowD['type_ref']]))); $Ltype_name[$i]=htmlspecialchars(trim(stripslashes($rowD['type_name']))); $Ltype_endowment[$i]=htmlspecialchars(trim(stripslashes($rowD['type_endowment']))); $Ljob_owner[$i]=htmlspecialchars(trim(stripslashes($rowD['job_owner']))); $Lclient[$i]=htmlspecialchars(trim(stripslashes($rowD['client']))); $Ljob_start[$i]=trim($rowD['job_start']); $Ljob_end[$i]=trim($rowD['job_end']); $Lallowance_spend[$i]= is_numeric(trim($rowD['allowance_spend'])) ? number_format(trim($rowD['allowance_spend'])) : trim($rowD['allowance_spend']); $total_spendAllow=$total_spendAllow+(float)trim($rowD['allowance_spend']); $totalBD=$totalBD+(float)trim($rowD['allowance']); $totalBDbyMD=$totalBDbyMD+(float)trim($rowD['budget']); //$LdesplanSeries[$i]=trim($rowD['planSeries']);"[".trim($rowD['planSeries'])."]".substr(trim($rowD['planSeries']),0,1).":". $LdesplanSeries[$i] = $getDes1[$yearB][substr(trim($rowD['planSeries']),0,1)."0000"]."
".$getDes1[$yearB][substr(trim($rowD['planSeries']),0,2)."000"]; $LplanSeries[$i] =trim($rowD['planSeries']); $Lbudget[$i] = is_numeric(trim($rowD['budget'])) ? number_format(trim($rowD['budget'])) : trim($rowD['budget']); if(preg_match("/".iconv("utf-8", "tis-620","อนุมัติ")."/",trim($rowD['statusProject']) )==true){ $tcss[$i]="green"; $countStAcp++; }else if(preg_match("/".iconv("utf-8", "tis-620","ยกเลิก")."/",trim($rowD['statusProject']) )==true){ $tcss[$i]="red"; $countStCa++; }else{ $countStDo++; } $LstatusProject[$i] =htmlspecialchars(trim(stripslashes($rowD['statusProject']))); $LpiorProject[$i] =htmlspecialchars(trim(stripslashes($rowD['piorProject']))); $LcomentP[$i] =htmlspecialchars(trim(stripslashes($rowD['comentP']))); $Lallowance[$i]= is_numeric(trim($rowD['allowance'])) ? number_format(trim($rowD['allowance'])) : trim($rowD['allowance']); $Lother[$i]=htmlspecialchars(trim(stripslashes($rowD['other']))); $Ljob_status[$i]=($rowD['job_status']!="y"? "รอข้อมูลเพิ่ม" : ""); $Lupdate_date[$i]=$rowD['update_date'] ; $dx=explode("x",$rowD['emp_group']); $dxx=''; for($s=1;$s<=count($dx);$s++){ if(trim($dx[$s])!=""){ $dxx.=" # ".$gGID[$dx[$s]]."  "; } } //end for $LGID[$i]=$dxx; }// end if $k++; $Ljob_postion[$i][$k]=trim($rowD['job_postion'])=='head' ? iconv("utf-8", "tis-620","(หัวหน้าโครงการ)") : '' ; $Lemp_code[$i][$k]=trim($rowD['emp_code']); $rowh=$rowD['job_code']; } mysql_free_result($rsData); echo '
'.iconv("utf-8", "tis-620"," สรุปจำนวนโครงการ ").''.$gGID[$emp_group].(trim($byMD)!="" ? iconv("utf-8", "tis-620"," รองฯ ").trim($byMD) : "")."   : ".$Nameis[$emp_code].'
'.iconv("utf-8", "tis-620"," รวมโครงการทั้งหมด ".$i." โครงการ ( แยกเป็นโครงการที่ดำเนินการ ".$countStDo." โครงการ      โครงการที่ได้รับการอนุมัติแล้วแต่ยังไม่ได้ดำเนินการ ".$countStAcp." โครงการ และ โครงการที่ยกเลิก ".$countStCa." โครงการ
เป็น)เงินที่ขอใช้ ".number_format($totalBD)." บาท จำนวนเงินที่อนุมัติ ".number_format($totalBDbyMD)." บาท และใช้ไปแล้วทั้งสิ้น ".number_format($total_spendAllow)." บาท- ".(date('Y-M, d H:i:s'))).'
'; echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; for($i=1;$i<=count($Ljob_code);$i++){ //LIstData1 echo ' '; echo ' '; echo ' '; echo ' ';//('.$LdesplanSeries[$i].') echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; }// end //LIstData1 if( count($Ljob_code)==0){ echo ' '; echo ' '; echo ' '; } echo '
# : '.iconv("utf-8", "tis-620","สถานะ").''.iconv("utf-8", "tis-620","ยุทธศาสตร์").''.iconv("utf-8", "tis-620","ชื่อโครงการ").''.iconv("utf-8", "tis-620","รองฯ").''.iconv("utf-8", "tis-620","ผู้รับผิดชอบโครงการ").''.iconv("utf-8", "tis-620","หลักสูตร").''.iconv("utf-8", "tis-620","งบที่ขอใช้").''.iconv("utf-8", "tis-620","งบอนุมัติ").''.iconv("utf-8", "tis-620","ใช้ไป").''.iconv("utf-8", "tis-620","วันที่เริ่มทำโครงการ").''.iconv("utf-8", "tis-620","หมายเหตุ").'
'.$i.' - '.$LstatusProject[$i].''.$LdesplanSeries[$i].''.$Ljob_name[$i].$Lfile_ref[$i].' '.$LbyMD[$i].''; if( count($Lemp_code[$i])>0){ for($k=1;$k<=count($Lemp_code[$i]);$k++) { if($k!=1){ echo ", "; } echo $Nameis[$Lemp_code[$i][$k]]." ".$Ljob_postion[$i][$k]." "; }// end for k if($emp_code!="" and $emp_code!="all"){ echo getMemberProject($Ljob_code[$i], $emp_code); } } // end if echo ' '. ($LGID[$i]).''. ($Lallowance[$i]).''. ($Lbudget[$i]).''.$Lallowance_spend[$i].''.date_thai($Ljob_start[$i]).'-'.date_thai($Ljob_end[$i]).''.$LpiorProject[$i].$LcomentP[$i].'
'.iconv("utf-8", "tis-620","(ขออภัยไม่พบข้อมูลที่ท่านต้องการ) ").'
'; } //if($rsData) //mysql_free_result($rsData); // Missing Where emp code and by values for query ?>