Viewing file: clsDocReceiveSend.php (36.32 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;
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)."',
'".th2a($this->DrsReadDoc)."',
'".th2a($this->DrsWSign)."'
)";
}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)."'
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;
}
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 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 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){
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' and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc";
}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' and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' order by b.DrsSendDate desc";
}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' 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";
}else{
$q="select count(DrsID) as num from DocReceiveSend where DocGroup= '$xKey' and (DlcID='$zKey' || DlcID='$zKey3') and DsID='2' and DrsSendDate like '$searchYear-$monthe-%' order by DrsSendDate desc";
}
$this->SetQuery($q);
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function SearchCountByDocforWSign($xKey,$zKey,$zKey3,$monthe,$searchYear,$searchName,$searchNo){
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') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.signDateTime desc";
}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') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' order by b.signDateTime desc";
}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') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' order by b.signDateTime desc";
}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') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID order by b.signDateTime desc";
}
$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){
if($searchName!="" && $searchNo==""){
$q="select a.DocID, a.DlcID, 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.DocID, a.DlcID, 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.DocID, a.DlcID, 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 DocID, DlcID, DrsWSign, DrsID, DrsSendDate 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 SearchByDocforWSign($xKey,$zKey,$zKey3,$start,$pageSize,$monthe,$searchYear,$searchName,$searchNo){
if($searchName!="" && $searchNo==""){
$q="select a.DocID, a.DlcID , b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.signDateTime desc limit $start, $pageSize";
}else if($searchName=="" && $searchNo!=""){
$q="select a.DocID, a.DlcID , b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' order by b.signDateTime desc limit $start, $pageSize";
}else if($searchName!="" && $searchNo!=""){
$q="select a.DocID, a.DlcID , b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' and a.DocSubject like '%$searchName%' order by b.signDateTime desc limit $start, $pageSize";
}else{
$q="select a.DocID, a.DlcID , b.DrsID, b.signDateTime from Documents a inner join docwsign b on a.DocGroup= '$xKey' and (b.DlcID='$zKey' || b.DlcID='$zKey3') and b.signDateTime like '$searchYear-$monthe-%' and a.DocID=b.DocID 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' 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";
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 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') 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 SearchByDocIDStatus3register($xKey){
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, DrsFromDrsID, 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){
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') and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocSubject like '%$searchName%' order by b.DrsSendDate desc";
}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') and b.DrsSendDate like '$searchYear-$monthe-%' and a.DocID=b.DocID and a.DocNo like '%$searchNo%' order by b.DrsSendDate desc";
}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') 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";
}else{
$q="select count(DrsID) as num from DocReceiveSend where DocGroup='$yKey' and DsID='3' and (DlcID= '$xKey' || DlcID='$zKey') and DrsSendDate like '$searchYear-$monthe-%' order by DrsSendDate desc";
}
$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){
if($searchName!="" && $searchNo==""){
$q="select a.DocID, a.DlcID, 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') 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.DocID, a.DlcID, 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') 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.DocID, a.DlcID, 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') 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 DocID, DlcID, DrsID, DrsSendDate 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 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 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 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 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 * 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 (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 * 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 SearchCountPreDocSend($xKey,$yKey,$maxgroup){
//echo "select * 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 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";
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")){
return 1;
}else {
return 0;
}
}
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 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' order by DrsReceiveDate desc";
$this->SetQuery("select count(DrsID) as num from DocReceiveSend where DocGroup='$yKey' and personId ='$xKey' and DrsflagRead!='N' and DsID='0' order by DrsReceiveDate desc");
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 a.DocID=b.DocID and b.DrsfSendBack!='Y' order by b.DrsReceiveDate desc");
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, 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;
}
}
} //--End class docreceivesend--
?>
|