Viewing file: clsSendReceive.php (22.82 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //--Class sendreceive-------------------------- //--PK of sendreceive :: // 1. tsr_id
include_once "../link/keyThai.php"; class sendreceive extends clsDB{
var $result;
var $tsr_id; var $tsr_fr_node; var $tsr_fr_node_date; var $tsr_to_node; var $tsr_to_node_date; var $tsr_docid; var $tsr_doc_url; var $tsr_doc_chksum; var $tsr_status; var $tsr_id_send; var $tsr_docgroup; var $tsr_DrsID; var $tsr_SendNew; var $tsr_DocSubject; var $tsr_DocNo; var $tsr_DocDate; var $tsr_DocFrom; var $tsr_DocTo; var $tsr_DocRef; var $tsr_DocOther; var $tsr_DslID; var $tsr_DclID; var $tsr_DocShortDesc; var $tsr_PtID; var $tsr_DlcID; var $tsr_personId; var $tsr_DtID; var $tsr_docname; var $tsr_receive; var $tsr_receivedate; var $tsr_DrsDocDueDate; var $tsr_statusDocAtt; var $tsr_DocTelOwner; var $tsr_DocSendReal; var $tsr_DocDeptOwner; var $tsr_DocFaxOwner; var $tsr_DocCopySend; var $tsr_DocContactE; var $tsr_CountDoc;
function sendreceive(&$c){ $this->c=$c->c; $this->DB=$c->db; }
function Save(){
if($this->tsr_fr_node_date==''){ $this->tsr_fr_node_date='0000-00-00 00:00:00'; } if($this->tsr_to_node_date==''){ $this->tsr_to_node_date='0000-00-00 00:00:00'; } if($this->tsr_SendNew==''){ $this->tsr_SendNew='0000-00-00 00:00:00'; } if($this->tsr_DocDate==''){ $this->tsr_DocDate='0000-00-00'; } if($this->tsr_receivedate=='0000-00-00 00:00:00'){ $YY = date('Y')+543; $this->tsr_receivedate=date("{$YY}-m-t G:i:s"); //$this->tsr_receivedate='0000-00-00 00:00:00'; } if($this->tsr_DrsDocDueDate==''){ $this->tsr_DrsDocDueDate='0000-00-00'; }
if ($this->status==1){ $sql = "insert into sendreceive values( '".th2a($this->tsr_id)."', '".th2a($this->tsr_fr_node)."', '".th2a($this->tsr_fr_node_date)."', '".th2a($this->tsr_to_node)."', '".th2a($this->tsr_to_node_date)."', '".th2a($this->tsr_docid)."', '".th2a($this->tsr_doc_url)."', '".th2a($this->tsr_doc_chksum)."', '".th2a($this->tsr_status)."', '".th2a($this->tsr_id_send)."', '".th2a($this->tsr_docgroup)."', '".th2a($this->tsr_DrsID)."', '".th2a($this->tsr_SendNew)."', '".th2a($this->tsr_DocSubject)."', '".th2a($this->tsr_DocNo)."', '".th2a($this->tsr_DocDate)."', '".th2a($this->tsr_DocFrom)."', '".th2a($this->tsr_DocTo)."', '".th2a($this->tsr_DocRef)."', '".th2a($this->tsr_DocOther)."', '".th2a($this->tsr_DslID)."', '".th2a($this->tsr_DclID)."', '".th2a($this->tsr_DocShortDesc)."', '".th2a($this->tsr_PtID)."', '".th2a($this->tsr_DlcID)."', '".th2a($this->tsr_personId)."', '".th2a($this->tsr_DtID)."', '".th2a($this->tsr_docname)."', '".th2a($this->tsr_receive)."', '".th2a($this->tsr_receivedate)."', '".th2a($this->tsr_DrsDocDueDate)."', '".th2a($this->tsr_statusDocAtt)."', '".th2a($this->tsr_DocTelOwner)."', '".th2a($this->tsr_DocSendReal)."', '".th2a($this->tsr_DocDeptOwner)."', '".th2a($this->tsr_DocFaxOwner)."', '".th2a($this->tsr_DocCopySend)."', '".th2a($this->tsr_DocContactE)."', '".th2a($this->tsr_CountDoc)."'
)"; }else { $sql = "update sendreceive set tsr_fr_node='".th2a($this->tsr_fr_node)."', tsr_fr_node_date='".th2a($this->tsr_fr_node_date)."', tsr_to_node='".th2a($this->tsr_to_node)."', tsr_to_node_date='".th2a($this->tsr_to_node_date)."', tsr_docid='".th2a($this->tsr_docid)."', tsr_doc_url='".th2a($this->tsr_doc_url)."', tsr_doc_chksum='".th2a($this->tsr_doc_chksum)."', tsr_status='".th2a($this->tsr_status)."', tsr_id_send='".th2a($this->tsr_id_send)."', tsr_docgroup='".th2a($this->tsr_docgroup)."', tsr_DrsID='".th2a($this->tsr_DrsID)."', tsr_SendNew='".th2a($this->tsr_SendNew)."', tsr_DocSubject='".th2a($this->tsr_DocSubject)."', tsr_DocNo='".th2a($this->tsr_DocNo)."', tsr_DocDate='".th2a($this->tsr_DocDate)."', tsr_DocFrom='".th2a($this->tsr_DocFrom)."', tsr_DocTo='".th2a($this->tsr_DocTo)."', tsr_DocRef='".th2a($this->tsr_DocRef)."', tsr_DocOther='".th2a($this->tsr_DocOther)."', tsr_DslID='".th2a($this->tsr_DslID)."', tsr_DclID='".th2a($this->tsr_DclID)."', tsr_DocShortDesc='".th2a($this->tsr_DocShortDesc)."', tsr_PtID='".th2a($this->tsr_PtID)."', tsr_DlcID='".th2a($this->tsr_DlcID)."', tsr_personId='".th2a($this->tsr_personId)."', tsr_DtID='".th2a($this->tsr_DtID)."', tsr_docname='".th2a($this->tsr_docname)."', tsr_receive='".th2a($this->tsr_receive)."', tsr_receivedate='".th2a($this->tsr_receivedate)."', tsr_DrsDocDueDate='".th2a($this->tsr_DrsDocDueDate)."', tsr_statusDocAtt='".th2a($this->tsr_statusDocAtt)."', tsr_DocTelOwner='".th2a($this->tsr_DocTelOwner)."', tsr_DocSendReal='".th2a($this->tsr_DocSendReal)."', tsr_DocDeptOwner='".th2a($this->tsr_DocDeptOwner)."', tsr_DocFaxOwner='".th2a($this->tsr_DocFaxOwner)."', tsr_DocCopySend='".th2a($this->tsr_DocCopySend)."', tsr_DocContactE='".th2a($this->tsr_DocContactE)."', tsr_CountDoc='".th2a($this->tsr_CountDoc)."' where tsr_id='".th2a($this->tsr_id)."'"; //echo $sql; exit; } return $this->Dml($sql); }
function Delete(){ $sql = "delete from sendreceive where tsr_id='$this->tsr_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(){ //--ใช้เมธอดนี้เพื่อหาค่าสูงสุดของฟิลด์ที่ใช้เป็นคีย์ของตาราง ในลักษณะ auto increment //--ต้องเป็นฟิลด์ที่ไม่ได้กำหนดรหัสเองทางจอภาพ $cmd = "select max(tsr_id) as num from sendreceive"; $this->Open($cmd); if($this->GetRecord()) return $this->num+1; }
function RSsendreceive(){ $this->SetQuery("select * from sendreceive order by tsr_to_node_date"); }
function SearchByKey($key){ if ($this->SetQuery("select * from sendreceive where tsr_id='$key'")){ return 1; }else { return 0; } }
//*************************************************************************** //****************** You can add new methods below********************************* //*************************************************************************** function SearchBytsr_docid($key){ if ($this->SetQuery("select * from sendreceive where tsr_docid ='$key'")){ return 1; }else { return 0; } } function SearchBytsr_status($key){
if ($this->SetQuery("select * from sendreceive where tsr_status = '$key' order by tsr_to_node_date")){ return 1; }else { return 0; } } function SearchBytsr_docid_tsr_fr_node($xKey,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_docid = '$xKey' and tsr_fr_node='$yKey'")){ return 1; }else { return 0; } } function SearchBytsr_docid_tsr_to_node_tsr_fr_node_date($xKey,$yKey,$zKey){ if ($this->SetQuery("select * from sendreceive where tsr_docid = '$xKey' and tsr_to_node='$yKey' and tsr_fr_node_date='$zKey'")){ return 1; }else { return 0; } } function SearchBytsr_docid_tsr_to_node_tsr_fr_node_date2($xKey,$yKey,$zKey){ if ($this->SetQuery("select tsr_id from sendreceive where tsr_docid = '$xKey' and tsr_to_node='$yKey' and tsr_fr_node_date='$zKey'")){ return 1; }else { return 0; } } function SearchBytsr_id_send($key){ if ($this->SetQuery("select * from sendreceive where tsr_id_send ='$key'")){ return 1; }else { return 0; } } function SearchBytsr_DrsID($key){ if ($this->SetQuery("select * from sendreceive where tsr_DrsID ='$key'")){ return 1; }else { return 0; } } function SearchBytsr_DrsID_tsr_to_node($xKey,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_DrsID ='$xKey' and tsr_to_node='$yKey'")){ return 1; }else { return 0; } } function SearchBytsr_fr_node_tsr_DlcID_tsr_docgroup($xKey,$yKey,$zKey,$aKey){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"); } function SearchDocStatus($xKey,$yKey,$zKey,$aKey,$bKey){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' order by tsr_to_node_date"); } function SearchDocStatusNoSend($xKey,$yKey,$zKey,$aKey,$bKey){ //echo "select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status!='$bKey' order by tsr_fr_node_date desc"; $this->SetQuery("select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status!='$bKey'"); if ($result=$this->GetResult()) { return $result['num']; } } function SearchDocStatusNoSendselectcID($xKey,$yKey,$zKey,$aKey,$bKey,$pKey){ echo "select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status!='$bKey' and tsr_to_node='$pKey'<br>"; $this->SetQuery("select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status!='$bKey' and tsr_to_node='$pKey'"); if ($result=$this->GetResult()) { return $result['num']; } } function SearchDocStatusNoSendlimit($xKey,$yKey,$zKey,$aKey,$bKey,$start,$pageSize){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status!='$bKey' order by tsr_fr_node_date desc limit $start, $pageSize"); } function SearchDocStatusNoSendlimitselectcID($xKey,$yKey,$zKey,$aKey,$bKey,$start,$pageSize,$pKey){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_to_node ='$pKey' and tsr_status!='$bKey' order by tsr_fr_node_date desc limit $start, $pageSize"); } function SearchDocStatusNoReceive($xKey,$bKey){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_to_node='$xKey' and tsr_status!='$bKey' order by tsr_to_node_date desc"); //echo "select * from sendreceive where tsr_to_node='$xKey' and tsr_status!='$bKey' order by tsr_to_node_date desc"; } function SearchDocStatusNoReceiveselectcID($xKey,$bKey,$zKey){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_to_node='$xKey' and tsr_status!='$bKey' and tsr_fr_node='$zKey' order by tsr_to_node_date desc"); } function SearchCountDocStatusSend($xKey,$yKey,$zKey,$aKey,$bKey){ //echo "select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' order by tsr_to_node_date"; $this->SetQuery("select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey'"); if ($result=$this->GetResult()) { return $result['num']; } } function SearchCountDocStatusSend2($xKey,$yKey,$zKey,$aKey,$bKey,$monthe,$searchYear,$searchName,$searchNo){ if($searchName!="" && $searchNo==""){ $q="select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocSubject like '%$searchName%'"; }else if($searchName=="" && $searchNo!=""){ $q="select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%'"; }else if($searchName!="" && $searchNo!=""){ $q="select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_DocSubject like '%$searchName%'"; }else{ $q="select count(tsr_id) as num from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%'"; } $this->SetQuery($q); if ($result=$this->GetResult()) { return $result['num']; } } function SearchCountDocStatusReceive2($xKey,$bKey,$monthe,$searchYear,$searchName,$searchNo){ if($searchName!="" && $searchNo==""){ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocSubject like '%$searchName%'"; }else if($searchName=="" && $searchNo!=""){ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%'"; }else if($searchName!="" && $searchNo!=""){ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_DocSubject like '%$searchName%'"; }else{ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%'"; } $this->SetQuery($q); if ($result=$this->GetResult()) { return $result['num']; } } function SearchCountDocStatusReceive2selectcID($xKey,$bKey,$monthe,$searchYear,$searchName,$searchNo,$selectcID2){ if($searchName!="" && $searchNo==""){ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocSubject like '%$searchName%' and tsr_fr_node='$selectcID2'"; }else if($searchName=="" && $searchNo!=""){ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_fr_node='$selectcID2'"; }else if($searchName!="" && $searchNo!=""){ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_DocSubject like '%$searchName%' and tsr_fr_node='$selectcID2'"; }else{ $q="select count(tsr_id) as num from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_fr_node='$selectcID2'"; } $this->SetQuery($q); if ($result=$this->GetResult()) { return $result['num']; } } function SearchDocStatuslimitSend($xKey,$yKey,$zKey,$aKey,$bKey,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo){ if($searchName!="" && $searchNo==""){ $q="select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocSubject like '%$searchName%' order by tsr_fr_node_date desc limit $start, $pageSize"; }else if($searchName=="" && $searchNo!=""){ $q="select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' order by tsr_fr_node_date desc limit $start, $pageSize"; }else if($searchName!="" && $searchNo!=""){ $q="select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_DocSubject like '%$searchName%' order by tsr_fr_node_date desc limit $start, $pageSize"; }else{ $q="select * from sendreceive where tsr_fr_node='$xKey' and (tsr_DlcID='$yKey' || tsr_DlcID='$zKey') and tsr_docgroup='$aKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' order by tsr_fr_node_date desc limit $start, $pageSize"; }
$this->SetQuery($q); } function SearchDocStatuslimitReceive($xKey,$bKey,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo){ if($searchName!="" && $searchNo==""){ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocSubject like '%$searchName%' order by tsr_to_node_date desc limit $start, $pageSize"; }else if($searchName=="" && $searchNo!=""){ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' order by tsr_to_node_date desc limit $start, $pageSize"; }else if($searchName!="" && $searchNo!=""){ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_DocSubject like '%$searchName%' order by tsr_to_node_date desc limit $start, $pageSize"; }else{ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' order by tsr_to_node_date desc limit $start, $pageSize"; } $this->SetQuery($q); } function SearchDocStatuslimitReceiveselectcID($xKey,$bKey,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo,$selectcID2){ if($searchName!="" && $searchNo==""){ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocSubject like '%$searchName%' and tsr_fr_node ='$selectcID2' order by tsr_to_node_date desc limit $start, $pageSize"; }else if($searchName=="" && $searchNo!=""){ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_fr_node ='$selectcID2' order by tsr_to_node_date desc limit $start, $pageSize"; }else if($searchName!="" && $searchNo!=""){ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_DocNo like '%$searchNo%' and tsr_DocSubject like '%$searchName%' and tsr_fr_node ='$selectcID2' order by tsr_to_node_date desc limit $start, $pageSize"; }else{ $q="select * from sendreceive where tsr_to_node='$xKey' and tsr_status='$bKey' and tsr_fr_node_date like '$searchYear-$monthe-%' and tsr_fr_node ='$selectcID2' order by tsr_to_node_date desc limit $start, $pageSize"; } $this->SetQuery($q); } function SearchBytsr_to_node($xKey){ //echo "select * from sendreceive where tsr_to_node='$xKey' order by tsr_to_node_date"; $this->SetQuery("select * from sendreceive where tsr_to_node='$xKey' order by tsr_to_node_date"); } function SearchBytsr_id_send_tsr_fr_node($key,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_id_send ='$key' and tsr_fr_node='$yKey'")){ return 1; }else { return 0; } } function SearchBytsr_id_send_tsr_to_node($key,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_id_send ='$key' and tsr_to_node='$yKey'")){ return 1; }else { return 0; } } function SearchDocSend($xKey,$yKey){ $this->SetQuery("select * from sendreceive where tsr_fr_node='$xKey' and tsr_docid='$yKey'"); } function Deletetsr_id($xKey){ //echo "select * from sendreceive where tsr_to_node='$xKey' order by tsr_to_node_date"; $this->SetQuery("delete from sendreceive where tsr_id='$xKey'"); } function SearchCountBytsr_status($key){
$q ="select count(tsr_id) as num from sendreceive where tsr_status = '$key'"; $this->SetQuery($q); if ($result=$this->GetResult()) { return $result['num']; } } function SearchBytsr_DrsIDandtsr_fr_node($key,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_DrsID ='$key' and tsr_fr_node='$yKey'")){ return 1; }else { return 0; } } function SearchBytsr_docidandtsr_fr_node($key,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_docid ='$key' and tsr_fr_node='$yKey'")){ return 1; }else { return 0; } } function SearchBytsr_id_tsr_fr_node($key,$yKey){ if ($this->SetQuery("select * from sendreceive where tsr_id ='$key' and tsr_fr_node='$yKey'")){ return 1; }else { return 0; } } function SearchByNodeEditHost($key,$yKey){ if ($this->SetQuery("select * from sendreceive where $key ='$yKey'")){ return 1; }else { return 0; } } function UpdateEditHost($key,$yKey,$xKey){ if ($this->SetQuery("update sendreceive set tsr_doc_url='$key' where $xKey ='$yKey'")){ return 1; }else { return 0; } } function SearchRepSumReceiveDocE($DtID,$start,$end,$tsr_fr_node,$tsr_to_node){ if($start==$end){ $c="and tsr_to_node_date like '$start%'"; }else{ $c="and tsr_to_node_date between '$start 00:00:00' and '$end 23:59:59'"; } $qry="select count(tsr_id) as num from sendreceive where tsr_DtID='$DtID' and tsr_fr_node='$tsr_fr_node' and tsr_to_node='$tsr_to_node' $c";
$this->SetQuery($qry); if ($result=$this->GetResult()) { return $result['num']; } } function SearchRepSumSendDocE($DtID,$start,$end,$tsr_fr_node,$tsr_to_node){ if($start==$end){ $c="and tsr_fr_node_date like '$start%'"; }else{ $c="and tsr_fr_node_date between '$start 00:00:00' and '$end 23:59:59'"; } $qry="select count(tsr_id) as num from sendreceive where tsr_DtID='$DtID' and tsr_fr_node='$tsr_to_node' and tsr_to_node='$tsr_fr_node' $c";
$this->SetQuery($qry); if ($result=$this->GetResult()) { return $result['num']; } } function SearchBytsr_docidandtsr_fr_node_tsr_to_nod($key,$yKey,$zKey){ if ($this->SetQuery("select * from sendreceive where tsr_docid ='$key' and tsr_fr_node='$yKey' and tsr_to_node='$zKey'")){ return 1; }else { return 0; } } function SearchDocEMoblie($key){ if ($this->SetQuery("select * from sendreceive where tsr_status = '$key'")){ return 1; }else { return 0; } } function updateStatusDocument($DocID) { $sql = "UPDATE `sendreceive` SET `tsr_status`='s3' WHERE (`tsr_docid`='$DocID')"; if ($this->SetQuery($sql)){ return 1; }else { return 0; } }
} //--End class sendreceive--
?>
|