Viewing file: clsSendNewDocSR.php (4.72 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //--Class sendnewdocsr-------------------------- //--PK of sendnewdocsr :: // 1. tsr_id
include_once "../link/keyThai.php"; class sendnewdocsr extends clsDB{
var $result;
var $sn_id; var $sn_fr_node; var $sn_fr_node_date; var $sn_to_node; var $sn_to_node_date; var $sn_doc_url; var $sn_docname; var $sn_doc_chksum; var $sn_tsr_id_send; var $sn_status; var $sn_id_send; var $sn_receive; var $sn_receivedate;
function sendnewdocsr(&$c){ $this->c=$c->c; $this->DB=$c->db; }
function Save(){
if($this->sn_fr_node_date==''){ $this->sn_fr_node_date='0000-00-00 00:00:00'; } if($this->sn_to_node_date==''){ $this->sn_to_node_date='0000-00-00 00:00:00'; } if($this->sn_receivedate==''){ $this->sn_receivedate='0000-00-00 00:00:00'; }
if ($this->status==1){ $sql = "insert into sendnewdocsr values( '".th2a($this->sn_id)."', '".th2a($this->sn_fr_node)."', '".th2a($this->sn_fr_node_date)."', '".th2a($this->sn_to_node)."', '".th2a($this->sn_to_node_date)."', '".th2a($this->sn_doc_url)."', '".th2a($this->sn_docname)."', '".th2a($this->sn_doc_chksum)."', '".th2a($this->sn_tsr_id_send)."', '".th2a($this->sn_status)."', '".th2a($this->sn_id_send)."', '".th2a($this->sn_receive)."', '".th2a($this->sn_receivedate)."' )"; }else { $sql = "update sendnewdocsr set sn_fr_node='".th2a($this->sn_fr_node)."', sn_fr_node_date='".th2a($this->sn_fr_node_date)."', sn_to_node='".th2a($this->sn_to_node)."', sn_to_node_date='".th2a($this->sn_to_node_date)."', sn_doc_url='".th2a($this->sn_doc_url)."', sn_docname='".th2a($this->sn_docname)."', sn_doc_chksum='".th2a($this->sn_doc_chksum)."', sn_tsr_id_send='".th2a($this->sn_tsr_id_send)."', sn_status='".th2a($this->sn_status)."', sn_id_send='".th2a($this->sn_id_send)."', sn_receive='".th2a($this->sn_receive)."', sn_receivedate='".th2a($this->sn_receivedate)."' where sn_id='".th2a($this->sn_id)."'"; } return $this->Dml($sql); }
function Delete(){ $sql = "delete from sendnewdocsr where sn_id='$this->sn_id'"; if ($this->conn->Execute($sql)){ return true; }else{ $this->errNo=$this->conn->errNo; $this->errDesc=$this->conn->errDesc; return false; } } 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 GetNextCode(){ $this->SetQuery("select max(sn_id) as num from sendnewdocsr"); if ($result=$this->GetResult()) { return $result['num']+1; } }
function RSsendreceive(){ $this->SetQuery("select * from sendnewdocsr order by sn_to_node_date"); }
function SearchByKey($key){ if ($this->SetQuery("select * from sendnewdocsr where sn_id='$key'")){ return 1; }else { return 0; } }
//*************************************************************************** //****************** You can add new methods below********************************* //***************************************************************************
function SearchBysn_tsr_id_send($key){ if ($this->SetQuery("select * from sendnewdocsr where sn_tsr_id_send='$key'")){ return 1; }else { return 0; } } function SearchDocStatusNoReceive($xKey,$bKey){ if ($this->SetQuery("select * from sendnewdocsr where sn_to_node='$xKey' and sn_status!='$bKey' order by sn_to_node_date desc")){ return 1; }else { return 0; } } function SearchCountDocStatusNoReceive($xKey,$bKey){ $this->SetQuery("select count(sn_id) as num from sendnewdocsr where sn_to_node='$xKey' and sn_status='$bKey' order by sn_to_node_date desc"); if ($result=$this->GetResult()) { return $result['num']; } } function SearchDocStatusGetReceive($xKey,$bKey,$start,$pageSize,$searchYear,$monthe){ //echo "select * from sendnewdocsr where sn_to_node='$xKey' and sn_status='$bKey' and sn_fr_node_date like '$searchYear-$monthe-%' order by sn_to_node_date desc limit $start, $pageSize"; if ($this->SetQuery("select * from sendnewdocsr where sn_to_node='$xKey' and sn_status='$bKey' and sn_fr_node_date like '$searchYear-$monthe-%' order by sn_to_node_date desc limit $start, $pageSize")){ return 1; }else { return 0; } } function SearchBysn_status($key){ if ($this->SetQuery("select * from sendnewdocsr where sn_status = '$key' order by sn_to_node_date")){ return 1; }else { return 0; } } function SearchBysn_id_send_sn_fr_node($key,$yKey){ if ($this->SetQuery("select * from sendnewdocsr where sn_id_send ='$key' and sn_fr_node='$yKey'")){ return 1; }else { return 0; } } } //--End class sendreceive--
?>
|