Viewing file: clsDocReceiveSendMobile.php (59.43 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;
var $DrsReadDoc;
var $DrsWSign;
var $DrsMainDept;
var $DrsSignEndDoc;
var $DrsDeleteAdmin;
var $DrsSendEndDoc;
var $DrsNoRegisReceive;
var $fn;//Mobile
function DocReceiveSend(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
if($this->DrsReceiveDate==''){ $this->DrsReceiveDate='0000-00-00 00:00:00'; }
if($this->DrsSendDate==''){ $this->DrsSendDate='0000-00-00 00:00:00'; }
if($this->DrsDocDueDate==''){ $this->DrsDocDueDate='0000-00-00'; }
if($this->DrsDocReceiveDate==''){ $this->DrsDocReceiveDate='0000-00-00 00:00:00'; }
if($this->DocRefAnsDate==''){ $this->DocRefAnsDate='0000-00-00 00:00:00'; }
if($this->DrsSendDocNew==''){ $this->DrsSendDocNew='0000-00-00 00:00:00'; }
if($this->DrsstartDatePost==''){ $this->DrsstartDatePost='0000-00-00'; }
if($this->DrsendDatePost==''){ $this->DrsendDatePost='0000-00-00'; }
$this->DrsSign = iconv('UTF-8','TIS-620',$this->DrsSign);
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)."',
'".th2a($this->DrsReadDoc)."',
'".th2a($this->DrsWSign)."',
'".th2a($this->DrsMainDept)."',
'".th2a($this->DrsSignEndDoc)."',
'".th2a($this->DrsDeleteAdmin)."',
'".th2a($this->DrsByPassPropose)."',
'".th2a($this->DrsSendEndDoc)."',
'".th2a($this->DrsNoRegisReceive)."'
)";
}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)."',
DrsReadDoc='".th2a($this->DrsReadDoc)."',
DrsWSign='".th2a($this->DrsWSign)."',
DrsMainDept='".th2a($this->DrsMainDept)."',
DrsSignEndDoc='".th2a($this->DrsSignEndDoc)."',
DrsDeleteAdmin='".th2a($this->DrsDeleteAdmin)."',
DrsByPassPropose='".th2a($this->DrsByPassPropose)."',
DrsSendEndDoc='".th2a($this->DrsSendEndDoc)."',
DrsNoRegisReceive='".th2a($this->DrsNoRegisReceive)."'
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=$this->DrsSendBack;
$this->DrsByPassPropose=$this->DrsByPassPropose;
}
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 SearchByKeyName($xKey,$name){
if ($this->SetQuery("select $name from DocReceiveSend where DrsID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus3($xKey,$yKey){
//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='3'")){
return 1;
}else {
return 0;
}
}
function SearchByDocGroupDocIDStatus2($xKey,$yKey){
//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 SearchByDocGroupDocIDStatus1($xKey,$yKey){
//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='1'")){
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 SearchByDlcIDDocGroup2($xKey,$yKey){
//echo "select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey'<br>";
if ($this->SetQuery("select * from DocReceiveSend where DlcID= '$xKey' and DocGroup='$yKey'")){
return 1;
}else {
return 0;
}
}
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 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 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 SearchCountByDocSign($xKey,$zKey,$zKey3,$monthe,$searchYear,$searchName,$searchNo,$searchdocdate,$selectdocdatevalu,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsSendDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchName!="" && $searchNo==""){
$q="select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID and a.DocSubject like '%$searchName%' $hh";
}else if($searchName=="" && $searchNo!=""){
$q="select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' $hh";
}else if($searchName!="" && $searchNo!=""){
$q="select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' $hh";
}else{
$q="select count(DrsID) as num from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID $hh";
}
$this->SetQuery($q);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountByDocforWSign($xKey,$zKey,$zKey3,$monthe,$searchYear,$searchName,$searchNo,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.signDateTime like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchName!="" && $searchNo==""){
$q="select count(a.DocID) as num from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID and a.DocSubject like '%$searchName%' $hh";
}else if($searchName=="" && $searchNo!=""){
$q="select count(a.DocID) as num from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' $hh";
}else if($searchName!="" && $searchNo!=""){
$q="select count(a.DocID) as num from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' $hh";
}else{
$q="select count(a.DocID) as num from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID $hh";
}
$this->SetQuery($q);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
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 SearchByDocSign($xKey,$zKey,$zKey3,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo){
echo 'fff';
die();
/*
if($searchName!="" && $searchNo==""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.DrsWSign,a.DrsSendDate,
b.DrsID, b.DrsSendDate, b.DrsWSign 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 if($searchName=="" && $searchNo!=""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.DrsWSign,a.DrsSendDate,
b.DrsID, b.DrsSendDate, b.DrsWSign 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.DocNo like '%$searchNo%' order by b.DrsSendDate desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.DrsWSign,a.DrsSendDate,
b.DrsID, b.DrsSendDate, b.DrsWSign 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.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc limit $start, $pageSize";
}else{
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.DrsWSign,a.DrsSendDate,
b.DrsID, b.DrsSendDate, b.DrsWSign 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 order by b.DrsSendDate desc limit $start, $pageSize";
}
echo $q;
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}*/
function SearchByDocSign($xKey,$zKey,$zKey3,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsSendDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchName!="" && $searchNo==""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate, b.DrsWSign from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID and a.DocSubject like '%$searchName%' $hh order by b.DrsSendDate desc limit $start, $pageSize";
}else if($searchName=="" && $searchNo!=""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate, b.DrsWSign from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' $hh order by b.DrsSendDate desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate, b.DrsWSign from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' $hh order by b.DrsSendDate desc limit $start, $pageSize";
}else{
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate, b.DrsWSign from Documents a inner join DocReceiveSend b on b.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.DsID='2' $ff and a.DocID=b.DocID $hh order by b.DrsSendDate desc limit $start, $pageSize";
}
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchByDocforWSign($xKey,$zKey,$zKey3,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo,$searchdocdate,$selectdocdatevalue,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.signDateTime like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchName!="" && $searchNo==""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,
b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID and a.DocSubject like '%$searchName%' $hh order by b.signDateTime desc limit $start, $pageSize";
}else if($searchName=="" && $searchNo!=""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,
b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' $hh order by b.signDateTime desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,
b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' $hh order by b.signDateTime desc limit $start, $pageSize";
}else{
$q="select a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,
b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') $ff and a.DocID=b.DocID $hh order by signDateTime 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' and DrsDeleteAdmin!='Y' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchCountBypersonIdDrsDelete($xKey){
if ($this->SetQuery("select DocID from DocReceiveSend where personId ='$xKey' and DrsflagRead!='N' and DrsDelete!='Y' and DrsDeleteAdmin!='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 SearchBypersonIdDrsDelete2DrsInboxIDDrsflagReadsearchNo($xKey,$zKey,$DrsInboxID,$searchNo){
if($zKey!="" && $searchNo==""){
$a="and DocID in(select DocID from Documents where DocSubject like '%$zKey%')";
}else if($zKey=="" && $searchNo!=""){
$a="and DocID in(select DocID from Documents where DocNo like '%$searchNo%')";
}else if($zKey!="" && $searchNo!=""){
$a="and DocID in(select DocID from Documents where DocNo like '%$searchNo%' and 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";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and (DsID='4' || DsID='5' || DsID='7') and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $a and DrsInboxID='$DrsInboxID' and DrsflagRead='N' order by DrsReceiveDate desc");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchBypersonId2DrsDeleteLimitDrsInboxIDDrsflagReadsearchNo($xKey,$start,$pageSize,$zKey,$DrsInboxID,$searchNo){
if($zKey!="" && $searchNo==""){
$a="and DocID in(select DocID from Documents where DocSubject like '%$zKey%')";
}else if($zKey=="" && $searchNo!=""){
$a="and DocID in(select DocID from Documents where DocNo like '%$searchNo%')";
}else if($zKey!="" && $searchNo!=""){
$a="and DocID in(select DocID from Documents where DocNo like '%$searchNo%' and 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' || DsID='7') and DrsDelete!='Y' and DrsDeleteAdmin!='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 b.*,a.eDoc from Documents a inner join DocReceiveSend b on b.personId ='$xKey' and b.DrsflagRead!='N' and b.DrsDelete!='Y' and b.DrsDeleteAdmin!='Y' and a.DocID=b.DocID order by b.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 SearchByDocIDStatus3register($xKey){
//echo "select DrsID from DocReceiveSend where DocID='$xKey' and DsID='3'<br>";
if ($this->SetQuery("select DrsID 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 SearchByDocIDStatus1($xKey){
if ($this->SetQuery("select DrsID, DrsflagRead 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 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 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 SearchCountSendDoc($xKey,$yKey,$zKey,$monthe,$searchYear,$searchName,$searchNo,$searchdocdate,$selectdocdatevalue,$selectDtID,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsSendDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($selectDtID!=''){
$gg="and a.DtID= '$selectDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchName!="" && $searchNo==""){
$q="select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $gg and a.DocID=b.DocID and a.DocSubject like '%$searchName%' $hh";
}else if($searchName=="" && $searchNo!=""){
$q="select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' $hh";
}else if($searchName!="" && $searchNo!=""){
$q="select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' $hh";
}else{
$q="select count(b.DrsID) as num from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff and a.DocID=b.DocID $hh";
}
$this->SetQuery($q);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
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 SearchCountSendDoclimit($xKey,$yKey,$zKey,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo,$searchdocdate,$selectdocdatevalue,$selectDtID,$folderstaff,$forfolderstaff){
if($selectdocdatevalue=="1" || $selectdocdatevalue=="0" || $selectdocdatevalue==""){
$ff="and b.DrsSendDate like '$searchYear-$monthe-%'";
}else if($selectdocdatevalue=="2"){
$ff="and a.DocDate= '$searchdocdate'";
}
if($selectDtID!=''){
$gg="and a.DtID= '$selectDtID'";
}
if($folderstaff!="all" && $folderstaff!=""){
$hh="and a.$forfolderstaff='$folderstaff'";
}
if($searchName!="" && $searchNo==""){
$q="select a.DocTypeNo,a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $gg and a.DocID=b.DocID and a.DocSubject like '%$searchName%' $hh order by b.DrsSendDate desc limit $start, $pageSize";
}else if($searchName=="" && $searchNo!=""){
$q="select a.DocTypeNo,a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $gg and a.DocID=b.DocID and a.DocNo like '%$searchNo%' $hh order by b.DrsSendDate desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.DocTypeNo,a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $gg and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' $hh order by b.DrsSendDate desc limit $start, $pageSize";
}else{
$q="select a.DocTypeNo,a.DtID,a.DocNo,a.DocFrom,a.DocPID,a.DlcID,a.RsID,a.DocID,a.DocSubject,a.eDoc,a.DocDate,b.DlcID as DlcIDDrs,
b.DrsID, b.DrsSendDate from Documents a inner join DocReceiveSend b on b.DocGroup='$yKey' and b.DsID='3' and (b.DlcID= '$xKey' || b.DlcID='$zKey') $ff $gg and a.DocID=b.DocID $hh order by b.DrsSendDate desc limit $start, $pageSize";
}
//echo $q;
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){
//echo "select personId as num from DocReceiveSend where DrsFromDrsID='$xKey' and DrsMainPs='Y'";
$this->SetQuery("select personId as num from DocReceiveSend where DrsFromDrsID='$xKey' and DrsMainPs='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
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 SearchByDrsFromDrsIDDocIDDrsMainPsYDrsID($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' and DrsDeleteAdmin!='Y' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function CountDocInFolder($xKey,$yKey){ // echo "select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and DrsflagRead='N' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' and DrsInboxID='$yKey'";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and DrsflagRead='N' and DrsDelete!='Y' and DrsDeleteAdmin!='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 DrsDeleteAdmin!='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 searchHaveSendDocToPs($pssend,$nextpssend,$searchDoc){
$this->SetQuery("select count(a.DocID) as num 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 ($result=$this->GetResult()) {
return $result['num'];
}
}
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 DocReceiveSend where DocID= '$xKey' and DsID='3'";
if ($this->SetQuery("select * from DocReceiveSend where DocID= '$xKey' and DsID='3'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDDsID0($xKey){
//echo "select * from DocReceiveSend where DocID= '$xKey' and DsID='3'";
if ($this->SetQuery("select * from DocReceiveSend where DocID= '$xKey' and DsID='0'")){
return 1;
}else {
return 0;
}
}
function SearchByDocIDDsID3Docgroup($xKey,$maxgroup){
//echo "select * from DocReceiveSend where DocID= '$xKey' and DsID='3' and DocGroup='$maxgroup' ";
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 DrsFromDrsID from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup'")){
return 1;
}else {
return 0;
}
}
function SearchCountPreDocSign($xKey,$yKey,$maxgroup){
//echo "select * from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchPreDocSignforDlpID0($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 DrsFromDrsID from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' and DrsWSign!='Y'")){
return 1;
}else {
return 0;
}
}
function SearchCountPreDocSignforDlpID0($xKey,$yKey,$maxgroup){
//echo "select * from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' and DrsWSign!='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchPreDocSend($xKey,$yKey,$maxgroup){
//echo "select DrsFromDrsID from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' <br>";
if ($this->SetQuery("select DrsFromDrsID from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchCountPreDocSend($xKey,$yKey,$maxgroup){
//echo "select count(DrsID) as num from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
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 SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcID2($DLCID,$MaxDocGroup,$DlcPS2){
//echo "select DlcID, personId,DrsSendBack,DrsReceiveDate,DrsID,DocID from DocReceiveSend where DsID='7' and (DrsSendBackDlcID ='$DLCID' || DrsSendBackDlcID ='$DlcPS2') and DocGroup='$MaxDocGroup' and DrsfSendBack!='Y' order by DrsReceiveDate desc";
if ($this->SetQuery("select DlcID, personId,DrsSendBack,DrsReceiveDate,DrsID,DocID,DrsPsIDCreate from DocReceiveSend where DsID='7' and (DrsSendBackDlcID ='$DLCID' || DrsSendBackDlcID ='$DlcPS2') and DocGroup='$MaxDocGroup' and DrsfSendBack!='Y' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcIDcountsearchNo($DLCID,$MaxDocGroup,$DlcPS2,$monthe,$searchYear,$searchName,$searchNo){
if($searchName!=""){
$p="and a.DocSubject like '%$searchName%'";
}
if($searchNo!=""){
$q="and a.DocNo like '%$searchNo%'";
}
//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";
$this->SetQuery("select count(b.DrsID) as num 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 $q");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcIDlimitsearchNo($DLCID,$MaxDocGroup,$DlcPS2,$monthe,$searchYear,$searchName,$start,$pageSize,$searchNo){
if($searchName!=""){
$p="and a.DocSubject like '%$searchName%'";
}
if($searchNo!=""){
$q="and a.DocNo like '%$searchNo%'";
}
//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 $q order by b.DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDlcIDDocGroupDrsSendBackDrsSendBackDlcIDlimitsearchNo2($DLCID,$MaxDocGroup,$DlcPS2,$monthe,$searchYear,$searchName,$start,$pageSize,$searchNo){
if($searchName!=""){
$p="and a.DocSubject like '%$searchName%'";
}
if($searchNo!=""){
$q="and a.DocNo like '%$searchNo%'";
}
//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.DlcID,b.personId,b.DrsSendBack,b.DrsReceiveDate 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 $q order by b.DrsReceiveDate desc limit $start, $pageSize")){
return 1;
}else {
return 0;
}
}
function SearchByDocID($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DocID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchDeptSendDocforSign($xKey){
if ($this->SetQuery("select DrsID ,DrsDlcIDCreate, DrsPsIDCreate,DrsFromDrsID from DocReceiveSend where DocID='$xKey' and DsID='0'")){
return 1;
}else {
return 0;
}
}
function SearchCountBypersonIdDocGroupDsID0($xKey,$yKey){
//echo "select count(DrsID) as num from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and DrsflagRead!='N' and DsID='0'";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and DrsflagRead!='N' and DsID='0' and DrsDelete!='Y' and DrsDeleteAdmin!='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountDrsIDByDlcIDDocGroupDrsSendBackDrsSendBackDlcID($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 ";
//$this->SetQuery("select count(a.DocID) as num from Documents a inner join DocReceiveSend b on b.DsID='7' and (b.DrsSendBackDlcID ='$DLCID' || b.DrsSendBackDlcID ='$DlcPS2') and b.DocGroup='$MaxDocGroup' and b.DrsfSendBack!='Y' and a.DocID=b.DocID");
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where DsID='7' and (DrsSendBackDlcID ='$DLCID' || DrsSendBackDlcID ='$DlcPS2') and DocGroup='$MaxDocGroup' and DrsfSendBack!='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchDlcIDByDocIDDsID3Docgroup($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 DlcID from DocReceiveSend where DocID= '$xKey' and DsID='3' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchByDrsIDRegisterDoc($xKey){
if ($this->SetQuery("select DrsID, DrsstartDatePost,DrsendDatePost, DrsDocTypeNo from DocReceiveSend where DrsID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByshowSendDocSign($xKey){
if ($this->SetQuery("select DrsByPass, DrsSendDate from DocReceiveSend where DrsID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDDrsMainPsDept($xKey){
$this->SetQuery("select DlcID as num from DocReceiveSend where DrsFromDrsID='$xKey' and DrsMainDept='Y'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchCountDocUnread($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and DsID='0' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchDocUnread($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and DsID='0' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c")){
return 1;
}else {
return 0;
}
}
function searchDocUnread_Update($xKey,$start,$end,$DrsDeleteAdmin){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("update DocReceiveSend set DrsDeleteAdmin='$DrsDeleteAdmin' where personId ='$xKey' and DsID='0' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c")){
return 1;
}else {
return 0;
}
}
function searchCountDocRead($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and (DsID='4' || DsID='5') and DrsReadDoc!='' and DrsReadDoc like '%0%' and DrsDelete!='Y' $c";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and (DsID='4' || DsID='5') and DrsReadDoc!='' and DrsReadDoc like '%0%' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchDocRead($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and (DsID='4' || DsID='5') and DrsReadDoc!='' and DrsReadDoc like '%0%' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c")){
return 1;
}else {
return 0;
}
}
function searchDocRead_Update($xKey,$start,$end,$DrsDeleteAdmin){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("update DocReceiveSend set DrsDeleteAdmin='$DrsDeleteAdmin' where personId ='$xKey' and (DsID='4' || DsID='5') and DrsReadDoc!='' and DrsReadDoc like '%0%' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c")){
return 1;
}else {
return 0;
}
}
function searchCountUnReceiveDoc($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
//echo "select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and DsID='5' and ((DrsReadDoc!='' and DrsReadDoc not like '%0%') || (DrsReadDoc=='')) and DrsDocReceiveDate=='0000-00-00 00:00:00' and DrsDelete!='Y' $c";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and DsID='5' and ((DrsReadDoc!='' and DrsReadDoc not like '%0%') || (DrsReadDoc='')) and DrsDocReceiveDate='0000-00-00 00:00:00' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchUnReceiveDoc($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select * from DocReceiveSend where personId ='$xKey' and DsID='5' and ((DrsReadDoc!='' and DrsReadDoc not like '%0%') || (DrsReadDoc='')) and DrsDocReceiveDate='0000-00-00 00:00:00' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c")){
return 1;
}else {
return 0;
}
}
function searchUnReceiveDoc_Update($xKey,$start,$end,$DrsDeleteAdmin){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("update DocReceiveSend set DrsDeleteAdmin='$DrsDeleteAdmin' where personId ='$xKey' and DsID='5' and ((DrsReadDoc!='' and DrsReadDoc not like '%0%') || (DrsReadDoc='')) and DrsDocReceiveDate='0000-00-00 00:00:00' and DrsDelete!='Y' and DrsDeleteAdmin!='Y' $c")){
return 1;
}else {
return 0;
}
}
function SearchPreDocReceive_Update($xKey,$yKey,$maxgroup,$DocID,$personId){
//echo "update DocReceiveSend set DlcID='$xKey', DrsReceivePersonId='$personId' where DsID='0' and (DlcID='$xKey' || DlcID='$yKey') and DocID='$DocID' and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' <br>";
if ($this->SetQuery("update DocReceiveSend set DlcID='$xKey', DrsReceivePersonId='$personId' 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 SearchPreDocSend_Update($xKey,$yKey,$maxgroup,$personId){
//echo "update DocReceiveSend set DlcID='$xKey',DrsReceivePersonId='$personId' where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup'<br> ";
if ($this->SetQuery("update DocReceiveSend set DlcID='$xKey',DrsReceivePersonId='$personId' where DsID='3' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchPreDocSend_Update2($xKey,$personId,$yKey){
//echo "update DocReceiveSend set DrsSendDlcID='$xKey',DrsSendPersonId='$personId' where DrsID='$yKey' <Br>";
if ($this->SetQuery("update DocReceiveSend set DrsSendDlcID='$xKey',DrsSendPersonId='$personId' where DrsID='$yKey' ")){
return 1;
}else {
return 0;
}
}
function SearchDrsReceiveDate($xKey){
$this->SetQuery("select DrsReceiveDate as num from DocReceiveSend where DrsID= '$xKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchPreDocSign_Update($xKey,$yKey,$maxgroup,$personId){
//echo "update DocReceiveSend set DlcID='$xKey',DrsReceivePersonId='$personId' where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' <br>";
if ($this->SetQuery("update DocReceiveSend set DlcID='$xKey',DrsReceivePersonId='$personId' where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' ")){
return 1;
}else {
return 0;
}
}
function SearchPreDocSignforDlpID0_Update($xKey,$yKey,$maxgroup,$personId){
//echo "update DocReceiveSend set DlcID='$xKey',DrsReceivePersonId='$personId' where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' and DrsWSign!='Y'<br>";
if ($this->SetQuery("update DocReceiveSend set DlcID='$xKey',DrsReceivePersonId='$personId' where DsID='2' and (DlcID='$xKey' || DlcID='$yKey') and DrsSendDate='0000-00-00' and DocGroup='$maxgroup' and DrsWSign!='Y'")){
return 1;
}else {
return 0;
}
}
function SearchPreDocSign_Update2($xKey,$personId,$yKey){
//echo "update DocReceiveSend set DrsSendDlcID='$xKey',DrsSendPersonId='$personId' where DrsID='$yKey' <br>";
if ($this->SetQuery("update DocReceiveSend set DrsSendDlcID='$xKey',DrsSendPersonId='$personId' where DrsID='$yKey' ")){
return 1;
}else {
return 0;
}
}
function SearchPreDocSignforDlpID0_Update2($xKey,$personId,$yKey){
//echo "update DocReceiveSend set DrsSendDlcID='$xKey',DrsSendPersonId='$personId' where DrsID='$yKey'<br>";
if ($this->SetQuery("update DocReceiveSend set DrsSendDlcID='$xKey',DrsSendPersonId='$personId' where DrsID='$yKey'")){
return 1;
}else {
return 0;
}
}
function DocReceiveUpdateDocRefAnsDate($xKey,$yKey){
//echo "update DocReceiveSend set DocRefAnsDate='$yKey' where DrsID='$xKey'";
if ($this->SetQuery("update DocReceiveSend set DocRefAnsDate='$yKey' where DrsID='$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchDrsReceivePersonId($xKey){
if ($this->SetQuery("select DrsReceivePersonId,DlcID from DocReceiveSend where DocID= '$xKey' and DsID='1'")){
return 1;
}else {
return 0;
}
}
function SearchByDrsIDReceiveAll($xKey){
//echo "select a.DocID, a.DtID, a.RsID,b.DlcID from Documents a inner join DocReceiveSend b on b.DrsID='$xKey' and a.DocID=b.DocID";
if ($this->SetQuery("select a.DocID, a.DtID, a.RsID,b.DlcID,b.DocGroup,b.DrsID from Documents a inner join DocReceiveSend b on b.DrsID='$xKey' and a.DocID=b.DocID")){
return 1;
}else {
return 0;
}
}
function SearchproposeAllDoc($xKey){
if ($this->SetQuery("select a.DocTypeNo,a.DocNo,a.DocDate,a.DocSubject,a.DocID from Documents a inner join DocReceiveSend b on b.DrsID ='$xKey' and a.DocID=b.DocID")){
return 1;
}else {
return 0;
}
}
function SearchproposeAllDoc2($xKey){
if ($this->SetQuery("select a.DocID,b.* from Documents a inner join DocReceiveSend b on b.DrsID ='$xKey' and a.DocID=b.DocID")){
return 1;
}else {
return 0;
}
}
function SearchprintRepDrsSendBack($MaxDocGroup,$deptId,$start,$end){
if($start==$end){
$c="and a.DrsReceiveDate like '$start%'";
}else{
$c="and a.DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if ($this->SetQuery("select a.DlcID, a.personId,a.DrsSendBack,a.DrsReceiveDate,a.DrsID,a.DrsPsIDCreate,a.DocID,c.DocSubject,c.DocNo,c.DtID from
DocReceiveSend a inner join DocLineConfig b on a.DsID='7' and b.deptId='$deptId' and a.DrsSendBackDlcID=b.DlcID and a.DocGroup='$MaxDocGroup' and b.DlcIDSecond!='Y' $c
inner join Documents c on a.DocID=c.DocID
order by a.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchDrsProposeByDrsFromDrsID($xKey){
$this->SetQuery("select DrsPropose as num from DocReceiveSend where DrsFromDrsID= '$xKey'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchCountDocAll($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' $c");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchCountDocAllDel($xKey,$start,$end){
if($start==$end){
$c="and DrsReceiveDate like '$start%'";
}else{
$c="and DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where personId ='$xKey' and (DrsDelete='Y' || DrsDeleteAdmin='Y') $c");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function searchHaveSendDoc2($searchDoc){
$q="select b.DlcID 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'";
if ($this->SetQuery($q)){
return 1;
}else {
return 0;
}
}
function SearchDocEntryPersonId($start,$end,$DocTypeNoStart,$DocTypeNoEnd,$DocSubject,$DocNo,$printorder,$personId){
//echo $start.'---'.$end.'---'.$DocTypeNoStart.'---'.$$DocTypeNoEnd.'---'.$$DocSubject.'---'.$DocNo.'<br>';
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.DrsReceiveDate like '$start%'";
}else{
$c="and b.DrsReceiveDate between '$start 00:00:00' and '$end 23:59:59'";
}
if($DocNo!=""){
$e="and a.DocNo like '%$DocNo%'";
}
//echo "select b.*,a.DtID,a.DocTypeNo,a.DocNo,a.DocSubject,b.DrsReceiveDate,b.DocID,b.DrsID from Documents a inner join DocReceiveSend b on a.DocID=b.DocID and b.DrsDelete!='Y' and b.DrsDeleteAdmin!='Y' and b.personId='$personId' $a $b $c $e order by b.DrsReceiveDate desc";
if ($this->SetQuery("select b.*,a.DtID,a.DocTypeNo,a.DocNo,a.DocSubject,b.DrsReceiveDate,b.DocID,b.DrsID from Documents a inner join DocReceiveSend b on a.DocID=b.DocID and b.DrsDelete!='Y' and b.DrsDeleteAdmin!='Y' and b.personId='$personId' $a $b $c $e order by b.DrsReceiveDate asc")){
return 1;
}else {
return 0;
}
}
function SearchBypersonIdDrsDeleteMoblie($xKey){
if ($this->SetQuery("select b.*,a.eDoc from Documents a inner join DocReceiveSend b on b.personId ='$xKey' and b.DrsflagRead!='N' and b.DrsDelete!='Y' and b.DrsDeleteAdmin!='Y' and a.DocID=b.DocID and b.DsID='0' order by b.DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchDetailSendBackDocMoblie($DLCID,$MaxDocGroup,$DlcPS2){
if ($this->SetQuery("select DlcID, personId,DrsSendBack,DrsReceiveDate,DrsID,DocID,DrsPsIDCreate from DocReceiveSend where DsID='7' and (DrsSendBackDlcID ='$DLCID' || DrsSendBackDlcID ='$DlcPS2') and DocGroup='$MaxDocGroup' and DrsfSendBack!='Y' order by DrsReceiveDate desc")){
return 1;
}else {
return 0;
}
}
function SearchByDrsFromDrsIDDrsMainDept($xKey){
if ($this->SetQuery("select * from DocReceiveSend where DrsFromDrsID='$xKey' and DrsMainDept='Y'")){
return 1;
}else {
return 0;
}
}
} //--End class docreceivesend--
?>
|