Viewing file: clsDocuments.php (60.81 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;
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)."'
)";
}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)."'
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 SearchByDlcIDDocGroupRsIDDtIDPS($xKey,$yKey,$zKey,$zKey2,$zKey3){
//echo "select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' order by DocDateCreate desc<br>";
if ($this->SetQuery("select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' and fDelete!='Y' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupRsIDDtIDPSDsID1or2($xKey,$yKey,$zKey,$zKey2,$zKey3){
//echo "select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc<br>";
if ($this->SetQuery("select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupRsIDDtIDDsID1or2DlcPS2($xKey,$yKey,$zKey,$zKey2,$zKey3){
//echo "select * from Documents where (DlcID= '$xKey' || DlcID='$zKey3') and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc";
if ($this->SetQuery("select * from Documents where (DlcID= '$xKey' || DlcID='$zKey3') and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc , DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupRsIDDtIDDsID1or2DlcPS2flagread($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";
//if ($this->SetQuery("select * from Documents where (DlcID= '$xKey' || DlcID='$zKey3') and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc , DocID desc")){
if ($this->SetQuery("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")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupRsIDDtIDDsID1or2($yKey,$zKey,$zKey2){
//echo "select * from Documents where (DlcID= '$xKey' || DlcID='$zKey3') and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc";
if ($this->SetQuery("select * from Documents where DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc , DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupRsIDDtIDDsID1or2flagread($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";
//if ($this->SetQuery("select * from Documents where DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and fDelete!='Y' and (DsID='1' or DsID='2') order by DocDateCreate desc , DocID desc")){
if ($this->SetQuery("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")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDsID3($xKey,$yKey,$zKey3){
//echo "select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' and fDelete!='Y' and DsID='3' order by DocDateCreate desc<br>";
if ($this->SetQuery("select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and DocUserCreate='$zKey3' and fDelete!='Y' and DsID='3' order by DocDateCreate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID3($xKey,$yKey,$zKey4){
//echo "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 * from Documents where (DlcID= '$xKey' || DlcID= '$zKey4') and DocGroup='$yKey' and fDelete!='Y' and DsID='3' order by DocDateCreate desc , DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID3DrsSendDate($xKey,$yKey,$zKey4){
//echo ",====select a.*,b.* from Documents a inner join DocReceiveSend b on (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 (DlcID= '$xKey' || DlcID= '$zKey4') and DocGroup='$yKey' and fDelete!='Y' and DsID='3' order by DocDateCreate desc , DocID desc")){
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 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 * 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 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 * 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 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 * 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 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 SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAccept($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 * 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 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='6' 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 SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptnoRsID4($xKey,$yKey,$zKey4,$monthe,$searchYear,$s,$searchname){
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'";
}
//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 * 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 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 and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='3' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptRsID1($xKey,$yKey,$zKey4,$monthe,$searchYear,$s,$searchname){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
$bb="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 * 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 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 and b.DrsReceiveDate like '$searchYear-$monthe-%' and a.RsID='1' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsIDDrsSendDateAccept($xKey,$yKey,$zKey4,$s,$searchname){ //////////////////////////////
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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 * 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 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='$s' and a.DsID=b.DsID and a.DocID=b.DocID $aa and b.DrsSendDate='0000-00-00 00:00:00' order by a.DocDateCreate desc , a.DocID desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptLimitDrsReceiveDate($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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 * 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 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='6' and a.DsID=b.DsID and a.DocID=b.DocID and b.DrsSendDate='0000-00-00 00:00:00' and b.DrsReceiveDate like '$searchYear-$monthe-%' order by a.DocDateCreate desc , a.DocID desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptLimitDrsReceiveDatenoRsID4($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear,$s,$searchname){
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'";
}
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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";
//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 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 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 SearchByDlcIDDocGroupPSDlcID2DsID0DrsSendDateNoAcceptandAcceptLimitDrsReceiveDateRsID1($xKey,$yKey,$zKey4,$start,$pageSize,$monthe,$searchYear,$s,$searchname){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
$bb="and b.DsID='1'";
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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";
//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 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 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){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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 * from Documents where DocGroup='$xKey' and DsID='2' order by DocDateCreate desc")){
if ($this->SetQuery("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")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupRsIDDtIDPSLimit($xKey,$yKey,$zKey,$zKey2,$zKey3,$start,$pageSize){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//echo "select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' order by DocDateCreate desc<br>";
if ($this->SetQuery("select * from Documents where DlcID= '$xKey' and DocGroup='$yKey' and RsID = '$zKey' and DtID = '$zKey2' and DocUserCreate='$zKey3' and fDelete!='Y' order by DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDDtID($xKey,$zKey){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
if ($this->SetQuery("select * from Documents where DocID= '$xKey' and DtID='$zKey'")){
return 1;
}else {
return 0;
}
}
function SearchByRsIDDocNoDocPID0($yKey,$zKey){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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 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 SearchRsIDDtIDfDeleteDocNoSubject($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 SearchRsIDDtIDfDeleteDocNoSubject_deptId($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 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 a.DocTypeNo desc,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 SearchRsIDDtIDfDeleteDocNoSubjectDocGroupDocUserCreate($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' 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 a.DocTypeNo desc,a.DocDate desc")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2($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 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 a.DocTypeNo desc,a.DocDate desc ")){
return 1;
}else {
return 0;
}
}
function SearchRsIDDtIDfDeleteDocNoSubject2DocGroup($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 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 a.DocTypeNo desc,a.DocDate desc ")){
return 1;
}else {
return 0;
}
}
function askuser($xKey,$zKey,$s){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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 SearchByDocGroupDsID1LimitDrsReceiveDate($xKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
//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' and DrsReceiveDate like ='%$searchYear-$monthe%' order by DrsReceiveDate desc) order by DocDateCreate desc limit $start, $pageSize")){
//echo "3--select a.DocID,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='$xKey' and b.DsID='1'and b.DrsReceiveDate like '$searchYear-$monthe-%'order by b.DrsReceiveDate desc ,a.DocDateCreate desc limit $start, $pageSize";
if ($this->SetQuery("select a.DocID,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='$xKey' and b.DsID='1'and b.DrsReceiveDate like '$searchYear-$monthe-%' $aa order by b.DrsReceiveDate desc ,a.DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID1LimitDrsReceiveDateforRegisDoc13($xKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
//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' and DrsReceiveDate like ='%$searchYear-$monthe%' order by DrsReceiveDate desc) order by DocDateCreate desc limit $start, $pageSize")){
//echo "3--select a.DocID,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='$xKey' and b.DsID='1'and b.DrsReceiveDate like '$searchYear-$monthe-%'order by b.DrsReceiveDate desc ,a.DocDateCreate desc limit $start, $pageSize";
if ($this->SetQuery("select a.DocID,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='$xKey' and b.DsID='1'and b.DrsReceiveDate like '$searchYear-$monthe-%' $aa 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 SearchByDocGroupDsID1DrsReceiveDate($xKey,$RsID,$DtID,$monthe,$searchYear,$searchname){
if($searchname!=""){
$aa="and a.DocSubject like '%$searchname%'";
}
//echo "4--select a.DocID,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='$xKey' and b.DsID='1' and b.DrsReceiveDate like '$searchYear-$monthe-%'order by b.DrsReceiveDate desc";
//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' and DrsReceiveDate like '%$searchYear-$monthe%' order by DrsReceiveDate desc)")){
if ($this->SetQuery("select a.DocID,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='$xKey' and b.DsID='1' and b.DrsReceiveDate like '$searchYear-$monthe-%' $aa order by b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2Limit($xKey,$yKey,$zKey,$start,$pageSize,$RsID,$DtID){
//$maxdate = $this->SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2);
//echo "select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3'";
//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 SearchByDlcIDDocGroupDsID1DlcPS2LimitDrsReceiveDate($xKey,$yKey,$zKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname){ //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%'";
}
//$maxdate = $this->SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2);
//echo "select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3'";
//echo "5--select a.DocID,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.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit $start, $pageSize";
if ($this->SetQuery("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.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' $aa order by b.DrsReceiveDate desc , a.DocDateCreate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2LimitDrsReceiveDateforregis13($xKey,$yKey,$zKey,$start,$pageSize,$RsID,$DtID,$monthe,$searchYear,$searchname){ //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%'";
}
//$maxdate = $this->SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2);
//echo "select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3'";
//echo "5--select a.DocID,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.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc limit $start, $pageSize";
if ($this->SetQuery("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.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' $aa 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){
//$maxdate = $this->SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2);
//echo "select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3'";
//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%'";
}
//$maxdate = $this->SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2);
//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";
//echo "6--select a.DocID,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.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsReceiveDate like '$searchYear-$monthe-%' order by b.DrsReceiveDate desc , a.DocDateCreate desc";
//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') and DrsReceiveDate like '%$searchYear-$monthe%' order by DrsReceiveDate desc)")){
if ($this->SetQuery("select a.DocID,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.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 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 SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3DrsSend($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' 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 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' and b.PtID!='1' and b.DrsDocDueDate!='0000-00-00' order by b.DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
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 SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3DrsSendSeeAll($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' 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 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")){
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 SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3($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.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 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.PtID!='1' and b.DrsDocDueDate!='0000-00-00' order by b.DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDocGroupDsID3($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$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 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 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 SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDocGroupDsID32($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$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 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 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' 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.DlcID = c.DlcID and c.deptId = '$deptId' order by b.DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3PS($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$PS){
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,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")){
return 1;
}else {
return 0;
}
}
function SearchByDrsSendDateDocTypeNoDocSubjectDocNoDeptIdfDeleteDlcIDDlcID2DocGroupDsID3PS2($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$deptId,$MaxDocGroup,$PS){
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 a.DocID=b.DocID and b.DocGroup='$MaxDocGroup' and a.fDelete!='Y' 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,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' order by b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function searchSelectPostDoc($xKey){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
//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 DlcID= '$xKey' and DtID='$zKey' and RsID='$s'")){
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){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
if ($this->SetQuery("select * from Documents where DocPID= '$xKey' and AnID!=0")){
return 1;
}else {
return 0;
}
}
function SearchByAnID($xKey){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
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){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
if ($this->SetQuery("select * 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;
}
}
} //--End class base_Documents--
?>
|