Viewing file: clsDocReceiveSend.php (29.84 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class docreceivesend--------------------------
//--PK of docreceivesend ::
// 1. DrsID
include_once "../link/keyThai.php";
class DocReceiveSend extends clsDB{
var $result;
var $DrsID;
var $DocID;
var $DlcID;
var $DsID;
var $personId;
var $PtID;
var $DrsDocTypeNo;
var $DrsReceiveDate;
var $DrsReceivePersonId;
var $DrsSendDate;
var $DrsSendPersonId;
var $DrsSendDlcID;
var $DrsDocDueDate;
var $DrsDlcIDCreate;
var $DrsPsIDCreate;
var $DrsPropose;
var $DrsSign;
var $DrsFromDrsID;
var $DocGroup;
var $DrsflagRead;
var $DrsByPass;
var $DrsSend;
var $DrsSendToPs;
var $DrsDelete;
var $DrsMainPs;
var $AnID;
var $DrsDocReceiveDate;
var $DocRefAnsDate;
var $DrsSendDocNew;
var $DrsInboxID;
var $DrsstartDatePost;
var $DrsendDatePost;
var $DrsSendBack;
var $DrsSendBackDlcID;
var $DrsfSendBack;
function DocReceiveSend(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
if ($this->status==1){
$sql = "insert into DocReceiveSend values(
'".th2a($this->DrsID)."',
'".th2a($this->DocID)."',
'".th2a($this->DlcID)."',
'".th2a($this->DsID)."',
'".th2a($this->personId)."',
'".th2a($this->PtID)."',
'".th2a($this->DrsDocTypeNo)."',
'".th2a($this->DrsReceiveDate)."',
'".th2a($this->DrsReceivePersonId)."',
'".th2a($this->DrsSendDate)."',
'".th2a($this->DrsSendPersonId)."',
'".th2a($this->DrsSendDlcID)."',
'".th2a($this->DrsDocDueDate)."',
'".th2a($this->DrsDlcIDCreate)."',
'".th2a($this->DrsPsIDCreate)."',
'".th2a($this->DrsPropose)."',
'".th2a($this->DrsSign)."',
'".th2a($this->DrsFromDrsID)."',
'".th2a($this->DocGroup)."',
'".th2a($this->DrsflagRead)."',
'".th2a($this->DrsByPass)."',
'".th2a($this->DrsSend)."',
'".th2a($this->DrsSendToPs)."',
'".th2a($this->DrsDelete)."',
'".th2a($this->DrsMainPs)."',
'".th2a($this->AnID)."',
'".th2a($this->DrsDocReceiveDate)."',
'".th2a($this->DocRefAnsDate)."',
'".th2a($this->DrsSendDocNew)."',
'".th2a($this->DrsInboxID)."',
'".th2a($this->DrsstartDatePost)."',
'".th2a($this->DrsendDatePost)."',
'".th2a($this->DrsSendBack)."',
'".th2a($this->DrsSendBackDlcID)."',
'".th2a($this->DrsfSendBack)."'
)";
}else {
$sql = "update DocReceiveSend set
DocID='".th2a($this->DocID)."',
DlcID='".th2a($this->DlcID)."',
DsID='".th2a($this->DsID)."',
personId='".th2a($this->personId)."',
PtID='".th2a($this->PtID)."',
DrsDocTypeNo='".th2a($this->DrsDocTypeNo)."',
DrsReceiveDate='".th2a($this->DrsReceiveDate)."',
DrsReceivePersonId='".th2a($this->DrsReceivePersonId)."',
DrsSendDate='".th2a($this->DrsSendDate)."',
DrsSendPersonId='".th2a($this->DrsSendPersonId)."',
DrsSendDlcID='".th2a($this->DrsSendDlcID)."',
DrsDocDueDate='".th2a($this->DrsDocDueDate)."',
DrsDlcIDCreate='".th2a($this->DrsDlcIDCreate)."',
DrsPsIDCreate='".th2a($this->DrsPsIDCreate)."',
DrsPropose='".th2a($this->DrsPropose)."',
DrsSign='".th2a($this->DrsSign)."',
DrsFromDrsID='".th2a($this->DrsFromDrsID)."',
DocGroup='".th2a($this->DocGroup)."',
DrsflagRead='".th2a($this->DrsflagRead)."',
DrsByPass='".th2a($this->DrsByPass)."',
DrsSend='".th2a($this->DrsSend)."',
DrsSendToPs='".th2a($this->DrsSendToPs)."',
DrsDelete='".th2a($this->DrsDelete)."',
DrsMainPs='".th2a($this->DrsMainPs)."',
AnID='".th2a($this->AnID)."',
DrsDocReceiveDate='".th2a($this->DrsDocReceiveDate)."',
DocRefAnsDate='".th2a($this->DocRefAnsDate)."',
DrsSendDocNew='".th2a($this->DrsSendDocNew)."',
DrsInboxID='".th2a($this->DrsInboxID)."',
DrsstartDatePost='".th2a($this->DrsstartDatePost)."',
DrsendDatePost='".th2a($this->DrsendDatePost)."',
DrsSendBack='".th2a($this->DrsSendBack)."',
DrsSendBackDlcID='".th2a($this->DrsSendBackDlcID)."',
DrsfSendBack='".th2a($this->DrsfSendBack)."'
where DrsID='".th2a($this->DrsID)."'";
//echo "----------".$sql.'<br>';
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from DocReceiveSend where DrsID='$this->DrsID'");
}
function NumRow(){
return $this->GetRowSelected();
}
function GetNextCode(){
$this->SetQuery("select max(DrsID) as num from DocReceiveSend");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSDocReceiveSend(){
$this->SetQuery("select * from DocReceiveSend order by DrsID");
}
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->DrsPropose=a2th($this->DrsPropose);
$this->DrsSign=a2th($this->DrsSign);
$this->DrsSendBack=a2th($this->DrsSendBack);
}
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 DocReceiveSend where DrsID= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2){
//echo "select Max(DrsReceiveDate) as num from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and (DsID=1 or DsID=2) and DrsReceivePersonId = '$zKey'<br>";
$this->SetQuery("select Max(DrsReceiveDate) as num from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and (DsID=1 or DsID=2) and DrsReceivePersonId = '$zKey' and DocID='$zKey2'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupPsDocIDStatus1DlcPS2($xKey,$yKey,$zKey2,$zKey3){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and DrsReceiveDate = '$maxdate'<br>";
if ($this->SetQuery("select * from DocReceiveSend where (DlcID= '$xKey' || DlcID='$zKey3') and DocGroup='$yKey' and DocID='$zKey2' and DsID='1'")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupPsDocIDStatus1DlcPS2flagread($xKey,$yKey,$zKey2,$zKey3){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and DrsReceiveDate = '$maxdate'<br>";
if ($this->SetQuery("select * from DocReceiveSend where (DlcID= '$xKey' || DlcID='$zKey3') and DocGroup='$yKey' and DocID='$zKey2' and DsID='1' and DrsflagRead!='N'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupPsDocIDStatus1($yKey,$zKey2){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and DrsReceiveDate = '$maxdate'<br>";
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and DocID='$zKey2' and DsID='1'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupPsDocIDStatus1flagread($yKey,$zKey2){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and DocID='$zKey2' and DsID='1' and DrsflagRead!='N'")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDocIDStatus1($xKey,$yKey,$zKey2){
if ($this->SetQuery("select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and DocID='$zKey2' and DsID='1'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus2($xKey,$yKey){
//$maxdate = $this->SearchByDlcIDDocGroupMaxDateStatus10r2($xKey,$yKey,$zKey,$zKey2);
//echo "select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='2'";
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='2'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus2flagread($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='2' and DrsflagRead!='N'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus3($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3' and DrsSendDate='0000-00-00 00:00:00'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus3DrsSendY($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3' and DrsSendDate='0000-00-00 00:00:00' and DrsSend='Y'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus3DrsSend($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='3' and DrsSendDate='0000-00-00 00:00:00' and DrsSend!='Y'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus0($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DocID='$yKey' and DsID='0' and DrsSendDate='0000-00-00 00:00:00'")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroup($xKey,$yKey){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey'<br>";
$this->SetQuery("select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDocIDDocGroupStatus($xKey,$yKey,$zKey){
//echo "select * from DocReceiveSend where DocID= '$xKey' and DocGroup='$yKey' and DsID ='$zKey'<br>";
if ($this->SetQuery("select * from DocReceiveSend where DocID= '$xKey' and DocGroup='$yKey' and DsID ='$zKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDocId($xKey,$yKey,$zKey){
if ($this->SetQuery("select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey' and DocID='$zKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDDlcIDDrsReceivePersonIdStatus2($xKey,$yKey,$zKey,$zKey2){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup= '$xKey' and DocID='$yKey' and DlcID='$zKey' and DrsReceivePersonId='$zKey2' and DsID='2'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDDlcIDDrsReceiveDlcID2Status2($xKey,$yKey,$zKey,$zKey3){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup= '$xKey' and DocID='$yKey' and (DlcID='$zKey' || DlcID='$zKey3') and DsID='2' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDlcIDDrsReceiveDlcID2Status2($xKey,$zKey,$zKey3){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup= '$xKey' and (DlcID='$zKey' || DlcID='$zKey3') and DsID='2' and DrsSendDate!='0000-00-00 00:00:00' order by DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDlcIDDrsReceiveDlcID2Status2DrsSendDate($xKey,$zKey,$zKey3,$monthe,$searchYear,$searchName){
if($searchName!=""){
$q="select a.DocSubject,b.* from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc";
}else{
$q="select * from DocReceiveSend where DocGroup= '$xKey' and (DlcID='$zKey' || DlcID='$zKey3') and DsID='2' and DrsSendDate like '$searchYear-$monthe-%' order by DrsSendDate desc";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDlcIDDrsReceiveDlcID2Status2Limit($xKey,$zKey,$zKey3,$start,$pageSize){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup= '$xKey' and (DlcID='$zKey' || DlcID='$zKey3') and DsID='2' and DrsSendDate!='0000-00-00 00:00:00' order by DrsSendDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDlcIDDrsReceiveDlcID2Status2LimitDrsSendDate($xKey,$zKey,$zKey3,$start,$pageSize,$monthe,$searchYear,$searchName){
if($searchName!=""){
$q="select a.DocSubject,b.* from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc limit $start, $pageSize";
}else{
$q="select * from DocReceiveSend where DocGroup= '$xKey' and (DlcID='$zKey' || DlcID='$zKey3') and DsID='2' and DrsSendDate like '$searchYear-$monthe-%' order by DrsSendDate desc limit $start, $pageSize";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDrsFromDrsID($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DrsFromDrsID='$yKey'")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDrsDelete($xKey){
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and DrsflagRead!='N' and DrsDelete!='Y' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDocGroupDsID0($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and DrsflagRead!='N' and DsID='0' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDocGroupDrsDelete2($xKey,$yKey,$zKey){
if($zKey!=""){
$a="and DocID in(select DocID from Documents where DocSubject like '%$zKey%')";
}
//echo "select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsDelete!='Y' $a order by DrsReceiveDate desc";
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsDelete!='Y' $a order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDrsDelete2DrsInboxIDDrsflagRead($xKey,$zKey,$DrsInboxID){
if($zKey!=""){
$a="and DocID in(select DocID from Documents where DocSubject like '%$zKey%')";
}
//echo "select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsDelete!='Y' $a order by DrsReceiveDate desc";
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and (DsID='4' || DsID='5') and DrsDelete!='Y' $a and DrsInboxID='$DrsInboxID' and DrsflagRead='N' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDocGroup2DrsDeleteLimit($xKey,$yKey,$start,$pageSize,$zKey){
if($zKey!=""){
$a="and DocID in(select DocID from Documents where DocSubject like '%$zKey%')";
}
//echo "select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and DrsflagRead!='N' order by DrsReceiveDate desc";
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsDelete!='Y' $a order by DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchBypersonId2DrsDeleteLimitDrsInboxIDDrsflagRead($xKey,$start,$pageSize,$zKey,$DrsInboxID){
if($zKey!=""){
$a="and DocID in(select DocID from Documents where DocSubject like '%$zKey%')";
}
//echo "select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and DrsflagRead!='N' order by DrsReceiveDate desc";
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and (DsID='4' || DsID='5') and DrsDelete!='Y' $a and DrsInboxID='$DrsInboxID' and DrsflagRead='N' order by DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDrsDeleteLimit($xKey,$start,$pageSize){
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and DrsflagRead!='N' and DrsDelete!='Y' order by DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDrsIDDocGroup($xKey,$yKey){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey'<br>";
if ($this->SetQuery("select * from DocReceiveSend where DrsID= '$xKey' and DocGroup='$yKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDStatus3($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DocID='$xKey' and DsID='3'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDStatus($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DocID='$xKey' and DsID='$yKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDStatus2($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DocID='$xKey' and DsID='2'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDStatus1($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DocID='$xKey' and DsID='1'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsID($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDcasedept($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey' and DlcID!='0' and personId='0'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDcaseps($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey' and DlcID='0' and personId!='0'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDPS($xKey,$yKey){
$this->SetQuery("select count(personId) as num from DocReceiveSend where DrsFromDrsID='$xKey' and personId='$yKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDrsFromDrsIDDsID2($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey' and DsID='2'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID1($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DsID='1' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDsID1Limit($xKey,$start,$pageSize){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$xKey' and DsID='1' order by DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2($xKey,$yKey,$zKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and DsID='1' and (DlcID= '$xKey' || DlcID='$zKey') order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID31DlcPS2($xKey,$yKey,$zKey){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and DsID='3' and (DlcID= '$xKey' || DlcID='$zKey') and DrsSendDate!='0000-00-00 00:00:00' order by DrsSendDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID31DlcPS2DrsSendDate($xKey,$yKey,$zKey,$monthe,$searchYear,$searchName){
if($searchName!=""){
$q="select a.DocSubject,b.* from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc";
}else{
$q="select * from DocReceiveSend where DocGroup='$yKey' and DsID='3' and (DlcID= '$xKey' || DlcID='$zKey') and DrsSendDate like '$searchYear-$monthe-%' order by DrsSendDate desc";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID31DlcPS2Limit($xKey,$yKey,$zKey,$start,$pageSize,$monthe,$searchYear){
//echo "select * from DocReceiveSend where DocGroup='$yKey' and DsID='3' and (DlcID= '$xKey' || DlcID='$zKey') and (DrsSendDate!='0000-00-00 00:00:00' and DrsSendDate like '$searchYear-$monthe-%') order by DrsSendDate desc limit $start, $pageSize";
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and DsID='3' and (DlcID= '$xKey' || DlcID='$zKey') and (DrsSendDate!='0000-00-00 00:00:00' and DrsSendDate like '$searchYear-$monthe-%') order by DrsSendDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID31DlcPS2LimitDrsSendDate($xKey,$yKey,$zKey,$start,$pageSize,$monthe,$searchYear,$searchName){
if($searchName!=""){
$q="select a.DocSubject,b.* from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc limit $start, $pageSize";
}else{
$q="select * from DocReceiveSend where DocGroup='$yKey' and DsID='3' and (DlcID= '$xKey' || DlcID='$zKey') and DrsSendDate like '$searchYear-$monthe-%' order by DrsSendDate desc limit $start, $pageSize";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDsID1DlcPS2Limit($xKey,$yKey,$zKey,$start,$pageSize){
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and DsID='1' and (DlcID= '$xKey' || DlcID='$zKey') order by DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDDrsMainPsY($xKey){
$this->SetQuery("select personId as num from DocReceiveSend where DrsFromDrsID='$xKey' and DrsMainPs='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function s(){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey'<br>";
if ($this->SetQuery("select * from DocReceiveSend where DrsID='226'")){
//if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='604'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDDrsMainPs($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey' and DrsMainPs='Y'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDDocIDDrsMainPsY($xKey,$yKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey' and DocID='$yKey' and DrsMainPs='Y'")){
return 1;
}else {
return 0;
}
}
function updateinbox($xKey,$yKey){
//echo "select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsflagRead='N' and DrsDelete!='Y' order by DrsReceiveDate desc<br>";
if ($this->SetQuery("select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsflagRead='N' and DrsDelete!='Y' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function CountDocInFolder($xKey,$yKey){
$this->SetQuery("select count(DrsID)as num from DocReceiveSend where personId ='$xKey' and DrsflagRead='N' and DrsDelete!='Y' and DrsInboxID='$yKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByPersonIdDrsDeleteDrsflagReadDrsInboxID($xKey,$yKey){
//echo "select * from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and (DsID='4' || DsID='5') and DrsflagRead='N' and DrsDelete!='Y' order by DrsReceiveDate desc<br>";
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and DrsflagRead='N' and DrsDelete!='Y' and DrsInboxID='$yKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDAnID($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DocID='$xKey' and AnID!=0")){
return 1;
}else {
return 0;
}
}
function searchHaveSendDoc($pssend,$nextpssend,$searchDoc){
$q="select a.DocID as DocuID, b. * from Documents a inner join DocReceiveSend b on (a.DocPID = '$searchDoc' || (a.DocID='$searchDoc' && a.DocPID=0)) and a.DocID = b.DocID and b.DsID = '0' and b.DrsFromDrsID != '0' and (b.DlcID = '$pssend' || b.DlcID = '$nextpssend')";
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function searchHaveSendDocps($ps,$searchDoc){
$q="select a.DocID as DocuID, b. * from Documents a inner join DocReceiveSend b on (a.DocPID = '$searchDoc' || (a.DocID='$searchDoc' && a.DocPID=0)) and a.DocID = b.DocID and b.DrsFromDrsID != '0' and b.DlcID = '0' and b.personId='$ps' ";
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchByDocIDDsID3($xKey){
//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 DocReceiveSend where DocID= '$xKey' and DsID='3'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDDsID3Docgroup($xKey,$maxgroup){
//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 DocReceiveSend where DocID= '$xKey' and DsID='3' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchPreDocSign($xKey,$yKey,$maxgroup){
//echo "select * from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ";
if ($this->SetQuery("select * from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchPreDocSend($xKey,$yKey,$maxgroup){
//echo "select * from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ";
if ($this->SetQuery("select * from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchPreDocReceive($xKey,$yKey,$maxgroup,$DocID){
//echo "select * from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ";
if ($this->SetQuery("select * from DocReceiveSend where DsID='0' and (DlcID='$xKey' || DlcID='$yKey') and DocID='$DocID' and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcID($DLCID,$MaxDocGroup,$DlcPS2){
//echo "select a.DocID as DocuID, a.DocPID as DocuPID, b. * from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and a.DocID=b.DocID ";
if ($this->SetQuery("select a.DocID as DocuID, a.DocPID as DocuPID, b. * from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and a.DocID=b.DocID and b.DrsfSendBack!='Y' order by b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcIDcount($DLCID,$MaxDocGroup,$DlcPS2,$monthe,$searchYear,$searchName){
if($searchName!=""){
$p="and a.DocSubject like '%$searchName%'";
}
//echo "select a.DocID as DocuID, a.DocPID as DocuPID, b. * from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and a.DocID=b.DocID and b.DrsfSendBack='Y' and b.DrsReceiveDate like '$searchYear-$monthe-%' $p order by b.DrsReceiveDate desc";
if ($this->SetQuery("select a.DocID as DocuID, a.DocPID as DocuPID, b. * from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and a.DocID=b.DocID and b.DrsfSendBack='Y' and b.DrsReceiveDate like '$searchYear-$monthe-%' $p order by b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcIDlimit($DLCID,$MaxDocGroup,$DlcPS2,$monthe,$searchYear,$searchName,$start,$pageSize){
if($searchName!=""){
$p="and a.DocSubject like '%$searchName%'";
}
//echo "select a.DocID as DocuID, a.DocPID as DocuPID, b. * from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and a.DocID=b.DocID and b.DrsfSendBack='Y' and b.DrsReceiveDate like '$searchYear-$monthe-%' $p order by b.DrsReceiveDate desc";
if ($this->SetQuery("select a.DocID as DocuID, a.DocPID as DocuPID, b. * from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and a.DocID=b.DocID and b.DrsfSendBack='Y' and b.DrsReceiveDate like '$searchYear-$monthe-%' $p order by b.DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
/*
function SearchByDlcIDDocGroupRsIDDtIDjjjjjjjjjjjjjj($xKey,$yKey,$zKey,$zKey2){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
if ($this->SetQuery("select DocNo, DocDate, CertificatePs, DocDateCreate, DslID, DclID from (
(select DocNo as DocNo, DocDate as DocDate, CertificatePs as CertificatePs,
DocDateCreate as DocDateCreate, DslID as DslID, DclID as DclID,
docsoutterRPID as RPID, docsoutterNote as Note, docsoutterSGID as SGID,
docsoutterRegDate as RegDate from docsoutter
where docsoutterRegDate between '$xstart' and '$xend'
and docsoutterDirection = '$xdirec'
and docsoutterSGID = '$xSGID'
)
union
(select docsaffixedCRNo as CRNo,docsaffixedBRNo as BRNo, docsaffixedBDate as BDate,
docsaffixedFrom as DFrom, docsaffixedTo as DTo, docsaffixedSubject as Subject,
docsaffixedRPID as RPID, docsaffixedNote as Note, docsaffixedSGID as SGID,
docsaffixedRegDate as RegDate from docsaffixed
where docsaffixedRegDate between '$xstart' and '$xend'
and docsaffixedDirection = '$xdirec' and docsaffixedSGID = '$xSGID'
)
) x order by RegDate")){
return 1;
}else {
return 0;
}
}
*/
} //--End class docreceivesend--
?>
|