Viewing file: clsEsa_HoldProject.php (2.89 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class HoldProject extends clsDB{
var $result;
var $holdid;
var $defineid;
var $pjId;
function HoldProject(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function GetNextCode(){
//--หาค่าสูงสุดของฟิลด์ที่ใช้เป็นคีย์ของตาราง ในลักษณะ auto increment
//--ต้องเป็นฟิลด์ชนิดตัวเลขจำนวนเต็มเท่านั้น และไม่ได้กำหนดรหัสเองทางจอภาพ
$this->SetQuery("select max(holdid) as num from ea_HoldProject");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function Save(){
//--ข้อมูลในอ๊อบเจ๊กเป็นข้อมูลใหม่หรือข้อมูลเดิม --1:ข้อมูลใหม่ 2:ข้อมูลเดิม
if ($this->status==1){
//uncomment a line below if your table use ID as running number
$this->holdid=$this->GetNextCode();
$sql = "insert into ea_HoldProject values(
'$this->holdid',
'$this->defineid',
'$this->pjId'
)";
}else {
$sql = "update ea_HoldProject set
defineid='$this->defineid',
pjId='$this->pjId'
where holdid='$this->holdid'";
}
return $this->Dml($sql);
}
function RSHoldProject(){
$this->SetQuery("select * from ea_HoldProject order by holdid");
}
function RSByDefineid($id){
$this->SetQuery("select * from ea_HoldProject where defineid = '$id' order by holdid");
}
function RSByDefineidPj($id,$id2){
$this->SetQuery("select *
from ea_HoldProject
where defineid = '$id'
and pjId = '$id2'
order by pjId");
}
function RSByPj($id){
$this->SetQuery("select *
from ea_HoldProject
where pjId = '$id'
order by defineid,pjId");
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->holdid = $this->result['holdid'];
$this->defineid = $this->result['defineid'];
$this->pjId = $this->result['pjId'];
return 1;
}else {
return 0;
}
}
function DeleteByDefineid(){
return $this->Dml("delete from ea_HoldProject where defineid='$this->defineid'");
}
function chkDoPj($defineid,$stdid){
$sql = "select hpj.defineid,hpj.pjId,doPjid
from ea_HoldProject hpj
inner join ea_SaMember mb on pjId = mb_mpj_id OR pjId = mb_acp_id
left outer join ea_DoProject dp
on hpj.defineid = dp.defineid
and hpj.pjId = dp.pjId
and mb_std_id = dp.stdId
where hpj.defineid = $defineid
and mb_std_id = $stdid";
$this->SetQuery($sql);
return 1;
}
}
?>
|