Viewing file: clsCorrespondenceLetter_Mainletter.php (3.89 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //--Class correspondenceletter_mainletter-------------------------- //--PK of correspondenceletter_mainletter :: // 1. cdm_ID include_once "../link/keyThai.php"; class correspondenceletter_mainletter extends clsDB{
var $result;
var $cdm_ID; var $cdm_Letter_ID; var $cdm_MimeType; var $cdm_uploadFileName;
function correspondenceletter_mainletter(&$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_mainletter values( '".$this->cdm_ID."', '".$this->cdm_Letter_ID."', '".$this->cdm_MimeType."', '".$this->cdm_uploadFileName."' )"; }else { $sql = "update correspondenceletter_mainletter set cdm_Letter_ID='".$this->cdm_Letter_ID."', cdm_MimeType='".$this->cdm_MimeType."', cdm_uploadFileName='".$this->cdm_uploadFileName."' where cdm_ID='".$this->cdm_ID."'"; } return $this->Dml($sql); }
function Delete(){ return $this->Dml("delete from correspondenceletter_mainletter where cdm_ID='$this->cdm_ID'"); }
function GetNextCode(){ $this->SetQuery("select max(cdm_ID) as num from correspondenceletter_mainletter"); if ($result=$this->GetResult()) { return $result['num']+1; } }
function RSdoctype(){ $this->SetQuery("select * from correspondenceletter_mainletter order by cdm_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_mainletter where cdm_ID= '$xKey'")){ return 1; }else { return 0; } } //****************** You can add new functions below **********************// function SearchBycdm_Letter_ID($xKey){ if ($this->SetQuery("select * from correspondenceletter_mainletter where cdm_Letter_ID= '$xKey' ")){ return 1; }else { return 0; } } function CountDocBycdm_Letter_ID($xKey){ $this->SetQuery("select count(cdm_ID) as num from correspondenceletter_mainletter where cdm_Letter_ID='$xKey'"); if ($result=$this->GetResult()) { return $result['num']; } } /* 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--
?>
|