Viewing file: clsCorrespondenceLetter.php (7.02 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //--Class correspondenceletter-------------------------- //--PK of correspondenceletter :: // 1. cd_Letter_ID include_once "../link/keyThai.php"; class correspondenceletter extends clsDB{
var $result;
var $cd_Letter_ID; var $cd_Process_Id; var $cd_Process_Time; var $cd_ID; var $cd_Date; var $cd_Subject; var $cd_Secret; var $cd_Speed; var $cd_Sender_Firstname; var $cd_Sender_Lastname; var $cd_Sender_Jobtittle; var $cd_Sender_Department; var $cd_Sender_Ministry; var $cd_Receiver_Firstname; var $cd_Receiver_Lastname; var $cd_Receiver_Jobtittle; var $cd_Receiver_Department; var $cd_Receiver_Ministry; var $cd_Description; var $cd_SendDate; var $cd_Attachment; var $cd_Status; var $cd_receive; var $cd_receiveDlcID; var $cd_receivedate; var $cd_RsID; var $cd_DocID;
function correspondenceletter(&$c){ $this->c=$c->c; $this->DB=$c->db; }
function Save(){ if ($this->status==1){ //uncomment a line below if your table use ID as running number //$this->DtID=$this->GetNextCode(); $sql = "insert into correspondenceletter values( '".$this->cd_Letter_ID."', '".$this->cd_Process_Id."', '".$this->cd_Process_Time."', '".$this->cd_ID."', '".$this->cd_Date."', '".$this->cd_Subject."', '".$this->cd_Secret."', '".$this->cd_Speed."', '".$this->cd_Sender_Firstname."', '".$this->cd_Sender_Lastname."', '".$this->cd_Sender_Jobtittle."', '".$this->cd_Sender_Department."', '".$this->cd_Sender_Ministry."', '".$this->cd_Receiver_Firstname."', '".$this->cd_Receiver_Lastname."', '".$this->cd_Receiver_Jobtittle."', '".$this->cd_Receiver_Department."', '".$this->cd_Receiver_Ministry."', '".$this->cd_Description."', '".$this->cd_SendDate."', '".$this->cd_Attachment."', '".$this->cd_Status."', '".$this->cd_receive."', '".$this->cd_receiveDlcID."', '".$this->cd_receivePersonId."', '".$this->cd_receivedate."', '".$this->cd_RsID."', '".$this->cd_DocID."' )"; //temporary case mysql_query("SET NAMES 'tis620'"); return $this->Dml(iconv('UTF-8','TIS-620',$sql)); }else { $sql = "update correspondenceletter set cd_Process_Id='".$this->cd_Process_Id."', cd_Process_Time='".$this->cd_Process_Time."', cd_ID='".$this->cd_ID."', cd_Date='".$this->cd_Date."', cd_Subject='".$this->cd_Subject."', cd_Secret='".$this->cd_Secret."', cd_Speed='".$this->cd_Speed."', cd_Sender_Firstname='".$this->cd_Sender_Firstname."', cd_Sender_Lastname='".$this->cd_Sender_Lastname."', cd_Sender_Jobtittle='".$this->cd_Sender_Jobtittle."', cd_Sender_Department='".$this->cd_Sender_Department."', cd_Sender_Ministry='".$this->cd_Sender_Ministry."', cd_Receiver_Firstname='".$this->cd_Receiver_Firstname."', cd_Receiver_Lastname='".$this->cd_Receiver_Lastname."', cd_Receiver_Jobtittle='".$this->cd_Receiver_Jobtittle."', cd_Receiver_Department='".$this->cd_Receiver_Department."', cd_Receiver_Ministry='".$this->cd_Receiver_Ministry."', cd_Description='".$this->cd_Description."', cd_SendDate='".$this->cd_SendDate."', cd_Attachment='".$this->cd_Attachment."', cd_Status='".$this->cd_Status."', cd_receive='".$this->cd_receive."', cd_receiveDlcID='".$this->cd_receiveDlcID."', cd_receivePersonId='".$this->cd_receivePersonId."', cd_receivedate='".$this->cd_receivedate."', cd_RsID='".$this->cd_RsID."', cd_DocID='".$this->cd_DocID."' where cd_Letter_ID='".$this->cd_Letter_ID."'"; return $this->Dml($sql); } }
function Delete(){ return $this->Dml("delete from correspondenceletter where cd_Letter_ID='$this->cd_Letter_ID'"); }
function GetNextCode(){ $this->SetQuery("select max(cd_Letter_ID) as num from correspondenceletter"); if ($result=$this->GetResult()) { return $result['num']+1; } }
function RSdoctype(){ $this->SetQuery("select * from correspondenceletter order by cd_Letter_ID asc"); }
function GetRecord(){ $numFields = $this->NumField(); $row = $this->GetResult(); if ($row){ for ($i=0; $i<$numFields; $i++){ eval("\$this->".mysql_field_name($this->rs, $i)."=\$row['".mysql_field_name($this->rs, $i)."'];"); } return true; }else{ // clear value of Member; for ($i=0; $i<$numFields; $i++){ eval("\$this->".mysql_field_name($this->rs, $i)."='';"); } return false; } } function SearchByKey($xKey){
if ($this->SetQuery("select * from correspondenceletter where cd_Letter_ID= '$xKey'")){ return 1; }else { return 0; } }
//****************** You can add new functions below **********************// function checkCorrespondenceletterReceive($xKey,$yKey){ $this->SetQuery("select count(cd_Process_Id) as num from correspondenceletter where cd_Letter_ID='$xKey' and cd_Process_Id='$yKey'"); if ($result=$this->GetResult()) { return $result['num']; } } function SearchCorrespondenceletterReceive($xKey,$yKey){ if ($this->SetQuery("select * from correspondenceletter where cd_Letter_ID='$xKey' and cd_Process_Id='$yKey'")){ return 1; }else { return 0; } } function SearchBycd_Status(){ if ($this->SetQuery("select cd_Letter_ID,cd_ID,cd_Date,cd_Secret,cd_Speed,cd_Sender_Firstname,cd_Sender_Lastname,cd_Sender_Jobtittle,cd_Subject from correspondenceletter where cd_receive='' and cd_RsID=1")){ return 1; }else { return 0; } } function SearchBycd_StatusSend(){ if ($this->SetQuery("select b.dm_department, a.cd_Letter_ID,a.cd_ID,a.cd_Date,a.cd_Secret,a.cd_Speed,a.cd_Sender_Firstname,a.cd_Sender_Lastname,a.cd_Sender_Jobtittle,a.cd_Subject from correspondenceletter a join correspondenceletter_department b on a.cd_RsID=2 and b.dm_ID=a.cd_Receiver_Department")){ return 1; }else { return 0; } }
/* function RSdoctypeDtP(){ $this->SetQuery("select * from DocType where DtP!='1' order by DtID asc"); } function RSdoctypeDtRunAll(){ $this->SetQuery("select * from DocType where DtRunAll='Y' order by DtID asc"); } function RSdoctypeDtNoRunAll(){ $this->SetQuery("select * from DocType where DtRunAll='N' order by DtID asc"); } function RSdoctypeDtAll(){ $this->SetQuery("select * from DocType order by DtID asc"); } function RSdoctypeDtAllNoforRegisY(){ $this->SetQuery("select * from DocType where forRegis!='Y' and DtP!=1 order by DtID asc"); } function SearchRepRegisDoc(){ if ($this->SetQuery("select * from DocType where forRegis='Y'")){ return 1; }else { return 0; } } function SearchRepReceiveDoc(){ if ($this->SetQuery("select * from DocType where DtP='0' and DtRunAll='Y' and forRegis!='Y'")){ return 1; }else { return 0; } } function SearchRepReceiveDocName(){ if ($this->SetQuery("select DtID,DtName from DocType where DtP='0' and DtRunAll='Y' and forRegis!='Y'")){ return 1; }else { return 0; } } function SearchRepRegisDocName(){ if ($this->SetQuery("select DtID,DtName from DocType where forRegis='Y'")){ return 1; }else { return 0; } } function RSdoctypeDtNoRunAllName(){ $this->SetQuery("select DtID,DtName from DocType where DtRunAll='N' order by DtID asc"); } function GetDtNameByDtID($DtID){ $this->SetQuery("select DtName as num from DocType where DtID='$DtID'"); if ($result=$this->GetResult()) { return $result['num']; } } */ } //--End class DocType--
?>
|