Viewing file: clsSendReceive.php (5.25 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_DlcID;
var $tsr_DocSubject;
function sendreceive(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
if ($this->status==1){
//คำสั่ง insert ถ้ามีฟิลด์ที่เป็น Auto Increment ให้ลบฟิลด์นั้นออก
$sql = "insert into sendreceive (tsr_id, tsr_fr_node, tsr_fr_node_date, tsr_to_node, tsr_to_node_date, tsr_docid, tsr_doc_url, tsr_doc_chksum, tsr_status, tsr_id_send, tsr_docgroup, tsr_DrsID,tsr_SendNew, tsr_DlcID, tsr_DocSubject) values ('$this->tsr_id', '$this->tsr_fr_node', '$this->tsr_fr_node_date', '$this->tsr_to_node', '$this->tsr_to_node_date', '$this->tsr_docid', '$this->tsr_doc_url', '$this->tsr_doc_chksum', '$this->tsr_status', '$this->tsr_id_send', '$this->tsr_docgroup', '$this->tsr_DrsID', '$this->tsr_SendNew', '$this->tsr_DlcID', '$this->tsr_DocSubject')";
}else {
$sql = "update sendreceive set
tsr_fr_node='$this->tsr_fr_node',
tsr_fr_node_date='$this->tsr_fr_node_date',
tsr_to_node='$this->tsr_to_node',
tsr_to_node_date='$this->tsr_to_node_date',
tsr_docid='$this->tsr_docid',
tsr_doc_url='$this->tsr_doc_url',
tsr_doc_chksum='$this->tsr_doc_chksum',
tsr_status='$this->tsr_status',
tsr_id_send='$this->tsr_id_send',
tsr_docgroup='$this->tsr_docgroup',
tsr_DrsID='$this->tsr_DrsID',
tsr_SendNew='$this->tsr_SendNew',
tsr_DlcID='$this->tsr_DlcID',
tsr_DocSubject='$this->tsr_DocSubject'
where tsr_id='$this->tsr_id'";
}
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_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 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");
}
} //--End class sendreceive--
?>
|