Viewing file: clsDocuments.php (151.96 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class base_Documents--------------------------
//--PK of base_Documents ::
// 1. DocID
include_once "../link/keyThai.php";
class Documents extends clsDB{
var $result;
var $DocID;
var $DocPID;
var $DlcID;
var $PtID;
var $DtID;
var $DslID;
var $DclID;
var $DsID;
var $RsID;
var $DocDateCreate;
var $DocUserCreate;
var $DocTypeNo;
var $DocDate;
var $DocNo;
var $DocSubject;
var $DocFrom;
var $DocTo;
var $DocShortDesc;
var $DocSpeedLevelDueDate;
var $DocStart;
var $DocFinish;
var $DocGroup;
var $DocRef;
var $DocCircular;
var $DocfCir;
var $DocOther;
var $CertificatePs;
var $fDelete;
var $endDoc;
var $sendToPs;
var $AnID;
var $DocRefAns;
var $DocRefAnsID;
var $DocstartDatePost;
var $DocendDatePost;
var $DocMainPost;
var $DocGetPost;
var $DocShowInOut;
var $DocDateGetPost;
var $useMainDocNo;
var $stdCode;
var $DocforSign;
var $eDoc;
var $DocTelOwner;
var $DocSendReal;
var $DIbStaff;
var $DIbHeader;
var $DocDeptOwner;
var $DocFaxOwner;
var $DocCopySend;
var $DocContactE;
var $Doc_tsr_id;
var $DocIDHisOld;
var $DocIDHisNew;
var $Doc_Letter_ID;
function Documents(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
if($this->DocDateCreate==''){ $this->DocDateCreate='0000-00-00 00:00:00'; }
if($this->DocDate==''){ $this->DocDate='0000-00-00'; }
if($this->DocSpeedLevelDueDate==''){ $this->DocSpeedLevelDueDate='0000-00-00'; }
if($this->DocStart==''){ $this->DocStart='0000-00-00 00:00:00'; }
if($this->DocFinish==''){ $this->DocFinish='0000-00-00 00:00:00'; }
if($this->DocstartDatePost==''){ $this->DocstartDatePost='0000-00-00'; }
if($this->DocendDatePost==''){ $this->DocendDatePost='0000-00-00'; }
if($this->DocDateGetPost==''){ $this->DocDateGetPost='0000-00-00 00:00:00'; }
if ($this->status==1){
$sql = "insert into Documents values(
'".th2a($this->DocID)."',
'".th2a($this->DocPID)."',
'".th2a($this->DlcID)."',
'".th2a($this->PtID)."',
'".th2a($this->DtID)."',
'".th2a($this->DslID)."',
'".th2a($this->DclID)."',
'".th2a($this->DsID)."',
'".th2a($this->RsID)."',
'".th2a($this->DocDateCreate)."',
'".th2a($this->DocUserCreate)."',
'".th2a($this->DocTypeNo)."',
'".th2a($this->DocDate)."',
'".th2a($this->DocNo)."',
'".th2a($this->DocSubject)."',
'".th2a($this->DocFrom)."',
'".th2a($this->DocTo)."',
'".th2a($this->DocShortDesc)."',
'".th2a($this->DocSpeedLevelDueDate)."',
'".th2a($this->DocStart)."',
'".th2a($this->DocFinish)."',
'".th2a($this->DocGroup)."',
'".th2a($this->DocRef)."',
'".th2a($this->DocCircular)."',
'".th2a($this->DocfCir)."',
'".th2a($this->DocOther)."',
'".th2a($this->CertificatePs)."',
'".th2a($this->fDelete)."',
'".th2a($this->endDoc)."',
'".th2a($this->sendToPs)."',
'".th2a($this->AnID)."',
'".th2a($this->DocRefAns)."',
'".th2a($this->DocRefAnsID)."',
'".th2a($this->DocstartDatePost)."',
'".th2a($this->DocendDatePost)."',
'".th2a($this->DocMainPost)."',
'".th2a($this->DocGetPost)."',
'".th2a($this->DocShowInOut)."',
'".th2a($this->DocDateGetPost)."',
'".th2a($this->useMainDocNo)."',
'".th2a($this->stdCode)."',
'".th2a($this->DocforSign)."',
'".th2a($this->eDoc)."',
'".th2a($this->DocTelOwner)."',
'".th2a($this->DocSendReal)."',
'".th2a($this->DIbStaff)."',
'".th2a($this->DIbHeader)."',
'".th2a($this->DocDeptOwner)."',
'".th2a($this->DocFaxOwner)."',
'".th2a($this->DocCopySend)."',
'".th2a($this->DocContactE)."',
'".th2a($this->Doc_tsr_id)."',
'".th2a($this->DocIDHisOld)."',
'".th2a($this->DocIDHisNew)."',
'".th2a($this->Doc_Letter_ID)."'
)";
}else {
$sql = "update Documents set
DocPID='".th2a($this->DocPID)."',
DlcID='".th2a($this->DlcID)."',
PtID='".th2a($this->PtID)."',
DtID='".th2a($this->DtID)."',
DslID='".th2a($this->DslID)."',
DclID='".th2a($this->DclID)."',
DsID='".th2a($this->DsID)."',
RsID='".th2a($this->RsID)."',
DocDateCreate='".th2a($this->DocDateCreate)."',
DocUserCreate='".th2a($this->DocUserCreate)."',
DocTypeNo='".th2a($this->DocTypeNo)."',
DocDate='".th2a($this->DocDate)."',
DocNo='".th2a($this->DocNo)."',
DocSubject='".th2a($this->DocSubject)."',
DocFrom='".th2a($this->DocFrom)."',
DocTo='".th2a($this->DocTo)."',
DocShortDesc='".th2a($this->DocShortDesc)."',
DocSpeedLevelDueDate='".th2a($this->DocSpeedLevelDueDate)."',
DocStart='".th2a($this->DocStart)."',
DocFinish='".th2a($this->DocFinish)."',
DocGroup='".th2a($this->DocGroup)."',
DocRef='".th2a($this->DocRef)."',
DocCircular='".th2a($this->DocCircular)."',
DocfCir='".th2a($this->DocfCir)."',
DocOther='".th2a($this->DocOther)."',
CertificatePs='".th2a($this->CertificatePs)."',
fDelete='".th2a($this->fDelete)."',
endDoc='".th2a($this->endDoc)."' ,
sendToPs='".th2a($this->sendToPs)."',
AnID='".th2a($this->AnID)."',
DocRefAns='".th2a($this->DocRefAns)."',
DocRefAnsID='".th2a($this->DocRefAnsID)."',
DocstartDatePost='".th2a($this->DocstartDatePost)."',
DocendDatePost='".th2a($this->DocendDatePost)."',
DocMainPost='".th2a($this->DocMainPost)."',
DocGetPost='".th2a($this->DocGetPost)."',
DocShowInOut='".th2a($this->DocShowInOut)."',
DocDateGetPost='".th2a($this->DocDateGetPost)."',
useMainDocNo='".th2a($this->useMainDocNo)."',
stdCode='".th2a($this->stdCode)."',
DocforSign='".th2a($this->DocforSign)."',
eDoc='".th2a($this->eDoc)."',
DocTelOwner='".th2a($this->DocTelOwner)."',
DocSendReal='".th2a($this->DocSendReal)."',
DIbStaff='".th2a($this->DIbStaff)."',
DIbHeader='".th2a($this->DIbHeader)."',
DocDeptOwner='".th2a($this->DocDeptOwner)."',
DocFaxOwner='".th2a($this->DocFaxOwner)."',
DocCopySend='".th2a($this->DocCopySend)."',
DocContactE='".th2a($this->DocContactE)."',
Doc_tsr_id='".th2a($this->Doc_tsr_id)."',
DocIDHisOld='".th2a($this->DocIDHisOld)."',
DocIDHisNew='".th2a($this->DocIDHisNew)."',
Doc_Letter_ID='".th2a($this->Doc_Letter_ID)."'
where DocID='".th2a($this->DocID)."'";
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from Documents where DocID='$this->DocID'");
}
function NumRow(){
return $this->GetRowSelected();
}
function GetNextCode(){
$this->SetQuery("select max(DocID) as num from Documents");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSDocuments(){
$this->SetQuery("select * from Documents order by DocID");
}
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->DocNo=a2th($this->DocNo);
$this->DocSubject=a2th($this->DocSubject);
$this->DocFrom=a2th($this->DocFrom);
$this->DocTo=a2th($this->DocTo);
$this->DocShortDesc=a2th($this->DocShortDesc);
$this->DocRef=a2th($this->DocRef);
$this->DocCircular=a2th($this->DocCircular);
$this->DocOther=a2th($this->DocOther);
$this->CertificatePs=a2th($this->CertificatePs);
$this->DocRefAns=a2th($this->DocRefAns);
$this->DocTelOwner=a2th($this->DocTelOwner);
$this->DocDeptOwner=a2th($this->DocDeptOwner);
$this->DocFaxOwner=a2th($this->DocFaxOwner);
$this->DocCopySend=a2th($this->DocCopySend);
$this->DocContactE=a2th($this->DocContactE);
}
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 Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function SearchCountRegisDocNoMainDept($xKey,$yKey,$zKey,$zKey2,$zKey3,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$forfolderstaff,$searchPreName,$searchPreNo,$searchPreTypeNoF,$searchPreTypeNoT,$searchPreFrom){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$hh="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if($searchPreFrom!=""){
$kk="and a.DocFrom like '%$searchPreFrom%'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$yKey' and a.RsID = '$zKey' and a.DtID = '$zKey2' and a.fDelete!='Y' and (a.DsID='1' or a.DsID='2') and a.DsID = b.DsID and (a.DlcID= '$xKey' || a.DlcID='$zKey3') and a.DocID=b.DocID and b.DrsflagRead!='N' $ff $gg $hh $ii $jj $kk");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountRegisDocNoMainDept2($yKey,$zKey,$zKey2,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$forfolderstaff,$searchPreName,$searchPreNo,$searchPreTypeNoF,$searchPreTypeNoT,$searchPreFrom){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$hh="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if($searchPreFrom!=""){
$kk="and a.DocFrom like '%$searchPreFrom%'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$yKey' and a.RsID = '$zKey' and a.DtID = '$zKey2' and a.fDelete!='Y' and (a.DsID='1' or a.DsID='2') and a.DsID = b.DsID and a.DocID=b.DocID and b.DrsflagRead!='N' $ff $gg $hh $ii $jj $kk");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchRegisDocNoMainDeptLimit($xKey,$yKey,$zKey,$zKey2,$zKey3,$start,$pageSize,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$college,$forfolderstaff,$searchPreName,$searchPreNo,$searchPreTypeNoF,$searchPreTypeNoT,$searchPreFrom){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$hh="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if($searchPreFrom!=""){
$kk="and a.DocFrom like '%$searchPreFrom%'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,a.eDoc,
b.DrsID,b.DrsFromDrsID,a.DocPID
from Documents a inner join DocReceiveSend b on
a.DocGroup='$yKey' and a.RsID = '$zKey' and a.DtID = '$zKey2' and
a.fDelete!='Y' and (a.DsID='1' or a.DsID='2') and a.DsID = b.DsID and
(a.DlcID= '$xKey' || a.DlcID='$zKey3') and a.DocID=b.DocID and b.DrsflagRead!='N' $ff $gg $hh $ii $jj $kk $col
order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchRegisDocNoMainDeptLimit2($yKey,$zKey,$zKey2,$start,$pageSize,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$college,$forfolderstaff,$searchPreName,$searchPreNo,$searchPreTypeNoF,$searchPreTypeNoT,$searchPreFrom){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$hh="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if($searchPreFrom!=""){
$kk="and a.DocFrom like '%$searchPreFrom%'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,a.eDoc,
b.DrsID,b.DrsFromDrsID,a.DocPID
from Documents a inner join DocReceiveSend b on
a.DocGroup='$yKey' and a.RsID = '$zKey' and a.DtID = '$zKey2' and
a.fDelete!='Y' and (a.DsID='1' or a.DsID='2') and a.DsID = b.DsID and
a.DocID=b.DocID and b.DrsflagRead!='N' $ff $gg $hh $ii $jj $kk $col
order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchCountRegisDocMainDept($yKey,$zKey,$zKey2,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$forfolderstaff,$searchPreName,$searchPreNo,$searchPreTypeNoF,$searchPreTypeNoT,$searchPreFrom){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$hh="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if($searchPreFrom!=""){
$kk="and a.DocFrom like '%$searchPreFrom%'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$yKey' and a.RsID = '$zKey' and a.DtID = '$zKey2' and a.fDelete!='Y' and (a.DsID='1' or a.DsID='2') and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsflagRead!='N' $ff $gg $hh $ii $jj $kk");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchRegisDocMainDeptLimit($yKey,$zKey,$zKey2,$start,$pageSize,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$college,$forfolderstaff,$searchPreName,$searchPreNo,$searchPreTypeNoF,$searchPreTypeNoT,$searchPreFrom){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$hh="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if($searchPreFrom!=""){
$kk="and a.DocFrom like '%$searchPreFrom%'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,
b.DrsID,b.DrsFromDrsID,a.DocPID
from Documents a inner join DocReceiveSend b on
a.DocGroup='$yKey' and a.RsID = '$zKey' and a.DtID = '$zKey2' and a.fDelete!='Y' and
(a.DsID='1' or a.DsID='2') and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsflagRead!='N' $ff $gg $hh $ii $jj $kk $col
order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID3DrsSendDateDrsSEnd($xKey,$yKey,$zKey4,$dlcid){
//if ($this->SetQuery("select * from Documents where (DlcID= '$xKey' || DlcID= '$zKey4') and DocGroup='$yKey' and fDelete!='Y' and DsID='3' order by DocDateCreate desc , DocID desc")){
if ($this->SetQuery("select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchCountSendDocDrsSEnd($xKey,$yKey,$zKey4,$dlcid,$searchnamePre,$searchNoPre,$searchpredocdate,$selectpredocdatevalue,$selectpreDtID,$folderstaff,$forfolderstaff,$searchPreTypeNoF,$searchPreTypeNoT,$searchDeptPre){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($selectpreDtID!=''){
$gg="and a.DtID= '$selectpreDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchDeptPre!=""){
$ii="and a.DocFrom like '%$searchDeptPre%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4' || a.DlcID='$dlcid') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $cc $ff $gg $hh $ii $jj");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSendDocDrsSEndlimit($xKey,$yKey,$zKey4,$dlcid,$start,$pageSize,$searchnamePre,$searchNoPre,$searchpredocdate,$selectpredocdatevalue,$selectpreDtID,$folderstaff,$forfolderstaff,$searchPreTypeNoF,$searchPreTypeNoT,$searchDeptPre){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($selectpreDtID!=''){
$gg="and a.DtID= '$selectpreDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchDeptPre!=""){
$ii="and a.DocFrom like '%$searchDeptPre%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc ,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4' || a.DlcID= '$dlcid') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $cc $ff $gg $hh $ii $jj order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchDocforSignMainPs($xKey,$yKey,$zKey4,$dlcid){
//if ($this->SetQuery("select * from Documents where (DlcID= '$xKey' || DlcID= '$zKey4') and DocGroup='$yKey' and fDelete!='Y' and DsID='3' order by DocDateCreate desc , DocID desc")){
if ($this->SetQuery("select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' and a.DtID='15' and a.DocPID!='0' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID3DrsSendDateDrsSEndnotY($xKey,$yKey,$zKey4){
//echo "select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' order by a.DocDateCreate desc , a.DocID desc";
if ($this->SetQuery("select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID3DrsSendDateDrsSEndnotY2($xKey,$yKey,$zKey4,$dlcid){
//echo "select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' order by a.DocDateCreate desc , a.DocID desc";
if ($this->SetQuery("select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchCountSendDocDrsSEndnotY2($xKey,$yKey,$zKey4,$dlcid,$searchnamePre,$searchNoPre,$searchpredocdate,$selectpredocdatevalue,$selectpreDtID,$folderstaff,$forfolderstaff,$searchPreTypeNoF,$searchPreTypeNoT,$searchDeptPre){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($selectpreDtID!=''){
$gg="and a.DtID= '$selectpreDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchDeptPre!=""){
$ii="and a.DocFrom like '%$searchDeptPre%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $cc $ff $gg $hh $ii $jj");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSendDocDrsSEndnotY2limit($xKey,$yKey,$zKey4,$dlcid,$start,$pageSize,$searchnamePre,$searchNoPre,$searchpredocdate,$selectpredocdatevalue,$selectpreDtID,$folderstaff,$forfolderstaff,$searchPreTypeNoF,$searchPreTypeNoT,$searchDeptPre){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($selectpreDtID!=''){
$gg="and a.DtID= '$selectpreDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchDeptPre!=""){
$ii="and a.DocFrom like '%$searchDeptPre%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $cc $ff $gg $hh $ii $jj order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchDocforSign($xKey,$yKey,$zKey4,$dlcid){
//echo "select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' order by a.DocDateCreate desc , a.DocID desc";
if ($this->SetQuery("select a.*,b.* from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and a.DtID='15' and a.DocPID!='0' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0($xKey,$yKey,$zKey4){
//echo "select * from Documents where (DlcID= '$xKey' || DlcID= '$zKey4') and DocGroup='$yKey' and fDelete!='Y' and DsID='0' order by DocDateCreate desc , DocID desc";
if ($this->SetQuery("select * from Documents where (DlcID= '$xKey' || DlcID= '$zKey4') and DocGroup='$yKey' and fDelete!='Y' and DsID='0' order by DocDateCreate desc , DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDate($xKey,$yKey,$zKey4){
//echo "select a.*,b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' order by a.DocDateCreate desc , a.DocID desc";
if ($this->SetQuery("select a.*,b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDatelimit($xKey,$yKey,$zKey4,$start,$pageSize,$searchnamePre,$searchNoPre,$searchdocdate,$selectdocdatevalue,$searchPreName,$college){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectdocdatevalue=="1"){
$bb="and a.DocDate = '$searchdocdate'";
}
if($searchPreName!=""){
$dd="and a.DocFrom like '%$searchPreName%'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DtID,a.DocDate,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.CertificatePs,a.DocSubject,a.DslID,a.DclID,a.DtID,a.eDoc,
b.DrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b
on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' $aa $cc $bb $dd $col
order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchCountDocReceive2($xKey,$yKey,$zKey4,$searchnamePre,$searchNoPre,$searchdocdate,$selectdocdatevalue,$searchDeptName,$college){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectdocdatevalue=="1"){
$bb="and a.DocDate = '$searchdocdate'";
}
if($searchDeptName!=""){
$dd="and a.DocFrom like '%$searchDeptName%'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' $aa $cc $bb $dd $col");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchReceiveDoc($xKey,$yKey,$zKey4){
if ($this->SetQuery("select a.DocNo,a.DtID,a.DocFrom,a.DocPID,
a.DlcID,a.RsID,a.DocID,a.CertificatePs,
a.DocSubject,a.DslID,a.DclID,b.DrsID,
b.DrsFromDrsID,b.DrsReceiveDate
from Documents a inner join DocReceiveSend b on
(a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and
a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and
b.DrsSendDate='0000-00-00 00:00:00' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptnoRsID4searchNo($xKey,$yKey,$zKey4,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($s==6){
$bb="and b.DrsSendDate='0000-00-00 00:00:00' and (a.DsID=b.DsID and a.DsID='$s')";
}else{
$bb="and b.DsID='$s'";
}
if($searchNo!=""){
$cc="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
//echo "select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee $ff and a.RsID='3' $gg";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee $ff and a.RsID='3' $gg $col");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountReceivedDocNoDeptCenter($xKey,$yKey,$zKey4,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($s==6){
$bb="and b.DrsSendDate='0000-00-00 00:00:00' and (a.DsID=b.DsID and a.DsID='$s')";
}else{
$bb="and b.DsID='$s'";
}
if($searchNo!=""){
$cc="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
//echo "select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='3'";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='3'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptRsID1searchNo($xKey,$yKey,$zKey4,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
$cc="and b.DsID='1'";
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
//echo "select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee $ff and a.RsID='1' $gg";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee $ff and a.RsID='1' $gg $col");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountReceivedDocDeptCenter($xKey,$yKey,$zKey4,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
$cc="and b.DsID='1'";
//echo "select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='1'";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='1'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptLimitDrsReceiveDatenoRsID4searchNo($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($s==6){
$bb="and b.DrsSendDate='0000-00-00 00:00:00' and (a.DsID=b.DsID and a.DsID='$s')";
}else{
$bb="and b.DsID='$s'";
}
if($searchNo!=""){
$cc="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocTypeNo,a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.CertificatePs,a.DocSubject,a.DocDate,a.DocDateCreate,a.eDoc,
b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate ,b.DlcID as DlcIDDrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee $ff and a.RsID='3' $gg $col order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchReceivedDocNoDeptCenter($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($s==6){
$bb="and b.DrsSendDate='0000-00-00 00:00:00' and (a.DsID=b.DsID and a.DsID='$s')";
}else{
$bb="and b.DsID='$s'";
}
if($searchNo!=""){
$cc="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
//echo "select a.*,b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='3' order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize";
if ($this->SetQuery("select a.DocTypeNo,a.DocNo,a.DtID,a.DocFrom,
a.DocPID,a.DlcID,a.DocPID,a.RsID,a.DocID,
a.CertificatePs,a.DocSubject,a.DocDate,a.DocDateCreate,
b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate
from Documents a inner join DocReceiveSend b on
(a.DlcID= '$xKey' || a.DlcID= '$zKey4') and
a.DocGroup='$yKey' and a.fDelete!='Y' and
a.DocID=b.DocID $aa $bb $cc $ee and
b.DrsReceiveDate like '$searchYear-$monthe-%' and
a.RsID='3' order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptLimitDrsReceiveDateRsID1searchNo($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
$bb="and b.DsID='1'";
if($searchNo!=""){
$cc="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocTypeNo,a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.CertificatePs,a.DocSubject,a.DocDate,a.DocDateCreate,a.eDoc,
b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate ,b.DlcID as DlcIDDrsID
from Documents a inner join DocReceiveSend b on
(a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee $ff and a.RsID='1' $gg $col order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchReceivedDocDeptCenter($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear,$s,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
$bb="and b.DsID='1'";
if($searchNo!=""){
$cc="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
//echo "select a.*,b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DocID=b.DocID $aa $bb $cc $ee and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='1' order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize";
if ($this->SetQuery("select a.DocTypeNo,a.DocNo,a.DtID,a.DocFrom,
a.DocPID,a.DlcID,a.DocPID,a.RsID,a.DocID,
a.CertificatePs,a.DocSubject,a.DocDate,a.DocDateCreate,
b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate
from Documents a inner join DocReceiveSend b on
(a.DlcID= '$xKey' || a.DlcID= '$zKey4') and
a.DocGroup='$yKey' and a.fDelete!='Y' and
a.DocID=b.DocID $aa $bb $cc $ee and
b.DrsReceiveDate like '$searchYear-$monthe-%' and
a.RsID='1' order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID2($xKey){
//echo "select * from Documents where DocGroup='$xKey' and DsID='2' order by DocDateCreate desc";
if ($this->SetQuery("select * from Documents where DocGroup='$xKey' and DsID='2' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID2DocIDDlcIDDrsReceiveDlcID2Status2($xKey,$yKey,$zKey){
//echo "select a.*,b.DrsID from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') order by a.DocDateCreate desc , b.DrsReceiveDate desc";
if ($this->SetQuery("select a.*,b.DrsID,b.DrsWSign from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') order by a.DocDateCreate desc , b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchCountSignDoc($xKey,$yKey,$zKey,$searchpredocdate,$selectpredocdatevalue,$folderstaff,$forfolderstaff,$searchPreName,$searchPreNo,$searchDeptPre){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$gg="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchDeptPre!=""){
$jj="and a.DocFrom like '%$searchDeptPre%'";
}
//echo "select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') $ff";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') $ff $hh $gg $ii $jj");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSignDoclimit($xKey,$yKey,$zKey,$start,$pageSize,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="";
}else if($selectdocdatevalue=="1"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$gg="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchDeptPre!=""){
$jj="and a.DocFrom like '%$searchDeptPre%'";
}
if ($this->SetQuery("select
a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,
b.DrsID, b.DrsWSign
from Documents a inner join DocReceiveSend b on
a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and
a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') $ff $hh $gg $ii $jj
order by a.DocDateCreate desc , b.DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID2DocIDDlcIDDrsReceiveDlcID2Status2forwsign($xKey,$yKey,$zKey){
//echo "select a.*,b.DrsID from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') order by a.DocDateCreate desc , b.DrsReceiveDate desc";
if ($this->SetQuery("select a.*,b.DrsID,b.DrsWSign from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') and b.DrsWSign!='Y' order by a.DocDateCreate desc , b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchCountSignDocR($xKey,$yKey,$zKey,$searchpredocdate,$selectpredocdatevalue,$buddy,$folderstaff,$forfolderstaff,$searchPreName,$searchPreNo,$searchDeptPre){
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$gg="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchDeptPre!=""){
$jj="and a.DocFrom like '%$searchDeptPre%'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and ((b.DlcID= '$yKey' || b.DlcID= '$zKey') || (b.DlcID=$buddy && b.DrsSendDate='0000-00-00 00:00:00')) $ff $hh $gg $ii $jj");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSignDocRlimit($xKey,$yKey,$zKey,$start,$pageSize,$searchdocdate,$selectdocdatevalue){
if($selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="";
}else if($selectdocdatevalue=="1"){
$ff="and a.DocDate= '$searchdocdate'";
}
if ($this->SetQuery("select
a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,
b.DrsID, b.DrsWSign
from Documents a inner join DocReceiveSend b
on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and
a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') and
b.DrsWSign!='Y' $ff order by a.DocDateCreate desc , b.DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchSignDocRlimit2($xKey,$yKey,$zKey,$start,$pageSize,$searchdocdate,$selectdocdatevalue,$buddy,$folderstaff,$forfolderstaff,$searchPreName,$searchPreNo,$searchDeptPre){
if($selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="";
}else if($selectdocdatevalue=="1"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchPreName!=""){
$gg="and a.DocSubject like '%$searchPreName%'";
}
if($searchPreNo!=""){
$ii="and a.DocNo like '%$searchPreNo%'";
}
if($searchDeptPre!=""){
$jj="and a.DocFrom like '%$searchDeptPre%'";
}
if ($this->SetQuery("select
a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,
b.DrsID, b.DrsWSign
from Documents a inner join DocReceiveSend b
on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and
a.DocID=b.DocID and ((b.DlcID= '$yKey' || b.DlcID= '$zKey') || (b.DlcID='$buddy' && b.DrsSendDate='0000-00-00 00:00:00')) $ff $hh $gg $ii $jj order by a.DocDateCreate desc , b.DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByRsIDDocNoDocPID0($yKey,$zKey){
//echo "select * from Documents where RsID='$yKey' and DocNo like '%$zKey%' and DocPID='0' order by DocDate desc, DocID desc<br>";
if ($this->SetQuery("select * from Documents where RsID='$yKey' and DocNo like '%$zKey%' and DocPID='0' order by DocDate desc, DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchDocRefTable($yKey,$zKey){
//echo "select * from Documents where RsID='$yKey' and DocNo like '%$zKey%' and DocPID='0' order by DocDate desc, DocID desc<br>";
if ($this->SetQuery("select DocDate, DocNo, DocSubject, DocDate from Documents where RsID='$yKey' and DocNo like '%$zKey%' and DocPID='0' order by DocDate desc, DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByRsID3DocNoDocPID0($yKey,$DocNoSearch,$p,$q,$DocSubjectSearch){
if($DocNoSearch!=""){
$a="AND DocNo LIKE '%$DocNoSearch%'";
}
if($DocSubjectSearch!=""){
$b="and DocSubject like '%$DocSubjectSearch%'";
}
//echo "SELECT * FROM Documents WHERE RsID = '$yKey' $a $b and (DlcID= '$p' || DlcID= '$q') and (DsID!='0' && DsID!='6' && DsID!='7') ORDER BY DocDate DESC , DocID DESC<br>";
if ($this->SetQuery("SELECT * FROM Documents WHERE RsID = '$yKey' $a $b and (DlcID= '$p' || DlcID= '$q') and (DsID!='0' && DsID!='6' && DsID!='7') ORDER BY DocDate DESC , DocID DESC")){
return 1;
}else {
return 0;
}
}
function SearchDocRefAnsTable($yKey,$DocNoSearch,$p,$q,$DocSubjectSearch){
if($DocNoSearch!=""){
$a="AND DocNo LIKE '%$DocNoSearch%'";
}
if($DocSubjectSearch!=""){
$b="and DocSubject like '%$DocSubjectSearch%'";
}
//echo "SELECT * FROM Documents WHERE RsID = '$yKey' $a $b and (DlcID= '$p' || DlcID= '$q') and (DsID!='0' && DsID!='6' && DsID!='7') ORDER BY DocDate DESC , DocID DESC<br>";
if ($this->SetQuery("SELECT DocDate, DocNo, DocSubject, DocDate, DocID, DocDateCreate FROM Documents WHERE RsID = '$yKey' $a $b and (DlcID= '$p' || DlcID= '$q') and (DsID!='0' && DsID!='6' && DsID!='7') ORDER BY DocDate DESC , DocID DESC")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup,$printorder){
if($printorder==1){
$porder=" DocTypeNo desc ";
}else if($printorder==2){
$porder=" DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and DocDateCreate like '$start%'";
}else{
$c="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select * from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' order by $porder,DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDate($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup,$printorder,$edoc){
if($printorder==1){
$porder=" DocTypeNo desc ";
}else if($printorder==2){
$porder=" DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
$c="and DocDateCreate like '$selectdate%'";
if($edoc=='1'){
$d="and eDoc='Y'";
}
if ($this->SetQuery("select
DocPID, DocTypeNo, DocNo, DocDate, DocFrom,
DocTo, DocID, DocSubject, DocShortDesc, CertificatePs ,eDoc
from Documents
where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c $d and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDate_sendOutDocYN($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup,$printorder,$docsend){
if($printorder==1){
$porder=" DocTypeNo desc ";
}else if($printorder==2){
$porder=" DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
$c="and DocDateCreate like '$selectdate%'";
if($RsID==1 && $docsend=="Y"){
$d="and eDoc='Y' ";
}else if($RsID==1 && $docsend=="N"){
$d="and eDoc='' ";
}
if($RsID==2 && $docsend=="Y"){
$d="and endDoc='' ";
}else if($RsID==2 && $docsend=="N"){
$d="and endDoc='Y' ";
}
//echo "select DocPID, DocTypeNo, DocNo, DocDate, DocFrom,DocTo, DocID, DocSubject, DocShortDesc, CertificatePs ,eDoc from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' $d order by $porder";
if ($this->SetQuery("select
DocPID, DocTypeNo, DocNo, DocDate, DocFrom,
DocTo, DocID, DocSubject, DocShortDesc, CertificatePs ,eDoc
from Documents
where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' $d order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_Date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup,$edoc){
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and DocDateCreate like '$start%'";
}else{
$c="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if($edoc=='1'){
$d="and eDoc='Y'";
}
//echo "select DISTINCT date(DocDateCreate) as DocDateCreate from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' order by DocDateCreate desc";
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( DocDateCreate, ' ', 1 ) as DocDateCreate from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c $d and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_Date_sendOutDocYN($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup,$docsend){
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and DocDateCreate like '$start%'";
}else{
$c="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if($RsID==1 && $docsend=="Y"){
$d="and eDoc='Y' ";
}else if($RsID==1 && $docsend=="N"){
$d="and eDoc='' ";
}
if($RsID==2 && $docsend=="Y"){
$d="and endDoc='' ";
}else if($RsID==2 && $docsend=="N"){
$d="and endDoc='Y' ";
}
//echo "select DISTINCT date(DocDateCreate) as DocDateCreate from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' $d order by DocDateCreate desc";
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( DocDateCreate, ' ', 1 ) as DocDateCreate from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' $d order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectreg($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup,$printorder){
if($printorder==1){
$porder=" DocTypeNo desc ";
}else if($printorder==2){
$porder=" DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
$c="and DocDateCreate like '$selectdate%'";
//echo "select * from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DocGroup='$MaxDocGroup' order by DocTypeNo desc,DocDate desc";
if ($this->SetQuery("select DocPID, DocID, DocNo, DocDate, stdCode,
CertificatePs, DocSubject, DocShortDesc
from Documents
where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' and stdCode!='' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectreg_date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup){
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and DocDateCreate like '$start%'";
}else{
$c="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( DocDateCreate, ' ', 1 ) as DocDateCreate from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup='$MaxDocGroup' and stdCode!='' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptId($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$MaxDocGroup,$printorder,$edoc){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
if($edoc=='1'){
$d="and eDoc='Y'";
}
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc";
if ($this->SetQuery("select b.DlcID as DlcIDs ,a.DlcID,
a.DocPID, a.DocTypeNo, a.DocNo, a.DocDate,
a.DocFrom, a.DocTo, a.DocID, a.DocSubject, a.DocShortDesc,
a.CertificatePs, a.PtID ,a.eDoc
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c $d and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptId_sendOutDocYN($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$MaxDocGroup,$printorder,$docsend){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
if($RsID==1 && $docsend=="Y"){
$d="and a.eDoc='Y' ";
}else if($RsID==1 && $docsend=="N"){
$d="and a.eDoc='' ";
}
if($RsID==2 && $docsend=="Y"){
$d="and a.endDoc='' ";
}else if($RsID==2 && $docsend=="N"){
$d="and a.endDoc='Y' ";
}
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc";
if ($this->SetQuery("select b.DlcID as DlcIDs ,a.DlcID,
a.DocPID, a.DocTypeNo, a.DocNo, a.DocDate,
a.DocFrom, a.DocTo, a.DocID, a.DocSubject, a.DocShortDesc,
a.CertificatePs, a.PtID ,a.eDoc
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' $d order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptId_Date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$MaxDocGroup,$edoc){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if($edoc=='1'){
$d="and eDoc='Y'";
}
//echo "select DISTINCT date(DocDateCreate) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by DocDateCreate desc<br>";
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' and b.DlcIDSecond!='Y' $a $b $c $d and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptId_Date_sendOutDocYN($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$MaxDocGroup,$docsend){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
} //echo "select DISTINCT date(DocDateCreate) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by DocDateCreate desc<br>";
if($RsID==1 && $docsend=="Y"){
$d="and a.eDoc='Y' ";
}else if($RsID==1 && $docsend=="N"){
$d="and a.eDoc='' ";
}
if($RsID==2 && $docsend=="Y"){
$d="and a.endDoc='' ";
}else if($RsID==2 && $docsend=="N"){
$d="and a.endDoc='Y' ";
}
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' $d order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptIdreg($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$MaxDocGroup,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc";
if ($this->SetQuery("select b.DlcID as DlcIDs , a.DocPID, a.DocID,
a.DocNo, a.DocDate, a.stdCode, a.CertificatePs, a.DocSubject, a.DocShortDesc
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID and a.stdCode!='' and b.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptIdreg_date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$MaxDocGroup){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc";
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID and a.stdCode!='' and b.DlcIDSecond!='Y' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroup($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup){
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and DocDateCreate like '$start%'";
}else{
$c="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select * from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DocGroup!='$MaxDocGroup' order by DocTypeNo desc,DocDate desc";
if ($this->SetQuery("select * from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup!='$MaxDocGroup' order by DocTypeNo desc,DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupreg($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$MaxDocGroup){
if($DocTypeNoStart!=""){
$a="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and DocDateCreate like '$start%'";
}else{
$c="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select * from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DocGroup!='$MaxDocGroup' order by DocTypeNo desc,DocDate desc";
if ($this->SetQuery("select * from Documents where RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DocPID='0' $a $b $c and DsID!='0' and DsID!='6' and DsID!='7' and DocGroup!='$MaxDocGroup' and stdCode!='' order by DocTypeNo desc,DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreate_date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$selectPositionDeptID){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreate($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$selectPositionDeptID,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
if ($this->SetQuery("select a.DocPID, a.DocID, a.DocTypeNo, a.DocNo, a.DocDate, a.DocFrom, a.DocTo, a.DocSubject, a.DocShortDesc, a.CertificatePs
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreatereg_date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$selectPositionDeptID){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and a.stdCode!='' and b.DlcIDSecond!='Y' order by a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreatereg($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$selectPositionDeptID,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and stdCode!='' order by $porder";
if ($this->SetQuery("select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and a.stdCode!='' and b.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$printorder,$edoc){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
if($edoc==1){
$d="WHERE a.eDoc='Y'";
}
/*echo "select b.DlcID as DlcIDs ,a.DlcID, a.DocPID, a.DocID, a.DocTypeNo, a.DocNo,
a.DocFrom, a.DocTo, a.DtID, a.DocDate, a.stdCode, a.CertificatePs, a.DocSubject,a.DocShortDesc ,a.DocGroup,a.DsID,a.eDoc
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' $d order by $porder";*/
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID order by $porder,a.DocDate desc ";
if ($this->SetQuery("select b.DlcID as DlcIDs ,a.DlcID, a.DocPID, a.DocID, a.DocTypeNo, a.DocNo,
a.DocFrom, a.DocTo, a.DtID, a.DocDate, a.stdCode, a.CertificatePs, a.DocSubject,a.DocShortDesc ,a.DocGroup,a.DsID,a.eDoc
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' $d order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2_date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID order by $porder,a.DocDate desc ";
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by a.DocDate desc ")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2DocGroup($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$selectPositionDeptID,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID order by $porder";
if ($this->SetQuery("select b.DlcID as DlcIDs ,a.DocPID, a.DocID,a.DocIDHisNew,
a.DocTypeNo, a.DocNo, a.DocDate, a.DocFrom,
a.DocTo, a.DocSubject, a.DocShortDesc, a.DlcID, a.CertificatePs
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2DocGroup_date($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$selectPositionDeptID){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select b.DlcID as DlcIDs ,a.* from Documents a inner join Doclineconfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc ";
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by a.DocDate desc ")){
return 1;
}else {
return 0;
}
}
function askuser($xKey,$zKey,$s){
//if ($this->SetQuery("select * from Documents where DlcID= '$xKey' and DtID='$zKey' and RsID='$s'")){
if ($this->SetQuery("select * from Documents where DocID= '95'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID1Limit($xKey,$start,$pageSize,$RsID,$DtID){
if ($this->SetQuery("select DocID from Documents where DtID='$DtID' and RsID='$RsID' and fDelete!='Y' and DocID in(select DocID from DocReceiveSend where DocGroup='$xKey' and DsID='1' order by DrsReceiveDate desc) order by DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchViewRegisDocMainDeptLimit($xKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.DocSubject,a.DocFrom,a.DlcID,a.endDoc,a.DocDateCreate
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and
b.DocGroup='$xKey' and b.DsID='1' $ff
$aa $bb $ee $gg $col order by b.DrsReceiveDate desc ,a.DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchViewRegisDocMainDeptLimit13($xKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="and a.DocDate= ''";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.DocSubject,a.DocFrom,a.DlcID,a.endDoc,a.DocDateCreate
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and
b.DocGroup='$xKey' and b.DsID='1' $ff
$aa $bb $ee $gg $col order by b.DrsReceiveDate desc ,a.DocDateCreate desc,a.DocTypeNo desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID1($xKey,$RsID,$DtID){
if ($this->SetQuery("select DocID from Documents where DtID='$DtID' and RsID='$RsID' and fDelete!='Y' and DocID in(select DocID from DocReceiveSend where DocGroup='$xKey' and DsID='1' order by DrsReceiveDate desc)")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2Limit($xKey,$yKey,$zKey,$start,$pageSize,$RsID,$DtID){
//echo "select DocID from Documents where DtID='$DtID' and RsID='$RsID' and fDelete!='Y' and DocID in (select DocID from DocReceiveSend where DocGroup='$yKey' and DsID='1' and (DlcID= '$xKey' || DlcID='$zKey') order by DrsReceiveDate desc) order by DocDateCreate desc limit $start, $pageSize";
if ($this->SetQuery("select DocID from Documents where DtID='$DtID' and RsID='$RsID' and fDelete!='Y' and DocID in (select DocID from DocReceiveSend where DocGroup='$yKey' and DsID='1' and (DlcID= '$xKey' || DlcID='$zKey') order by DrsReceiveDate desc) order by DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchViewRegisDocNoMainDeptLimit($xKey,$yKey,$zKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){ //and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit '$start', '$pageSize'
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.DocSubject,a.DocFrom,a.DlcID,a.endDoc,a.DocDateCreate,a.eDoc
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and
a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' and
(b.DlcID= '$xKey' || b.DlcID='$zKey') $ff
$aa $bb $ee $gg $col order by b.DrsReceiveDate desc , a.DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchViewRegisDocNoMainDeptLimit2($yKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){ //and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit '$start', '$pageSize'
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.DocSubject,a.DocFrom,a.DlcID,a.endDoc,a.DocDateCreate,a.eDoc
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and
a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' $ff
$aa $bb $ee $gg $col order by b.DrsReceiveDate desc , a.DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchViewRegisDocNoMainDeptLimit13($xKey,$yKey,$zKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){ //and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit '$start', '$pageSize'
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}else if($selectdocdatevalue=="3"){
$ff="";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
if ($this->SetQuery("select a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.DocSubject,a.DocFrom,a.DlcID,a.endDoc,a.DocDateCreate
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and
b.DocGroup='$yKey' and b.DsID='1' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $aa $bb $ee $gg $col order by b.DrsReceiveDate desc , a.DocDateCreate desc,a.DocTypeNo desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2($xKey,$yKey,$zKey,$RsID,$DtID){
//echo "select * from DocReceiveSend where DocGroup='$yKey' and DsID='1' and (DlcID= '$xKey' || DlcID='$zKey') order by DrsReceiveDate desc<br>";
if ($this->SetQuery("select DocID from Documents where DtID='$DtID' and RsID='$RsID' and fDelete!='Y' and DocID in (select DocID from DocReceiveSend where DocGroup='$yKey' and DsID='1' and (DlcID= '$xKey' || DlcID='$zKey') order by DrsReceiveDate desc)")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2DrsReceiveDate($xKey,$yKey,$zKey,$RsID,$DtID,$monthe,$searchYear,$searchname){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
//echo "select a.*,b.* from Documents a inner join DocReceiveSend b on a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc";
if ($this->SetQuery("select a.DocID,b.DrsID from Documents a inner join DocReceiveSend b on a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' $aa order by b.DrsReceiveDate desc , a.DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchViewCountRegisDocNoMainDept($xKey,$yKey,$zKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
$this->SetQuery("select count(a.DocID) as num
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and
a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' and
(b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%'
$aa $bb $ee");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function CountDocDocDateCreateDeptRsIDDtID($xKey,$yKey,$zKey,$RsID,$DtID){
//echo "select max(DocID) as num from Documents where (DocDateCreate between '$xKey' and '$yKey') and RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DlcID in (select DlcID from DocLineConfig where deptId='$zKey')<br>";
$this->SetQuery("select max(DocID) as num from Documents where (DocDateCreate between '$xKey' and '$yKey') and RsID='$RsID' and DtID='$DtID' and fDelete!='Y' and DlcID in (select DlcID from DocLineConfig where deptId='$zKey' and DlcIDSecond!='Y')");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function CountDocSumTrimesterDocDateCreateDeptIDTypeDoc($xKey,$yKey,$zKey,$DtID){
//echo "select max(DocID) as num from Documents where (DocDateCreate between '$xKey' and '$yKey') and DtID='$DtID' and fDelete!='Y' and DlcID in (select DlcID from DocLineConfig where deptId='$zKey')";
$this->SetQuery("select max(DocID) as num from Documents where (DocDateCreate between '$xKey' and '$yKey') and DtID='$DtID' and fDelete!='Y' and DlcID in (select DlcID from DocLineConfig where deptId='$zKey' and DlcIDSecond!='Y' )");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3DrsSend2($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$DLCID,$MaxDocGroup,$DlcPS){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and b.DrsSendDate like '$start%'";
}else{
$c="and b.DrsSendDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
//echo "select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and (b.DlcID='$DLCID' || b.DlcID='$DlcPS') and b.DocGroup='$MaxDocGroup' and b.DrsSend='Y' order by b.DrsSendDate desc";
if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and (b.DlcID='$DLCID' || b.DlcID='$DlcPS') and b.DocGroup='$MaxDocGroup' and b.DrsSend='Y' order by b.DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3DrsSendSeeAll2($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$DLCID,$MaxDocGroup,$DlcPS){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and b.DrsSendDate like '$start%'";
}else{
$c="and b.DrsSendDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
//echo "select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' order by b.DrsSendDate desc";
if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' order by b.DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDocGroupDsID3($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$printorder){
if($printorder==1){
$porder=" b.DrsSendDate desc, a.DocTypeNo desc "; // 2015/07/09 - CHAIN ADD b.DrsSendDate desc,
}else if($printorder==2){
$porder=" b.DrsSendDate asc, a.DocTypeNo asc "; // 2015/07/09 - CHAIN ADD b.DrsSendDate asc,
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and b.DrsSendDate like '$start%'";
}else{
$c="and b.DrsSendDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
//echo "select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and b.PtID!='1' and b.DrsDocDueDate!='0000-00-00' order by b.DrsSendDate desc";
if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b inner join DocLineConfig c on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and b.PtID!='1' and b.DrsDocDueDate!='0000-00-00' and b.DlcID = c.DlcID and c.deptId = '$deptId' and c.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID32($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$DLCID,$MaxDocGroup,$DlcPS){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and b.DrsSendDate like '$start%'";
}else{
$c="and b.DrsSendDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
//echo "select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and (b.DlcID='$DLCID' || b.DlcID='$DlcPS') and b.DocGroup='$MaxDocGroup' order by b.DrsSendDate desc";
if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and (b.DlcID='$DLCID' || b.DlcID='$DlcPS') and b.DocGroup='$MaxDocGroup' order by b.DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDocGroupDsID322($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$PtID,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and b.DrsSendDate like '$start%'";
}else{
$c="and b.DrsSendDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
if($PtID=='all'){
$dd="order by a.PtID asc,$porder ";
}else{
$dd="and a.PtID='$PtID' order by $porder";
}
if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b inner join DocLineConfig c on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and c.DlcIDSecond!='Y' and b.DlcID = c.DlcID and c.deptId = '$deptId' $dd")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3PS($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$PS,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$aa="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$bb="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$cc="and b.DrsReceiveDate like '$start%'";
}else{
$cc="and b.DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$ee="and a.DocNo like '%$DocNo%'";
}
//echo "select a.DocID,b.* from Documents a inner join DocReceiveSend b on b.personId='$PS' $aa $bb $cc $ee and b.PtID!='1' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and a.fDelete!='Y' and b.DrsDocDueDate!='0000-00-00' order by b.DrsReceiveDate desc";
//if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID from Documents a inner join DocReceiveSend b on a.fDelete!='Y' $a $b $c $e and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and b.PtID!='1' and b.personId='$PS' order by b.DrsSendDate desc")){
if ($this->SetQuery("select a.DocID,a.DocDateCreate,b.* from Documents a inner join DocReceiveSend b on b.personId='$PS' $aa $bb $cc $ee and b.PtID!='1' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and a.fDelete!='Y' and b.DrsDocDueDate!='0000-00-00' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3PS2($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$PS,$PtID,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$aa="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$bb="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$cc="and b.DrsReceiveDate like '$start%'";
}else{
$cc="and b.DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$ee="and a.DocNo like '%$DocNo%'";
}
if($PtID=='all'){
$dd="order by $porder,a.PtID asc";
}else{
$dd="and a.PtID='$PtID' order by $porder";
}
//echo "select a.DocID,a.PtID,a.DocDateCreate,b.* from Documents a inner join DocReceiveSend b on b.personId='$PS' $aa $bb $cc $ee and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and a.fDelete!='Y' $dd ";
if ($this->SetQuery("select a.DocID,a.PtID,a.DocDateCreate,b.* from Documents a inner join DocReceiveSend b on b.personId='$PS' $aa $bb $cc $ee and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and a.fDelete!='Y' $dd ")){
return 1;
}else {
return 0;
}
}
function searchSelectPostDoc($xKey){
//echo "select * from Documents where AnID= '$xKey' and DocMainPost='Y' and DocGetPost='' and DocGroup='$yKey' and DocstartDatePost!='0000-00-00' and DocendDatePost!='0000-00-00' ";
if ($this->SetQuery("select * from Documents where AnID= '$xKey' and DocMainPost='Y' and DocGetPost='' and DocstartDatePost!='0000-00-00' and DocendDatePost!='0000-00-00' ")){
return 1;
}else {
return 0;
}
}
function searchSelectedPostDoc($xKey,$start,$end,$DocSubject,$DocNo){
if($start==$end){
$cc="and DocDateGetPost like '$start%'";
}else{
$cc="and DocDateGetPost between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocSubject!=""){
$bb="and DocSubject like '%$DocSubject%'";
}
if($DocNo!=""){
$ee="and DocNo like '%$DocNo%'";
}
//echo "select * from Documents where AnID= '$xKey' and DocMainPost='Y' and DocGetPost!='' and DocGetPost!='0' and DocGroup='$yKey' and DocstartDatePost!='0000-00-00' and DocendDatePost!='0000-00-00' $cc $bb $ee order by DocDateGetPost desc";
if ($this->SetQuery("select * from Documents where AnID= '$xKey' and DocMainPost='Y' and DocGetPost!='' and DocGetPost!='0' and DocstartDatePost!='0000-00-00' and DocendDatePost!='0000-00-00' $cc $bb $ee order by DocDateGetPost desc")){
return 1;
}else {
return 0;
}
}
function SearchByDocPIDAnIDnot0($xKey){
if ($this->SetQuery("select * from Documents where DocPID= '$xKey' and AnID!=0")){
return 1;
}else {
return 0;
}
}
function SearchByDocPID($xKey){
if ($this->SetQuery("select * from Documents where DocPID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDAnID($xKey){
if ($this->SetQuery("select * from Documents where DocID='$xKey' and AnID!=0")){
return 1;
}else {
return 0;
}
}
function SearchByAnID($xKey){
if ($this->SetQuery("select * from Documents where AnID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocTypeNoDocSubjectDocNoDeptIdfDeleteDocPID0($DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$start,$end,$checkselectDate){
if($DocTypeNoStart!=""){
$aa="and DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$bb="and DocSubject like '%$DocSubject%'";
}
if($DocNo!=""){
$ee="and DocNo like '%$DocNo%'";
}
if($checkselectDate=="Y"){
if($start==$end){
$cc="and DocDateCreate like '$start%'";
}else{
$cc="and DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
}
//echo "select * from Documents where DocPID='0' $aa $bb $ee $cc and fDelete !='Y' order by DocDateCreate desc";
if ($this->SetQuery("select * from Documents where DocPID='0' $aa $bb $ee $cc and fDelete !='Y' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function CheckDocNo($xKey){
$this->SetQuery("select DocID as num from Documents where DtID=1 and RsID=1 and DocNo= '$xKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupDlcID2DsID0DrsSendDate($DlcID,$DlcID2,$maxgroup){
if ($this->SetQuery("select * from Documents where DocGroup='$maxgroup' and DsID=0 and (DlcID='$DlcID' or DlcID='$DlcID2') order by DocDateCreate desc , DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchCountDocReceive($DlcID,$DlcID2,$maxgroup){
$this->SetQuery("select count(DocID) as num from Documents where DocGroup='$maxgroup' and DsID=0 and (DlcID='$DlcID' or DlcID='$DlcID2')");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDlcIDstatusNoGetJoin($xKey,$yKey,$searchName,$searchNo){
if($searchName!="" && $searchNo==""){
$q="and b.DocSubject like '%$searchName%'";
}else if($searchName=="" && $searchNo!=""){
$q="and b.DocNo like '%$searchNo%'";
}else if($searchName!="" && $searchNo!=""){
$q="and b.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%'";
}
if ($this->SetQuery("select a.dfID,b.DtID,b.DocFrom,b.DocPID,b.DlcID,b.RsID,b.DocID,b.DocSubject,b.DslID,b.DclID
from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='' and a.DocGroup ='$yKey' and a.DocID=b.DocID $q")){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSign($xKey,$yKey,$monthe,$searchYear,$searchName,$searchNo){
if($searchName!="" && $searchNo==""){
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocSubject like '%$searchName%'";
}else if($searchName=="" && $searchNo!=""){
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocNo like '%$searchNo%'";
}else if($searchName!="" && $searchNo!=""){
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%'";
}else{
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID";
}
$this->SetQuery($q);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchGetDocForSignLimit($xKey,$yKey,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo){
if($searchName!="" && $searchNo==""){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocSubject like '%$searchName%' order by a.getDate desc limit $start, $pageSize";
}else if($searchName=="" && $searchNo!=""){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' order by a.getDate desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%' order by a.getDate desc limit $start, $pageSize";
}else{
$q="select a.*,b.* from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='Y' and a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID order by a.getDate desc limit $start, $pageSize";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSignDlcIDLimit($yKey,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo,$DlcID,$DlcID2){
if($searchName!="" && $searchNo==""){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocSubject like '%$searchName%' and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') order by a.getDate desc limit $start, $pageSize";
}else if($searchName=="" && $searchNo!=""){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocNo like '%$searchNo%' and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') order by a.getDate desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%' and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') order by a.getDate desc limit $start, $pageSize";
}else{
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') order by a.getDate desc limit $start, $pageSize";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSignDlcID($yKey,$monthe,$searchYear,$searchName,$searchNo,$DlcID,$DlcID2){
if($searchName!="" && $searchNo==""){
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocSubject like '%$searchName%' and (a.DlcID='$DlcID' || a.DlcID='$DlcID2')";
}else if($searchName=="" && $searchNo!=""){
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocNo like '%$searchNo%' and (a.DlcID='$DlcID' || a.DlcID='$DlcID2')";
}else if($searchName!="" && $searchNo!=""){
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and b.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%' and (a.DlcID='$DlcID' || a.DlcID='$DlcID2')";
}else{
$q="select count(b.DocID) as num from docforsign a inner join Documents b on a.DocforsignEdit='' and a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and (a.DlcID='$DlcID' || a.DlcID='$DlcID2')";
}
//echo $q;
$this->SetQuery($q);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchGetDocForSignDlcID2($yKey,$DlcID,$DlcID2,$searchName,$searchNo){
if($searchName!="" && $searchNo==""){
$q="and b.DocSubject like '%$searchName%'";
}else if($searchName=="" && $searchNo!=""){
$q="and b.DocNo like '%$searchNo%'";
}else if($searchName!="" && $searchNo!=""){
$q="and b.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%'";
}
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.statusGet='' and a.DocID=b.DocID and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') $q order by a.getDate desc";
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchCountDocIDByDlcIDDocGroupPSDlcID2DsID0DrsSendDate($xKey,$yKey,$zKey4){
//echo "select a.*,b.DrsID,b.DrsFromDrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' order by a.DocDateCreate desc , a.DocID desc";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountDocIDByDlcIDDocGroupPSDlcID2DsID3DrsSendDateDrsSEndnotY2($xKey,$yKey,$zKey4,$dlcid){
//echo "select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15'))<br>";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15'))");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountDocIDByDocGroupDsID2DocIDDlcIDDrsReceiveDlcID2Status2($xKey,$yKey,$zKey){
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey')");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountDocIDByDocGroupDsID2DocIDDlcIDDrsReceiveDlcID2StatusR($xKey,$yKey,$zKey){
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') and b.DrsWSign!='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByViewRegisDoc($xKey){
if ($this->SetQuery("select DocID, DocTypeNo, DtID, DocNo, DocDate, DocSubject,
DocFrom, DlcID, endDoc, DocDateCreate
from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByKeyName($xKey,$name){
if ($this->SetQuery("select $name from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocSignpage($xKey){
if ($this->SetQuery("select DtID, DocNo, DocFrom, DocPID, DlcID, DocID, DocSubject from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchBySendDoc($xKey){
if ($this->SetQuery("select DocTypeNo, DtID, DocNo, DocFrom, DocPID, DlcID, RsID, DocID, DocSubject from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchRepSumRegisDoc($RsID,$DtID,$start,$end,$deptId){
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select count(a.DocID) as num from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupDlcID2DsID0DrsSendDate_Update($DlcID,$DlcID2,$maxgroup){
//echo "update Documents set DlcID='$DlcID', DocUserCreate='$DlcID' where DocGroup='$maxgroup' and DsID=0 and (DlcID='$DlcID' or DlcID='$DlcID2')<br>";
if ($this->SetQuery("update Documents set DlcID='$DlcID', DocUserCreate='$DlcID' where DocGroup='$maxgroup' and DsID=0 and (DlcID='$DlcID' or DlcID='$DlcID2')")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDlcID2DsID0DrsSendDateDocID($DlcID,$DlcID2,$maxgroup){
//echo "select DocID from Documents where DocGroup='$maxgroup' and DsID=0 and (DlcID='$DlcID' or DlcID='$DlcID2')<br>";
if($this->SetQuery("select DocID from Documents where DocGroup='$maxgroup' and DsID=0 and (DlcID='$DlcID' or DlcID='$DlcID2')")){
return 1;
}else {
return 0;
}
}
function SearchViewRegisDocMainDept13($xKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
$sql="select count(a.DocID) as num
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and
b.DocGroup='$xKey' and b.DsID='1' $ff
$aa $bb $ee $gg";
$this->SetQuery($sql);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchViewRegisDocMainDept($xKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
$sql="select count(a.DocID) as num
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and
b.DocGroup='$xKey' and b.DsID='1' $ff
$aa $bb $ee $gg";
$this->SetQuery($sql);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchViewRegisDocNoMainDept13($xKey,$yKey,$zKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){ //and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit '$start', '$pageSize'
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
$sql="select count(a.DocID) as num
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and a.DocID=b.DocID and
b.DocGroup='$yKey' and b.DsID='1' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $aa $bb $ee $gg";
$this->SetQuery($sql);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchViewRegisDocNoMainDept($xKey,$yKey,$zKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){ //and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit '$start', '$pageSize'
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
$sql="select count(a.DocID) as num
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and
a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' and
(b.DlcID= '$xKey' || b.DlcID='$zKey') $ff
$aa $bb $ee $gg";
$this->SetQuery($sql);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchViewRegisDocNoMainDept2($yKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo,$searchTypeNoF,$searchTypeNoT,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff,$college){ //and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit '$start', '$pageSize'
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
if($searchNo!=""){
$bb="and a.DocNo like '%$searchNo%'";
}
if($searchTypeNoF!="" || $searchTypeNoT!=""){
$ee="and a.DocTypeNo between '$searchTypeNoF' and '$searchTypeNoT'";
}
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsReceiveDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$gg="and a.$forfolderstaff='$folderstaff'";
}
if($college!="all" && $college!=""){
$col="and a.DocFrom like '%$college%'";
}
$sql="select count(a.DocID) as num
from Documents a inner join DocReceiveSend b on
a.DtID='$DtID' and a.RsID='$RsID' and a.fDelete!='Y' and
a.DocID=b.DocID and b.DocGroup='$yKey' and b.DsID='1' $ff
$aa $bb $ee $gg $col";
$this->SetQuery($sql);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDlcID($xKey){
$this->SetQuery("select DlcID as num from Documents where DocID= '$xKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDocID($xKey){
if($this->SetQuery("select DocID,DocPID from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchDtID($xKey){
if($this->SetQuery("select DtID from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchDocReceive($xKey,$yKey,$zKey4,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select a.DtID,a.DocDate,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.CertificatePs,a.DocSubject,a.DslID,a.DclID,a.DtID,a.eDoc,
b.DrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b
on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' $aa $bb
order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchRegisDocMainDeptsearchDoc($yKey,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,a.RsID,a.DtID,
b.DrsID,b.DrsFromDrsID,a.DocPID
from Documents a inner join DocReceiveSend b on
a.DocGroup='$yKey' and a.fDelete!='Y' and
(a.DsID='1' or a.DsID='2') and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsflagRead!='N' $aa $bb
order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchRegisDocNoMainDeptsearchDoc($xKey,$yKey,$zKey3,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DocTypeNo,a.DtID,a.DocNo,a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,a.eDoc,
b.DrsID,b.DrsFromDrsID,a.DocPID,a.RsID,a.DtID
from Documents a inner join DocReceiveSend b on
a.DocGroup='$yKey' and
a.fDelete!='Y' and (a.DsID='1' or a.DsID='2') and a.DsID = b.DsID and
(a.DlcID= '$xKey' || a.DlcID='$zKey3') and a.DocID=b.DocID and b.DrsflagRead!='N' $bb
order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchSignDocRsearchDoc($xKey,$yKey,$zKey,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select
a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,
b.DrsID, b.DrsWSign,a.RsID
from Documents a inner join DocReceiveSend b
on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and
a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') and
b.DrsWSign!='Y' $aa $bb order by a.DocDateCreate desc , b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchSignDocsearchDoc($xKey,$yKey,$zKey,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select
a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,
b.DrsID, b.DrsWSign ,a.RsID
from Documents a inner join DocReceiveSend b on
a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and
a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') $aa $bb
order by a.DocDateCreate desc , b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchSendDocDrsSEndsearchDoc($xKey,$yKey,$zKey4,$dlcid,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc ,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $bb order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchSendDocDrsSEndnotY2searchDoc($xKey,$yKey,$zKey4,$dlcid,$searchNo,$searchDocSubject){
if($searchNo!=""){
$aa="and a.DocNo like '%$searchNo%'";
}
if($searchDocSubject!=""){
$bb="and a.DocSubject like '%$searchDocSubject%'";
}
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and b.DLCID='$dlcid' and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $bb order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchCountDocInFolder($folderstaff,$forfolderstaff){
$this->SetQuery("select count(DocID) as num from Documents where $forfolderstaff='$folderstaff'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreateCenter($RsID,$DtID,$selectdate,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup,$printorder){
if($printorder==1){
$porder=" a.DocTypeNo desc ";
}else if($printorder==2){
$porder=" a.DocTypeNo asc ";
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
$c="and a.DocDateCreate like '$selectdate%'";
if ($this->SetQuery("select a.DocPID, a.DocID, a.DocTypeNo, a.DocNo, a.DocDate, a.DocFrom, a.DocTo, a.DocSubject, a.DocShortDesc, a.CertificatePs
from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreate_dateCenter($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocGroup){
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select DISTINCT SUBSTRING_INDEX( a.DocDateCreate, ' ', 1 ) as DocDateCreate from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' and a.DocPID='0' $a $b $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and a.DocGroup='$DocGroup' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y' order by a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchCountSendDocFirstPage($xKey,$yKey,$zKey4){
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15'))");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDocIDDoc_tsr_id($a){
$this->SetQuery("select DocID as num from Documents where Doc_tsr_id='$a'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDocIDTHeGIF($xKey){
if ($this->SetQuery("select DocSubject,DocNo,DocDate,DslID,DclID from Documents where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function updateDoc_Letter_ID($DocID,$cd_Letter_ID){
if ($this->SetQuery("update Documents set Doc_Letter_ID='$cd_Letter_ID' where DocID='$DocID'")){
return 1;
}else {
return 0;
}
}
function SearchRepDocNoSumReceiveDoc($RsID,$DtID,$startT,$endT,$searchDocNo){
if($startT==$endT){
$c="and DocDateCreate like '$startT%'";
}else{
$c="and DocDateCreate between '$startT 00:00:00' and '$endT 23:59:59'";
}
$this->SetQuery("select count(DocID) as num from Documents where RsID=$RsID and DtID=$DtID and fDelete!='Y' and DocPID='0' $c and eDoc!='Y' and DocNo like '%$searchDocNo%' ");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchRepSumRegisDocSecretLevel($DtID,$start,$end,$deptId,$typelevel,$typelevelID){
if($start==$end){
$c="and a.DocDateCreate like '$start%'";
}else{
$c="and a.DocDateCreate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select count(a.DocID) as num from Documents a inner join DocLineConfig b on a.RsID='$RsID' and a.DtID='$DtID' and a.fDelete!='Y' $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID";
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocLineConfig b on a.DtID='$DtID' and a.fDelete!='Y' and a.$typelevel='$typelevelID' $c and a.DsID!='0' and a.DsID!='6' and a.DsID!='7' and b.deptId='$deptId' and a.DlcID=b.DlcID and b.DlcIDSecond!='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDetailReceiveMoblie($xKey,$yKey,$zKey4){
if ($this->SetQuery("select a.DtID,a.DocDate,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.CertificatePs,a.DocSubject,a.DslID,a.DclID,a.DtID,a.eDoc,b.DrsID,b.DrsReceiveDate from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='0' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchDetailSignMoblie($xKey,$yKey,$zKey,$buddy){
if ($this->SetQuery("select a.DocFrom, a.RsID,a.RsID, a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,b.DrsID, b.DrsWSign from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and ((b.DlcID= '$yKey' || b.DlcID= '$zKey') || (b.DlcID='$buddy' && b.DrsSendDate='0000-00-00 00:00:00')) order by a.DocDateCreate desc , b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchDetailSignMoblie2($xKey,$yKey,$zKey){
if ($this->SetQuery("select a.DocFrom, a.RsID, a.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,a.eDoc,a.DocDate,b.DrsID, b.DrsWSign from Documents a inner join DocReceiveSend b on a.DocGroup='$xKey' and a.DsID='2' and a.DsID=b.DsID and a.DocID=b.DocID and (b.DlcID= '$yKey' || b.DlcID= '$zKey') order by a.DocDateCreate desc , b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchSendDocMoblie($xKey,$yKey,$zKey4,$dlcid){
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc ,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) order by a.DocDateCreate desc , a.DocID desc ")){
return 1;
}else {
return 0;
}
}
function SearchSendDocMoblie2($xKey,$yKey,$zKey4,$dlcid){
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSignDlcIDMoblie($yKey,$DlcID,$DlcID2){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.statusGet='' and a.DocID=b.DocID and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') and a.DocforsignEdit='' order by a.getDate desc";
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSignDlcIDDocforsignEditMoblie($yKey,$DlcID,$DlcID2){
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocGroup ='$yKey' and b.DocGroup='$yKey' and a.statusGet='' and a.DocID=b.DocID and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') and a.DocforsignEdit='Y' order by a.getDate desc";
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function updateDocNoDocTypeNofromCenter($DocID,$DocTypeNo,$DocNo){
//echo "update Documents set DocTypeNo='$DocTypeNo' , DocNo='$DocNo' where DocID='$DocID' ";
if ($this->SetQuery("update Documents set DocTypeNo='$DocTypeNo' , DocNo='$DocNo', DocNofromCenter='Y' where DocID='$DocID' ")){
return 1;
}else {
return 0;
}
}
function SearchCountSendDocDrsSEndnotY3($xKey,$yKey,$zKey4,$dlcid,$searchnamePre,$searchNoPre,$searchpredocdate,$selectpredocdatevalue,$selectpreDtID,$folderstaff,$forfolderstaff,$searchPreTypeNoF,$searchPreTypeNoT,$searchDeptPre,$DlcID3,$DlcID4){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($selectpreDtID!=''){
$gg="and a.DtID= '$selectpreDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchDeptPre!=""){
$ii="and a.DocFrom like '%$searchDeptPre%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4' || a.DlcID= '$DlcID3' || a.DlcID= '$DlcID4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $cc $ff $gg $hh $ii $jj");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSendDocDrsSEndnotY2limit2($xKey,$yKey,$zKey4,$dlcid,$start,$pageSize,$searchnamePre,$searchNoPre,$searchpredocdate,$selectpredocdatevalue,$selectpreDtID,$folderstaff,$forfolderstaff,$searchPreTypeNoF,$searchPreTypeNoT,$searchDeptPre,$DlcID3,$DlcID4){
if($searchnamePre!=""){
$aa="and a.DocSubject like '%$searchnamePre%'";
}
if($searchNoPre!=""){
$cc="and a.DocNo like '%$searchNoPre%'";
}
if($selectpredocdatevalue=="0" || $selectpredocdatevalue==""){
$ff="";
}else if($selectpredocdatevalue=="1"){
$ff="and a.DocDate= '$searchpredocdate'";
}
if($selectpreDtID!=''){
$gg="and a.DtID= '$selectpreDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchDeptPre!=""){
$ii="and a.DocFrom like '%$searchDeptPre%'";
}
if($searchPreTypeNoF!="" || $searchPreTypeNoT!=""){
$jj="and a.DocTypeNo between '$searchPreTypeNoF' and '$searchPreTypeNoT'";
}
if ($this->SetQuery("select
a.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID, a.DocDate,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID, a.eDoc,b.DrsID
from Documents a inner join DocReceiveSend b on (a.DlcID= '$xKey' || a.DlcID= '$zKey4' || a.DlcID='$DlcID3' || a.DlcID='$DlcID4') and a.DocGroup='$yKey' and a.fDelete!='Y' and a.DsID='3' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsSend!='Y' and ((a.DtID='15' && a.DocPID='0') || (a.DtID!='15')) $aa $cc $ff $gg $hh $ii $jj order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function searchDocPost($xKey,$today){
$cc="and DocstartDatePost <= '$today' and DocendDatePost >= '$today'";
if ($this->SetQuery("select * from Documents where AnID= '$xKey' and DocMainPost='Y' and DocGetPost='Y' and DocstartDatePost!='0000-00-00' and DocendDatePost!='0000-00-00' $cc order by DocDateGetPost desc")){
return 1;
}else {
return 0;
}
}
//==================================================================================
//=== CHAIN ADD FUNCTION ===========================================================
//=== DATE 2015/03/25 ==============================================================
//==================================================================================
function SearchDocByDoc_tsr_id($a){ // Search Document By Doc_tsr_id
if ($this->SetQuery("SELECT deptName, prefixId, fName, lName, DlpName, DocDateCreate, DocDate, DocTypeNo
FROM Documents INNER JOIN Person
ON DocUserCreate = personId
INNER JOIN DocLineConfig
ON Documents.DlcID = DocLineConfig.DlcID
INNER JOIN Department
ON Department.deptId = DocLineConfig.deptId
INNER JOIN DocLinePosition
ON DocLinePosition.DlpID = DocLineConfig.DlpID
WHERE DocID='$a' AND Doc_tsr_id!=''")){
return 1;
}else {
return 0;
}
}
// === CHAIN Create 2015/04/09 ===============================
function searchDocIDByDocNo($a){
$this->SetQuery("SELECT DocID AS num
FROM Documents
WHERE DocNo LIKE '$a' AND DocPID = '0'
ORDER BY `Documents`.`DocDateCreate` DESC");
if ($result=$this->GetResult()) {
return $result['num'];
}
} // END function searchDocIDByDocNo()
// ===========================================================
// === Jack ========================
function SelectDataBookTenyear(){
$C_year=date("Y")+543;
$DlcID=$_SESSION['DLCID'];
// echo "SELECT *,MAX(DrsID) AS Drsmax
// FROM Documents
// LEFT JOIN DocReceiveSend on Documents.DocID = DocReceiveSend.DocID
// WHERE DocReceiveSend.DlcID = '$DlcID' AND '$C_year'-YEAR(Documents.DocDate) > '10'
// Group by(Documents.DocID)
// ORDER BY Documents.DocDate DESC"; DIE;
$this->SetQuery("SELECT *,MAX(DrsID) AS Drsmax
FROM Documents
LEFT JOIN DocReceiveSend on Documents.DocID = DocReceiveSend.DocID
WHERE DocReceiveSend.DlcID = '$DlcID' AND '$C_year'-YEAR(Documents.DocDate) > '10'
Group by(Documents.DocID)
ORDER BY Documents.DocDate DESC");
return 1;
}
function searchDocument($searchPreName,$searchPreNo,$searchDeptPre,$datadate,$DlcID,$year_result){
$C_year=date("Y")+543;
if($searchPreName != "")
{
$searchPreName = 'AND Documents.DocSubject LIKE "%'.$searchPreName.'%"';
}
else
{
$searchPreName = '';
}
if($searchPreNo != "")
{
$searchPreNo = 'AND Documents.DocNo LIKE "%'.$searchPreNo.'%"';
}
else
{
$searchPreNo = '';
}
if($searchDeptPre != "")
{
$searchDeptPre = 'AND Documents.DocFrom LIKE "%'.$searchDeptPre.'%"';
}
else
{
$searchDeptPre = '';
}
if($datadate != "1")
{
//$Date_all = $Date_all;
$datadate = 'AND Documents.DocDate LIKE "%'.$datadate.'%"';
}
else
{
$datadate = '';
}
if($year_result != "2")
{
$result=$C_year-$year_result;
$year_result=$result-1;
$year_result = 'AND YEAR(Documents.DocDate) LIKE "%'.$year_result.'%"';
}
else
{
$year_result = '';
}
// echo "SELECT *,MAX(DrsID) AS Drsmax
// FROM Documents
// LEFT JOIN DocReceiveSend on Documents.DocID = DocReceiveSend.DocID
// WHERE DocReceiveSend.DlcID = '$DlcID' AND '$C_year'-YEAR(Documents.DocDate) > '10' $searchPreName $searchPreNo $searchDeptPre $Date_all $year_result
// Group by(Documents.DocID)
// ORDER BY Documents.DocDate DESC";
// DIE;
$this->SetQuery("SELECT *,MAX(DrsID) AS Drsmax
FROM Documents
LEFT JOIN DocReceiveSend on Documents.DocID = DocReceiveSend.DocID
WHERE DocReceiveSend.DlcID = '$DlcID' AND '$C_year'-YEAR(Documents.DocDate) > '10' $searchPreName $searchPreNo $searchDeptPre $datadate $year_result
Group by(Documents.DocID)
ORDER BY Documents.DocDate DESC");
return 1;
}
function searchDocument_temp($searchPreName,$searchPreNo,$searchDeptPre,$datadate,$datadate2,$DlcID,$year_result){
$C_year=date("Y")+543;
if($searchPreName != "")
{
$searchPreName = 'AND temp_Documents.DocSubject LIKE "%'.$searchPreName.'%"';
}
else
{
$searchPreName = '';
}
if($searchPreNo != "")
{
$searchPreNo = 'AND temp_Documents.DocNo LIKE "%'.$searchPreNo.'%"';
}
else
{
$searchPreNo = '';
}
if($searchDeptPre != "")
{
$searchDeptPre = 'AND temp_Documents.DocFrom LIKE "%'.$searchDeptPre.'%"';
}
else
{
$searchDeptPre = '';
}
if($datadate != "1")
{
//$Date_all = $Date_all;
$datadate = 'AND temp_Documents.DocDate LIKE "%'.$datadate.'%"';
}
else
{
$datadate = '';
}
if($year_result != "2")
{
$result=$C_year-$year_result;
$year_result=$result-1;
$year_result = 'AND YEAR(temp_Documents.DocDate) LIKE "%'.$year_result.'%"';
}
else
{
$year_result = '';
}
if($datadate2 != "3")
{
//$DateDelete = convert_Date_not_tranfrom_year2($DateDelete);
$datadate2 = 'AND temp_Documents.DateDel LIKE "%'.$datadate2.'%"';
}
else
{
$datadate2 = '';
}
// echo "SELECT *,MAX(DrsID) AS Drsmax
// FROM Documents
// LEFT JOIN DocReceiveSend on Documents.DocID = DocReceiveSend.DocID
// WHERE DocReceiveSend.DlcID = '$DlcID' AND '$C_year'-YEAR(Documents.DocDate) > '10' $searchPreName $searchPreNo $searchDeptPre $Date_all $year_result
// Group by(Documents.DocID)
// ORDER BY Documents.DocDate DESC";
// DIE;
$this->SetQuery("SELECT *,MAX(DrsID) AS Drsmax
FROM temp_Documents
LEFT JOIN temp_DocReceiveSend on temp_Documents.DocID = temp_DocReceiveSend.DocID
WHERE '$C_year'-YEAR(temp_Documents.DocDate) > '10' $searchPreName $searchPreNo $searchDeptPre $datadate $year_result $datadate2
Group by(temp_Documents.DocID)
ORDER BY temp_Documents.DocDate DESC");
return 1;
}
function diff_date($Doc_date){
$expiryHost = $Doc_date; #วันที่ต้องการนำไปเปรียบเทียบ
$strdate = explode("-",$expiryHost);
$d1= mktime(0, 0, 0, date('m'), date('d'), date('Y')+543);
$d2= mktime(0, 0, 0, $strdate['1'], $strdate['2'], $strdate['0']);
$result=floor(($d1-$d2)/31536000);
return $result;
}
function get_data($DocID){
$this->SetQuery("SELECT *
FROM Documents
WHERE Documents.DocID = '$DocID'");
return 1;
}
function get_data_temp($DocID){
$this->SetQuery("SELECT *
FROM temp_Documents
WHERE temp_Documents.DocID = '$DocID'");
return 1;
}
function insert_document_temp($arr){
$sql = "insert into temp_Documents values(
'".th2a($arr['DocID'])."',
'".th2a($arr['DocPID'])."',
'".th2a($arr['DlcID'])."',
'".th2a($arr['PtID'])."',
'".th2a($arr['DtID'])."',
'".th2a($arr['DslID'])."',
'".th2a($arr['DclID'])."',
'".th2a($arr['DsID'])."',
'".th2a($arr['RsID'])."',
'".th2a($arr['DocDateCreate'])."',
'".th2a($arr['DocUserCreate'])."',
'".th2a($arr['DocTypeNo'])."',
'".th2a($arr['DocDate'])."',
'".th2a($arr['DocNo'])."',
'".th2a($arr['DocSubject'])."',
'".th2a($arr['DocFrom'])."',
'".th2a($arr['DocTo'])."',
'".th2a($arr['DocShortDesc'])."',
'".th2a($arr['DocSpeedLevelDueDate'])."',
'".th2a($arr['DocStart'])."',
'".th2a($arr['DocFinish'])."',
'".th2a($arr['DocGroup'])."',
'".th2a($arr['DocRef'])."',
'".th2a($arr['DocCircular'])."',
'".th2a($arr['DocfCir'])."',
'".th2a($arr['DocOther'])."',
'".th2a($arr['CertificatePs'])."',
'".th2a($arr['fDelete'])."',
'".th2a($arr['endDoc'])."',
'".th2a($arr['sendToPs'])."',
'".th2a($arr['AnID'])."',
'".th2a($arr['DocRefAns'])."',
'".th2a($arr['DocRefAnsID'])."',
'".th2a($arr['DocstartDatePost'])."',
'".th2a($arr['DocendDatePost'])."',
'".th2a($arr['DocMainPost'])."',
'".th2a($arr['DocGetPost'])."',
'".th2a($arr['DocShowInOut'])."',
'".th2a($arr['DocDateGetPost'])."',
'".th2a($arr['useMainDocNo'])."',
'".th2a($arr['stdCode'])."',
'".th2a($arr['DocforSign'])."',
'".th2a($arr['eDoc'])."',
'".th2a($arr['DocTelOwner'])."',
'".th2a($arr['DocSendReal'])."',
'".th2a($arr['DIbStaff'])."',
'".th2a($arr['DIbHeader'])."',
'".th2a($arr['DocDeptOwner'])."',
'".th2a($arr['DocFaxOwner'])."',
'".th2a($arr['DocCopySend'])."',
'".th2a($arr['DocContactE'])."',
'".th2a($arr['Doc_tsr_id'])."',
'".th2a($arr['DocIDHisOld'])."',
'".th2a($arr['DocIDHisNew'])."',
'".th2a($arr['Doc_Letter_ID'])."',
'".th2a($arr['date_now'])."'
)";
return $this->Dml($sql);
}
function delete_doc($DocID)
{
return $this->Dml("delete from Documents where DocID='$DocID'");
}
//------------------------------ temp
function SelectDataBook_temp()
{
$C_year=date("Y")+543;
$DlcID=$_SESSION['DLCID'];
// echo "SELECT *,MAX(DrsID) AS Drsmax
// FROM Documents
// LEFT JOIN DocReceiveSend on Documents.DocID = DocReceiveSend.DocID
// WHERE DocReceiveSend.DlcID = '$DlcID' AND '$C_year'-YEAR(Documents.DocDate) > '10'
// Group by(Documents.DocID)
// ORDER BY Documents.DocDate DESC"; DIE;
$this->SetQuery("SELECT *,MAX(DrsID) AS Drsmax
FROM temp_Documents
LEFT JOIN temp_DocReceiveSend on temp_Documents.DocID = temp_DocReceiveSend.DocID
WHERE '$C_year'-YEAR(temp_Documents.DocDate) > '10'
Group by(temp_Documents.DocID)
ORDER BY temp_Documents.DocDate DESC");
return 1;
}
function insert_document($arr){
$sql = "insert into Documents values(
'".th2a($arr['DocID'])."',
'".th2a($arr['DocPID'])."',
'".th2a($arr['DlcID'])."',
'".th2a($arr['PtID'])."',
'".th2a($arr['DtID'])."',
'".th2a($arr['DslID'])."',
'".th2a($arr['DclID'])."',
'".th2a($arr['DsID'])."',
'".th2a($arr['RsID'])."',
'".th2a($arr['DocDateCreate'])."',
'".th2a($arr['DocUserCreate'])."',
'".th2a($arr['DocTypeNo'])."',
'".th2a($arr['DocDate'])."',
'".th2a($arr['DocNo'])."',
'".th2a($arr['DocSubject'])."',
'".th2a($arr['DocFrom'])."',
'".th2a($arr['DocTo'])."',
'".th2a($arr['DocShortDesc'])."',
'".th2a($arr['DocSpeedLevelDueDate'])."',
'".th2a($arr['DocStart'])."',
'".th2a($arr['DocFinish'])."',
'".th2a($arr['DocGroup'])."',
'".th2a($arr['DocRef'])."',
'".th2a($arr['DocCircular'])."',
'".th2a($arr['DocfCir'])."',
'".th2a($arr['DocOther'])."',
'".th2a($arr['CertificatePs'])."',
'".th2a($arr['fDelete'])."',
'".th2a($arr['endDoc'])."',
'".th2a($arr['sendToPs'])."',
'".th2a($arr['AnID'])."',
'".th2a($arr['DocRefAns'])."',
'".th2a($arr['DocRefAnsID'])."',
'".th2a($arr['DocstartDatePost'])."',
'".th2a($arr['DocendDatePost'])."',
'".th2a($arr['DocMainPost'])."',
'".th2a($arr['DocGetPost'])."',
'".th2a($arr['DocShowInOut'])."',
'".th2a($arr['DocDateGetPost'])."',
'".th2a($arr['useMainDocNo'])."',
'".th2a($arr['stdCode'])."',
'".th2a($arr['DocforSign'])."',
'".th2a($arr['eDoc'])."',
'".th2a($arr['DocTelOwner'])."',
'".th2a($arr['DocSendReal'])."',
'".th2a($arr['DIbStaff'])."',
'".th2a($arr['DIbHeader'])."',
'".th2a($arr['DocDeptOwner'])."',
'".th2a($arr['DocFaxOwner'])."',
'".th2a($arr['DocCopySend'])."',
'".th2a($arr['DocContactE'])."',
'".th2a($arr['Doc_tsr_id'])."',
'".th2a($arr['DocIDHisOld'])."',
'".th2a($arr['DocIDHisNew'])."',
'".th2a($arr['Doc_Letter_ID'])."'
)";
return $this->Dml($sql);
}
function delete_doc_temp($DocID)
{
return $this->Dml("delete from temp_Documents where DocID='$DocID'");
}
// === Jack ========================
// ==============================================================================
// ==== CHAIN 2015/07/06 printRepFollowDocDept ==================================
// ==============================================================================
function searchDocRefByDocIDDocName($DocID, $DocNo, $DocSubject="")
{
if($DocSubject != "")
{
$docSub = "AND a.DocRef LIKE '%$DocSubject%'";
$docSub .= " || ((a.DocRefAns LIKE '%$DocSubject%' AND a.DocRefAns LIKE '%$DocNo%') || a.DocRefAnsID = '$DocID')";
}else{
$docSub = "";
}
if ($this->SetQuery("SELECT a.DocID, a.DocDateCreate, a.DocNo, a.DocSubject
FROM Documents a
WHERE a.DocRef LIKE '%$DocNo%' $docSub
AND a.DocPID = 0 ")){
return 1;
}else {
return 0;
}
}
// === CHAIN 2015/07/09 =========================================================
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDocGroupDsIDDocDueDate($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$printorder,$DocDueDateStart,$DocDueDateEnd){
if($printorder==1){
$porder=" b.DrsSendDate desc, a.DocTypeNo desc "; // 2015/07/09 - CHAIN ADD b.DrsSendDate desc,
}else if($printorder==2){
$porder=" b.DrsSendDate asc, a.DocTypeNo asc "; // 2015/07/09 - CHAIN ADD b.DrsSendDate asc,
}
if($DocTypeNoStart!=""){
$a="and a.DocTypeNo between '$DocTypeNoStart' and '$DocTypeNoEnd'";
}
if($DocSubject!=""){
$b="and a.DocSubject like '%$DocSubject%'";
}
if($start!=0){ // CHAIN EDIT - 2015/07/16
if($start==$end){
$c="and b.DrsSendDate like '$start%'";
}else{
$c="and b.DrsSendDate between '$start 00:00:00' and '$end 23:59:59'";
}
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
if($DocDueDateStart!=0){ // CHAIN EDIT - 2015/07/16
if($DocDueDateStart==$DocDueDateEnd){ // กำหนดวันเสร็จ
$f="and b.DrsDocDueDate like '%$DocDueDateStart%'";
}else{
$f="and b.DrsDocDueDate between '$DocDueDateStart' and '$DocDueDateEnd'";
}
}
if ($this->SetQuery("select a.*,b.DrsSendDate,b.DrsDocDueDate,b.DrsID,b.DlcID as DlcIDRS from Documents a inner join DocReceiveSend b inner join DocLineConfig c on a.fDelete!='Y' $a $b $c $e $f and b.DsID='3' and a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and b.PtID!='1' and b.DrsDocDueDate!='0000-00-00' and b.DlcID = c.DlcID and c.deptId = '$deptId' and c.DlcIDSecond!='Y' order by $porder")){
return 1;
}else {
return 0;
}
}
// ==============================================================================
// ==============================================================================
// ==== CHAIN ADD 2015/08/17 -- การค้นหาหนังสืออ้างอิงเพื่อตอบกลับ ================================
// ==============================================================================
function SearchDocRefAnsTableALL($yKey,$DocNoSearch,$DocSubjectSearch){
if($DocNoSearch!=""){
$a="AND DocNo LIKE '%$DocNoSearch%'";
}
if($DocSubjectSearch!=""){
$b="and DocSubject like '%$DocSubjectSearch%'";
}
//echo "SELECT * FROM Documents WHERE RsID = '$yKey' $a $b and (DlcID= '$p' || DlcID= '$q') and (DsID!='0' && DsID!='6' && DsID!='7') ORDER BY DocDate DESC , DocID DESC<br>";
if ($this->SetQuery("SELECT DocDate, DocNo, DocSubject, DocDate, DocID, DocDateCreate FROM Documents WHERE RsID = '$yKey' $a $b and (DsID!='0' && DsID!='6' && DsID!='7') ORDER BY DocDate DESC , DocID DESC")){
return 1;
}else {
return 0;
}
}
// ==============================================================================
} //--End class base_Documents--
?>
|