Viewing file: clsDocType.php (3.45 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class doctype--------------------------
//--PK of doctype ::
// 1. DtID
include_once "../link/keyThai.php";
class doctype extends clsDB{
var $result;
var $DtID;
var $DtPDtID;
var $DtName;
var $DtP;
var $DtRunAll;
var $sendNoPrefix;
var $sendNoSuffix;
var $forRegis;
function doctype(&$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 DocType values(
'".th2a($this->DtID)."',
'".th2a($this->DtPDtID)."',
'".th2a($this->DtName)."',
'".th2a($this->DtP)."',
'".th2a($this->DtRunAll)."',
'".th2a($this->sendNoPrefix)."',
'".th2a($this->sendNoSuffix)."',
'".th2a($this->forRegis)."'
)";
}else {
$sql = "update DocType set
DtPDtID='".th2a($this->DtPDtID)."',
DtName='".th2a($this->DtName)."',
DtP='".th2a($this->DtP)."',
DtRunAll='".th2a($this->DtRunAll)."',
sendNoPrefix='".th2a($this->sendNoPrefix)."',
sendNoSuffix='".th2a($this->sendNoSuffix)."',
forRegis='".th2a($this->forRegis)."'
where DtID='".th2a($this->DtID)."'";
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from DocType where DtID='$this->DtID'");
}
function GetNextCode(){
$this->SetQuery("select max(DtID) as num from DocType");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSdoctype(){
$this->SetQuery("select * from DocType order by DtID 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)."'];");
$this->DtName=a2th($this->DtName);
$this->sendNoPrefix=a2th($this->sendNoPrefix);
$this->sendNoSuffix=a2th($this->sendNoSuffix);
}
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 DocType where DtID= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
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 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");
}
} //--End class DocType--
?>
|