Viewing file: clsDocuments.php (79.07 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;
function Documents(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
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)."'
)";
}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)."'
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);
}
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){
//echo "1--select a.*,b.DrsID,b.DrsFromDrsID 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' 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.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' order by a.DocDateCreate desc , a.DocID desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchRegisDocNoMainDeptLimit($xKey,$yKey,$zKey,$zKey2,$zKey3,$start,$pageSize){
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DsID,a.DocTypeNo,a.DtID,a.DocNo,
a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,
b.DrsID,b.DrsFromDrsID
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'
order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchCountRegisDocMainDept($yKey,$zKey,$zKey2){
//echo "2--select a.*,b.DrsID,b.DrsFromDrsID 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' 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.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' order by a.DocDateCreate desc , a.DocID desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchRegisDocMainDeptLimit($yKey,$zKey,$zKey2,$start,$pageSize){
if ($this->SetQuery("select
a.DsID,a.DlcID,a.DocID,a.DsID,a.DocTypeNo,a.DtID,a.DocNo,
a.DocDate,a.endDoc,a.DocSubject,a.DocFrom,a.DocDateCreate,a.DslID,a.DclID,
b.DrsID,b.DrsFromDrsID
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'
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){
//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")){
$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')) order by a.DocDateCreate desc , a.DocID desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSendDocDrsSEndlimit($xKey,$yKey,$zKey4,$dlcid,$start,$pageSize){
//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.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID ,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')) 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){
//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";
$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')) order by a.DocDateCreate desc , a.DocID desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSendDocDrsSEndnotY2limit($xKey,$yKey,$zKey4,$dlcid,$start,$pageSize){
//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.DocTypeNo, a.DtID, a.DocNo,
a.DocFrom, a.DocPID, a.DlcID,
a.RsID, a.DocID, a.DocSubject,
a.DslID, a.DclID ,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')) 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){
//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 limit $start, $pageSize";
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 limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchCountDocReceive2($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' order by a.DocDateCreate desc , a.DocID desc");
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){
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.DsID as bDsID,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 and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID!='4' order by a.DocDateCreate desc , a.DocID desc<br>";
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.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")){
return 1;
}else {
return 0;
}
}
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' 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.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");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptRsID1searchNo($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 a.*,b.DsID as bDsID,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 and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='1' order by a.DocDateCreate desc , a.DocID desc<br>";
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.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")){
return 1;
}else {
return 0;
}
}
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' 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.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");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptLimitDrsReceiveDatenoRsID4searchNo($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.*,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 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){
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.*,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 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){
//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";
$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') order by a.DocDateCreate desc , b.DrsReceiveDate desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSignDoclimit($xKey,$yKey,$zKey,$start,$pageSize){
//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.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,
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 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){
//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";
$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' order by a.DocDateCreate desc , b.DrsReceiveDate desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchSignDocRlimit($xKey,$yKey,$zKey,$start,$pageSize){
//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.DtID, a.DocNo, a.DocFrom, a.DocPID, a.DlcID, a.DocID, a.DocSubject, a.DslID, a.DclID,
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 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'";
}
//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 $porder,DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectreg($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'";
}
//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 $porder,DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptId($RsID,$DtID,$start,$end,$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%'";
}
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 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='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID order by $porder,a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject_deptIdreg($RsID,$DtID,$start,$end,$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%'";
}
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 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='$MaxDocGroup' and b.deptId='$deptId' and a.DlcID=b.DlcID and a.stdCode!='' order by $porder,a.DocDate 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($RsID,$DtID,$start,$end,$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%'";
}
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='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc";
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 order by $porder,a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreatereg($RsID,$DtID,$start,$end,$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%'";
}
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='$DocGroup' and b.deptId='$selectPositionDeptID' and a.DlcID=b.DlcID order by a.DocTypeNo desc,a.DocDate desc";
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 stdCode!='' order by $porder,a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2($RsID,$DtID,$start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$deptId,$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 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 a.DocTypeNo desc,a.DocDate desc ";
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' $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 ")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2DocGroup($RsID,$DtID,$start,$end,$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%'";
}
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 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,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){
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 ($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='$xKey' and b.DsID='1'and b.DrsReceiveDate like '$searchYear-$monthe-%'
$aa $bb $ee 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){
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 ($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='$xKey' and b.DsID='1'and b.DrsReceiveDate like '$searchYear-$monthe-%'
$aa $bb $ee 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 SearchViewCountRegisDocMainDept($xKey,$RsID,$DtID,$monthe,$searchYear,$searchname,$searchNo){
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 ($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='$xKey' and b.DsID='1' and
b.DrsReceiveDate like '$searchYear-$monthe-%' $aa $bb $ee
order by b.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){ //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 ($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 $bb $ee 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){ //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 ($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 $bb $ee 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'";
}
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 $bb $ee
order by b.DrsReceiveDate desc , a.DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
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')");
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')");
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=" 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%'";
}
//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' order by $porder,b.DrsSendDate desc")){
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 $porder,a.PtID asc";
}else{
$dd="and a.PtID='$PtID' order by $porder, a.DocDateCreate desc";
}
//echo "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.DlcID = c.DlcID and c.deptId = '$deptId' $dd";
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.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,b.DrsReceiveDate desc")){
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,a.DocDateCreate desc";
}
//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";
if ($this->SetQuery("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")){
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 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){
if ($this->SetQuery("select DocID from Documents where DtID=1 and RsID=1 and DocNo= '$xKey'")){
return 1;
}else {
return 0;
}
}
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') order by DocDateCreate desc , DocID desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDlcIDstatusNoGetJoin($xKey,$yKey){
//echo "select a.*,b.* from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='' and a.DocGroup ='$yKey' and a.DocID=b.DocID";
if ($this->SetQuery("select a.*,b.* from docforsign a inner join Documents b on a.DeptSign='$xKey' and a.statusGet='' and a.DocGroup ='$yKey' and a.DocID=b.DocID")){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSign($xKey,$yKey,$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";
}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 b.DocNo like '%$searchNo%' order by a.getDate desc";
}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 b.DocNo like '%$searchNo%' and b.DocSubject like '%$searchName%' order by a.getDate desc";
}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";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
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.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.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.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.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,$searchYear,$searchName,$searchNo,$DlcID,$DlcID2){
if($searchName!="" && $searchNo==""){
$q="select a.*,b.* from docforsign a inner join Documents b on 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";
}else if($searchName=="" && $searchNo!=""){
$q="select a.*,b.* from docforsign a inner join Documents b on 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";
}else if($searchName!="" && $searchNo!=""){
$q="select a.*,b.* from docforsign a inner join Documents b on 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";
}else{
$q="select a.*,b.* from docforsign a inner join Documents b on a.DocGroup ='$yKey' and a.statusGet='Y' and b.DocGroup='$yKey' and a.getDate like '$searchYear-$monthe-%' and a.DocID=b.DocID order by a.getDate and (a.DlcID='$DlcID' || a.DlcID='$DlcID2') desc";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchGetDocForSignDlcID2($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')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' order by a.DocDateCreate desc , a.DocID desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountDocIDByDlcIDDocGroupPSDlcID2DsID3DrsSendDateDrsSEndnotY2($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";
$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' order by a.DocDateCreate desc , a.DocID desc");
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') order by a.DocDateCreate desc , b.DrsReceiveDate desc");
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;
}
}
} //--End class base_Documents--
?>
|