Viewing file: clsperson.php (50.8 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class base_Person--------------------------
//--PK of base_Person ::
// 1. personId
include_once "clsDB.php";
class Person extends db{
var $result;
var $personId;
var $prefixId;
var $fName;
var $lName;
var $receiveDate;
var $pId;
var $adlineId;
var $adminposId;
var $hireId;
var $majortypeId;
var $levelposId;
var $stepSal;
var $salary;
var $partyAtId;
var $partyId;
var $partypracticeId;
var $deptId;
var $majorId;
var $assignId;
var $promoteDate;
var $educDate;
var $posDate;
var $fullsalDate;
var $typemoveId;
var $fyDecor;
var $lastDecor;
var $fRetire;
var $adminId;
var $done;
var $accountNo;
var $useSalary;
var $personCode;
var $oldpersonCode;
var $admidYear;
var $firstadmidDate;
var $posDegree;
var $posEducmajor;
var $enterType;
var $fStatus;
var $salary2;
var $fullStep;
var $levelposId2;
var $stepSal2;
var $useSalary2;
var $levelId;
var $deptkpld;
var $outDate;
function Person(&$c){
$this->c=$c;
}
function AddNew(){
$this->status = 1;
}
function Edit(){
$this->status = 2;
}
function Save(){
if ($this->status==1){
//uncomment a line below if your table use ID as running number
//$this->personId=$this->GetNextCode();
$sql = "insert into Person values(
'$this->personId',
'$this->prefixId',
'$this->fName',
'$this->lName',
'$this->receiveDate',
'$this->pId',
'$this->adlineId',
'$this->adminposId',
'$this->hireId',
'$this->majortypeId',
'$this->levelposId',
'$this->stepSal',
'$this->salary',
'$this->partyId',
'$this->deptId',
'$this->majorId',
'$this->assignId',
'$this->promoteDate',
'$this->educDate',
'$this->posDate',
'$this->fullsalDate',
'$this->typemoveId',
'$this->fyDecor',
'$this->lastDecor',
'$this->fRetire',
'$this->adminId',
'$this->done',
'$this->accountNo',
'$this->useSalary',
'$this->personCode',
'$this->oldpersonCode',
'$this->admidYear',
'$this->partyAtId',
'$this->partypracticeId',
'$this->firstadmidDate',
'$this->posDegree',
'$this->posEducmajor',
'$this->enterType',
'$this->fStatus',
'$this->salary2',
'$this->fullStep',
'$this->levelposId2',
'$this->stepSal2',
'$this->useSalary2',
'$this->levelId',
'$this->deptkpId',
'$this->outDate'
)";
}else {
$sql = "update Person set
prefixId='$this->prefixId',
fName='$this->fName',
lName='$this->lName',
receiveDate='$this->receiveDate',
pId='$this->pId',
adlineId='$this->adlineId',
adminposId='$this->adminposId',
hireId='$this->hireId',
majortypeId='$this->majortypeId',
levelposId='$this->levelposId',
stepSal='$this->stepSal',
salary='$this->salary',
partyId='$this->partyId',
deptId='$this->deptId',
majorId='$this->majorId',
assignId='$this->assignId',
promoteDate='$this->promoteDate',
educDate='$this->educDate',
posDate='$this->posDate',
fullsalDate='$this->fullsalDate',
typemoveId='$this->typemoveId',
fyDecor='$this->fyDecor',
lastDecor='$this->lastDecor',
fRetire='$this->fRetire',
adminId='$this->adminId',
done='$this->done',
accountNo='$this->accountNo',
useSalary='$this->useSalary',
personCode='$this->personCode',
oldpersonCode='$this->oldpersonCode',
admidYear='$this->admidYear',
partyAtId='$this->partyAtId',
partypracticeId='$this->partypracticeId',
firstadmidDate='$this->firstadmidDate',
posDegree='$this->posDegree',
posEducmajor='$this->posEducmajor',
enterType='$this->enterType',
fStatus='$this->fStatus',
salary2='$this->salary2',
fullStep='$this->fullStep',
levelposId2='$this->levelposId2',
stepSal2='$this->stepSal2',
useSalary2='$this->useSalary2',
levelId='$this->levelId'
where personId='$this->personId'";
}
//echo "sql = ".$sql."<br>";
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from Person where personId='$this->personId'");
}
function GetNextCode(){
$this->SetQuery("select max(personId) as num from Person");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSPerson(){
$this->SetQuery("select * from Person where personId > 0 order by personId");
}
function GetRecord(){
if ($this->result = $this->GetResult()) {
$this->personId = $this->result['personId'];
$this->prefixId = $this->result['prefixId'];
$this->fName = $this->result['fName'];
$this->lName = $this->result['lName'];
$this->receiveDate = $this->result['receiveDate'];
$this->pId = $this->result['pId'];
$this->adlineId = $this->result['adlineId'];
$this->adminposId = $this->result['adminposId'];
$this->hireId = $this->result['hireId'];
$this->majortypeId = $this->result['majortypeId'];
$this->levelposId = $this->result['levelposId'];
$this->stepSal = $this->result['stepSal'];
$this->salary = $this->result['salary'];
$this->partyAtId = $this->result['partyAtId'];
$this->partyId = $this->result['partyId'];
$this->partypracticeId = $this->result['partypracticeId'];
$this->deptId = $this->result['deptId'];
$this->majorId = $this->result['majorId'];
$this->assignId = $this->result['assignId'];
$this->promoteDate = $this->result['promoteDate'];
$this->educDate = $this->result['educDate'];
$this->posDate = $this->result['posDate'];
$this->fullsalDate = $this->result['fullsalDate'];
$this->typemoveId = $this->result['typemoveId'];
$this->fyDecor = $this->result['fyDecor'];
$this->lastDecor = $this->result['lastDecor'];
$this->fRetire = $this->result['fRetire'];
$this->adminId = $this->result['adminId'];
$this->done = $this->result['done'];
$this->accountNo = $this->result['accountNo'];
$this->useSalary = $this->result['useSalary'];
$this->personCode = $this->result['personCode'];
$this->oldpersonCode = $this->result['oldpersonCode'];
$this->admidYear = $this->result['admidYear'];
$this->firstadmidDate = $this->result['firstadmidDate'];
$this->posDegree = $this->result['posDegree'];
$this->posEducmajor = $this->result['posEducmajor'];
$this->enterType = $this->result['enterType'];
$this->fStatus = $this->result['fStatus'];
$this->salary2 = $this->result['salary2'];
$this->fullStep = $this->result['fullStep'];
$this->levelposId2 = $this->result['levelposId2'];
$this->stepSal2 = $this->result['stepSal2'];
$this->useSalary2 = $this->result['useSalary2'];
$this->posId = $this->result['posId'];
$this->adminposName = $this->result['adminposName'];
$this->levelId= $this->result['levelId'];
$this->deptkpId = $this->result['deptkpId'];
$this->outDate= $this->result['outDate'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
if ($this->SetQuery("select * from Person where personId= '$xKey' and personId > 0")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function SearchByFLName($xKey,$yKey){
if ($this->SetQuery("select * from Person where fName= '$xKey' and lName='$yKey' and personId > 0 order by adminId,levelposId desc,salary desc")){
return 1;
}else {
return 0;
}
}
function SearchByPsYear($xYear){
$this->SetQuery("select max(personCode) as num from Person where admidYear='$xYear' and personId > 0 order by adminId,levelposId desc,salary desc");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function SearchByYear($xYear){
if ($this->SetQuery("select personCode from Person where admidYear= '$xYear' and personId > 0 order by adminId,levelposId desc,salary desc")){
return 1;
}else {
return 0;
}
}
function RSPersonCFLName($xKey,$yKey){
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLName2($xKey,$yKey){
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%' )and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLName3($xKey,$yKey){
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and (fStatus=1 || (fStatus=2 and fRetire=8)) and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLName4($xKey,$yKey){
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=2 and fRetire=8 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function SearchByPsCode($xKey){
if ($this->SetQuery("select * from Person where personCode= '$xKey' and personId > 0 ")){
//if ($this->SetQuery("select * from Person where personCode= '$xKey'")){
return 1;
}else {
return 0;
}
}
function RSPersonCFLNameByHelpwork($xKey,$yKey){
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and (enterType = 4 or enterType=5) and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonByCal($xKey){
$this->SetQuery("select * from Person where (((fStatus=1) and (enterType!=5) and (fRetire=0)) or ((fStatus=2) and ((fRetire=2) or (fRetire=3)))) and deptId='$xKey' and hireId=1 and personId > 0 order by personCode");
}
function RSPersonByCal2($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and deptId='$xKey' and hireId=1) and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonByHire($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and hireId=1 and deptId='$xKey') and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonByHire2($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and hireId=2 and deptId='$xKey') and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonByHireandDep($xKey,$yKey){
$this->SetQuery("select * from Person where hireId='$xKey' and deptId='$yKey' and personId > 0 and fStatus=1 order by adminId,levelposId desc,salary desc");
}
function RSPersonByDep($xKey){
$this->SetQuery("select * from Person where deptId='$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonByDep2($xKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function CheckTimeAdmid($psId,&$sts,&$Er,$cDate){
include_once "../link/function.php";
include_once "clsperson.php";
include_once "clsConnection.php";
$oC = new Connection();
$obj1 = new Person($oC->c);
$obj1->SearchByKey($psId);
$obj1->GetRecord();
$oD1 = GetNowDate();
$oD2 = $obj1->firstadmidDate;
//echo "SSSSSSSSSSS = ".$obj1->firstadmidDate."<BR>";
if($obj1 ->firstadmidDate>$cDate){
$Er[$psId] = "- ??????????? ".abbreDate2($obj1->firstadmidDate)." ???????????????????????????????";
$sts[$psId] = "N";
}
}
function CheckRules($psId,&$sts,&$Er,$startDate,$endDate){
include_once "../link/function.php";
include_once "clshisrules.php";
include_once "clsConnection.php";
$oC = new Connection();
$obj1 = new Hisrule($oC->c);
$obj1->SearchForStep($psId,$startDate,$endDate);
if($obj1->GetRecord()){
$Er[$psId] = "- ????????????????";
$sts[$psId] = "N";
$true=1;
}else{
$true=0;
}
return $true;
}
function CheckLeaveEdu($psId,&$sts,&$Er,$startDate,$endDate){
include_once "../link/function.php";
include_once "../class/clsConnection.php";
include_once "../class/clshisleave_edu.php";
include_once "../class/clscalendar.php";
$oC = new Connection();
$oHl = new Hisleave_edu($oC->c);
$oHl2 = new Hisleave_edu($oC->c);
$oCd = new Calendar($oC->c);
$y="0,0,0";
// ???????????????????????????????
$oHl->RSForStep($psId);
while($oHl->GetRecord()){
//????????????????
//echo "statusAddDateLeave = ".$oHl->statusAddDateLeave;
$x="0,0,0";
$z="0,0,0";
$w="0,0,0";
if($oHl->statusAddDateLeave == "Y"){
// ?????????????????? ???????????????????
$edate=$oHl2->ComputeendNew($oHl->orderNo);
// ?????????????????????????????????????????????
if((($oHl->startLeaveDate<=$startDate) &&($startDate<=$edate )) or (($oHl->startLeaveDate<=$endDate) &&($endDate<=$edate) ) or (($startDate<=$oHl->starDateLeave) &&($oHl->startLeaveDate <= $endDate)) or (($startDate<=$eDate) && ($eDate<=$endDate))){
if($oHl->startLeaveDate < $startDate)
$st = $startDate;
else
$st = $oHl->startLeaveDate;
if($edate > $endDate){
// echo "if"."<BR>";
$ed = $endDate;
// echo "eeeeeeeed = ".$ed;
}
else{
// echo "else"."<BR>";
$ed = $edate;
// echo "dddddddd = ".$ed;
}
//echo "st = ".$st."<BR>";
//echo "ed = ".$ed."<BR>";
$x=time_diff2(splitDateDbL($st),splitDateDbL($ed));
$z = $oCd->calDoubleDate($st,$ed);
$w = calNumDate($x,$z);
//echo "1";
//echo ">>>>>>x = ".$x."<BR>";
//echo ">>>>>>st = ".$st."<BR>";
//echo ">>>>>>ed = ".$ed."<BR>";
}
}else{
if((($oHl->startLeaveDate<=$startDate) &&($startDate<=$oHl->endLeaveDate )) or (($oHl->startLeaveDate<=$endDate) &&($endDate<=$oHl->endLeaveDate) ) or (($startDate<=$oHl->startLeaveDate) &&($oHl->startLeaveDate <= $endDate)) or (($startDate<=$oHl->endLeaveDate) && ($oHl->endLeaveDate<=$endDate))){
if($oHl->startLeaveDate < $startDate)
$st = $startDate;
else
$st = $oHl->startLeaveDate;
if($oHl->endLeaveDate > $endDate)
$ed = $endDate;
else
$ed = $oHl->endLeaveDate;
$x=time_diff2(splitDateDbL($st),splitDateDbL($ed));
$z = $oCd->calDoubleDate($st,$ed);
$w = calNumDate($x,$z);
//echo "2";
// echo ">>>>>>x = ".$x."<BR>";
// echo ">>>>>>st = ".$st."<BR>";
// echo ">>>>>>ed = ".$ed."<BR>";
} // end if
} //enc else
$y = calNumDate($y,$w);
} // end while
list($yearN, $monthN, $dayN) = preg_split("[,]", $y);
if($yearN>0 || $monthN > 2){
$Er[$psId] = "- ???????";
$sts[$psId] = "N";
return 1;
}else{
return 0;
}
} // end function
function CheckLeave($psId,&$sts,&$Er,$startDate,$endDate){
include_once "../link/function.php";
include_once "../class/clsConnection.php";
include_once "../class/clshisleave.php";
$oC = new Connection();
$oHl = new Hisleave($oC->c);
$oHl->RSHisleaveStep($psId);
$sumtot=0;
while($oHl->GetRecord()){
$tot=0;
//echo " >>>> ".$startDate;
//echo ">>>> ".$endDate;
if((($oHl->startLeaveDate<=$startDate) &&($startDate<=$oHl->endLeaveDate )) or (($oHl->startLeaveDate<=$endDate) &&($endDate<=$oHl->endLeaveDate) ) or (($startDate<=$oHl->startLeaveDate) &&($oHl->startLeaveDate <= $endDate)) or (($startDate<=$oHl->endLeaveDate) && ($oHl->endLeaveDate<=$endDate))){
if($oHl->startLeaveDate < $startDate)
$st = $startDate;
else
$st = $oHl->startLeaveDate;
if($oHl->endLeaveDate > $endDate)
$ed = $endDate;
else
$ed = $oHl->endLeaveDate;
$tot = performDate(splitDateDbL($st),splitDateDbL($ed));
// echo ">>>>> tot = ".$tot."<BR>";
} //end if
$sumtot+=$tot;
} //end while
// echo $psId." ???????? = ".$sumtot;
if($sumtot > 23){
$Er[$psId] = "- ????????? 23 ???";
$sts[$psId] = "N";
return 1;
}else{
return 0;
}
} // end funtion
function Psposition($xKey){
include_once "../class/clsConnection.php";
include_once "../class/clsadmid.php";
include_once "../class/clshelpwork.php";
include_once "../class/clspromote.php";
include_once "../class/clsposition.php";
include_once "../class/clsadminpos.php";
include_once "../class/clsadlinepos.php";
include_once "../class/clsdegree.php";
include_once "../class/clslevelpos.php";
include_once "../class/clsparty.php";
$oC = new Connection();
$oAd = new Admid($oC->c);
$oHw = new Helpwork($oC->c);
$oPm = new Promote($oC->c);
$oPt = new Position($oC->c);
$oAm = new Adminpos($oC->c);
$oAl = new Adlinepos($oC->c);
$oDg = new Degree($oC->c);
$oLv = new Levelpos($oC->c);
$oPr = new Party($oC->c);
$oPrp = new Party($oC->c);
$oAd->SearchByPerson($xKey);
$this->SetQuery("CREATE TABLE `TestPosition` (`seq` INT NOT NULL ,`posDate` DATE NOT NULL ,
`posId` VARCHAR( 20 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`adminposName` VARCHAR( 256 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`adlineName` VARCHAR( 256 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`posDegree` VARCHAR( 256 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`levelpos` VARCHAR( 2 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`salary` VARCHAR( 5 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`partyAt` VARCHAR( 256 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`partypractice` VARCHAR( 256 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
`orderNo` VARCHAR( 10 ) CHARACTER SET tis620 COLLATE tis620_thai_ci NOT NULL ,
PRIMARY KEY ( `seq` )
) TYPE = MYISAM CHARACTER SET tis620 COLLATE tis620_thai_ci;
");
$i=0;
while($oAd->GetRecord()){
$oPt->SearchByKey($oAd->pId);
$oPt->GetRecord();
$oAm->SearchByKey($oPt->adminposId);
$oAm->GetRecord();
$oAl->SearchByKey($oAd->adlineId);
$oAl->GetRecord();
$oDg->SearchByKey($oAd->degreeadmidId);
$oDg->GetRecord();
$oLv->SearchByKey($oAd->levelposId);
$oLv->GetRecord();
$oPr->SearchByKey($oAd->partyAtId);
$oPr->GetRecord();
$oPrp->SearchByKey($oAd->partypracticeId);
$oPrp->GetRecord();
$i++;
$sql = "insert into TestPosition values('$i','$oAd->admidreceiveDate', '$oPt->posId', '$oAm->adminposName', '$oAl->adlineName', '$oDg->degreeName', '$oLv->levelposName', '$oAd->salary', '$oPr->partyAbbr', '$oPrp->partyAbbr', '$oAd->orderNo')";
$this->Dml($sql);
}
$oPm->RSPromoteByPs($xKey);
while($oPm->GetRecord()){
$oPt->SearchByKey($oPm->npId);
$oPt->GetRecord();
$oAl->SearchByKey($oPm->nadlineId);
$oAl->GetRecord();
$oAm->SearchByKey($oPt->adminposId);
$oAm->GetRecord();
$oDg->SearchByKey($oPm->posDegree);
$oDg->GetRecord();
$oLv->SearchByKey($oPm->nlevelposId);
$oLv->GetRecord();
//$oPr->SearchByKey($oAd->partyAtId);
//$oPr->GetRecord();
//$oPrp->SearchByKey($oAd->partypracticeId);
//$oPrp->GetRecord();
$i++;
$sql = "insert into TestPosition values('$i','$oPm->promoteDate', '$oPt->posId', '$oAm->adminposName', '$oAl->adlineName', '$oDg->degreeName', '$oLv->levelposName', '$oPm->nsalary', '', '','$oPm->orderNo')";
$this->Dml($sql);
}
$oHw->SearchByPS($xKey);
while($oHw->GetRecord()){
$oPt->SearchByKey($oHw->pId);
$oPt->GetRecord();
$oAl->SearchByKey($oHw->adlineId);
$oAl->GetRecord();
$oAm->SearchByKey($oPt->adminposId);
$oAm->GetRecord();
$oDg->SearchByKey($oHw->posDegree);
$oDg->GetRecord();
$oLv->SearchByKey($oHw->levelposId);
$oLv->GetRecord();
//$oPr->SearchByKey($oAd->partyAtId);
//$oPr->GetRecord();
$oPrp->SearchByKey($oHw->partypracticeId);
$oPrp->GetRecord();
$i++;
$sql = "insert into TestPosition values('$i','$oHw->practiceDate', '$oPt->posId', '$oAm->adminposName', '$oAl->adlineName', '$oDg->degreeName', '$oLv->levelposName', '$oHw->salary', '', '$oPrp->partyAbbr', '$oHw->orderNo')";
$this->Dml($sql);
}
$this->SetQuery("select * from TestPosition order by posDate");
}
function RsPsposition(){
if($this->result=$this->GetResult()){
$this->posDate=$this->result['posDate'];
$this->posId = $this->result['posId'];
$this->adminposName = $this->result['adminposName'];
$this->adlineName = $this->result['adlineName'];
$this->posDegree = $this->result['posDegree'];
$this->levelpos=$this->result['levelpos'];
$this->salary=$this->result['salary'];
$this->partyAt=$this->result['partyAt'];
$this->partypractice=$this->result['partypractice'];
$this->orderNo=$this->result['orderNo'];
return 1;
}else{
$this->Dml("DROP TABLE `TestPosition`");
return 0;
}
}
function RSPersonHireAdminposMajor($xKey,$yKey){
$this->SetQuery("select * from Person where (hireId=1 and fStatus=1 and enterType != 4 and enterType != 5) and adminposId='$xKey' and majortypeId='$yKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonHwAdminposMajor($xKey,$yKey){
$this->SetQuery("select * from Person where (hireId=1 and fStatus=1 and (enterType = 4 or enterType = 5)) and adminposId='$xKey' and majortypeId='$yKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonEmployee($xKey){
$this->SetQuery("select * from Person where (hireId=2 and fStatus=1) and adminposId='$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonEmployee2($xKey){
$this->SetQuery("select * from Person where (hireId=3 and fStatus=1) and adminposId='$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonUpdate(){
$this->SetQuery("select personId,prefixId,fName,lName,adminposId,hireId,levelposId,salary,adminId,personCode,salary2 from Person where personId");
}
function SearchByKeyUpdate($xKey){
if ($this->SetQuery("select personId,prefixId,fName,lName,adminposId,hireId,levelposId,salary,adminId,personCode,salary2 from Person where personId= '$xKey'")){
return 1;
}else {
return 0;
}
}
function RSPersonDept($xKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonDeptL($xKey,$yKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and personId != '$yKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLNameHire1($xKey,$yKey){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and hireId = 1 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function SearchPersonByStatusLeave($xKey){
$this->SetQuery("select * from Person where fRetire != 0 and personId = '$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function SearchPersonByStatusLeaveEdu($xKey){
$this->SetQuery("select * from Person where fRetire = 9 and personId = '$xKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonDeptH($xKey){
$this->SetQuery("select * from Person where fStatus=1 and (adminId ='2' or adminId ='3') and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonReport($xKey,$yKey){
$this->SetQuery("select * from Person where fStatus=1 and hireId='$xKey' and adlineId = '$yKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonReport2($xKey,$yKey){
$this->SetQuery("select * from Person where fStatus=1 and pId='$xKey' and adlineId = '$yKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function SearchByKeyPId($xKey){
if ($this->SetQuery("select * from Person where pId= '$xKey' and fStatus=1 and personId > 0")){
return 1;
}else {
return 0;
}
}
function SearchByKeyPId2($xKey){
if ($this->SetQuery("select * from Person where pId= '$xKey' and personId > 0 order by personId desc")){
return 1;
}else {
return 0;
}
}
function RSPersonPlan($xKey){
$this->SetQuery("select * from Person where useSalary ='$xKey' and fStatus=1 and fRetire=0 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function SearchByKeyPIdForMoney1($xKey){
//echo "select * from Person where pId= '$xKey' and ((fStatus=1 and hireId=1) or (fStatus=2 and hireId=1)) and adminId!=5 and personId > 0 ";
if ($this->SetQuery("select * from Person where pId= '$xKey' and ((fStatus=1 and hireId=1) or (fStatus=2 and hireId=1)) and adminId!=5 and personId > 0 order by fRetire")){
return 1;
}else {
return 0;
}
}
function SearchByKeyPIdForMoney2(){
if ($this->SetQuery("select * from Person where ((fStatus=1 and hireId=1) or (fStatus=2 and hireId=1)) and adminId=5 and personId > 0 ")){
return 1;
}else {
return 0;
}
}
function RSPersonCFLNameHH($xKey,$yKey,$zKey,$wKey){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc");
}
function RSPersonCFLNameHH2($xKey,$yKey,$zKey,$wKey){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and fRetire=0 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc");
}
function SearchByDeptHire($xKey,$yKey){
if ($this->SetQuery("select * from Person where deptId= '$xKey' and hireId='$yKey' and fStatus=1 and personId > 0")){
return 1;
}else {
return 0;
}
}
function SearchByDeptHirePer($xKey,$yKey,$zKey,$wKey){
if ($this->SetQuery("select * from Person where deptId= '$xKey' and hireId='$yKey'and personCode like '%$zKey%' and (fName like '%$wKey%' or lName like '%$wKey%') and fStatus=1 and personId > 0")){
return 1;
}else {
return 0;
}
}
function RSPersonEdu(){
$this->SetQuery("select * from Person where (fStatus=1 and hireId=1) and personId > 0 order by levelposId desc,stepSal desc ");
}
function RSPersonGowork(){
$this->SetQuery("select * from Person where (fStatus=1 and (fRetire=1 or fRetire=2)and hireId=1) and personId > 0 order by levelposId desc,stepSal desc ");
}
function RSPersonByHireM($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and hireId=1 and deptId='$xKey') and personId > 0 order by fStatus desc,fRetire,levelposId desc,stepSal desc");
}
function RSPersonByHireM3($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and (hireId=1 or hireId=2)and deptId='$xKey') and personId > 0 order by fStatus desc,fRetire,levelposId desc,stepSal desc");
}
function RSPersonByHireM2($xKey){
$this->SetQuery("select * from Person where (((fStatus=1 and hireId=1) or (fStatus=2 and (hireId=8 or hireId=1))) and deptId='$xKey') and personId > 0 order by fStatus desc,fRetire,levelposId desc,stepSal desc");
}
function SearchForAdmin(){
if ($this->SetQuery("select * from Person where fStatus=1 and adminId=5 and personId > 0 ")){
return 1;
}else {
return 0;
}
}
function RSrpposition(){
$this->SetQuery("SELECT Person.fName, Person.lName, Position.posId,cast( Position.posId AS unsigned ) AS newposId, Person.fStatus, Adminpos.adminposName, Person.stepSal, Person.salary, Person.stepSal2, Person.salary2, Person.hireId, Person.levelposId, Person.levelposId2
FROM ((Person INNER JOIN Position ON Person.pId = Position.pId) INNER JOIN Adminpos ON Person.adminposId = Adminpos.adminposId) INNER JOIN Levelpos ON Person.levelposId = Levelpos.levelposId
WHERE (((Person.fStatus)='1')) and Person.personId > 0 and substring(Position.posId, 1, 1) <> '0' or substring(Position.posId, 1, 1) = '0'
ORDER BY newposId");
}
function RSrppositionH($hh,$pp,$con){
if($con==1)
{
$this->SetQuery("SELECT Person.fName, Person.lName, Position.posId,cast( Position.posId AS unsigned ) AS newposId, Adminpos.adminposName, Person.stepSal, Person.salary, Person.stepSal2, Person.salary2, Person.hireId, Person.levelposId, Person.levelposId2
FROM ((Person INNER JOIN Position ON Person.pId = Position.pId) INNER JOIN Adminpos ON Person.adminposId = Adminpos.adminposId) INNER JOIN Levelpos ON Person.levelposId = Levelpos.levelposId
WHERE (((Person.fStatus)='1')) and Person.hireId = '$hh' and Person.personId > 0 and Person.partyId like '%$pp' and (substring(Position.posId, 1, 1) <> '0' or substring(Position.posId, 1, 1) = '0') ORDER BY newposId");
}
else
{
$this->SetQuery("SELECT Person.fName, Person.lName, Position.posId,cast( Position.posId AS unsigned ) AS newposId, Adminpos.adminposName, Person.stepSal, Person.salary, Person.stepSal2, Person.salary2, Person.hireId, Person.levelposId, Person.levelposId2
FROM ((Person INNER JOIN Position ON Person.pId = Position.pId) INNER JOIN Adminpos ON Person.adminposId = Adminpos.adminposId) INNER JOIN Levelpos ON Person.levelposId = Levelpos.levelposId
WHERE (((Person.fStatus)='1')) and Person.hireId = '$hh' and Person.personId > 0 and Person.partyId != '$pp' and (substring(Position.posId, 1, 1) <> '0' or substring(Position.posId, 1, 1) = '0') ORDER BY newposId");
}
}
function RSPersonForcause($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and hireId='$xKey') and personId > 0 order by deptId");
}
function RSPersonForcauseEdu($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and hireId='$xKey')and fRetire =9 and personId > 0 order by deptId");
}
function RSPersonForcauseNoEdu($xKey){
$this->SetQuery("select * from Person where (fStatus=1 and hireId='$xKey') and fRetire !=9 and personId > 0 order by deptId");
}
function RSPersonForPromote($xKey,$yKey,$zKey){
$this->SetQuery("select * from Person where fStatus=1 and adminposId like '$xKey' and levelposId like '$yKey' and stepSal like '$zKey' and personId > 0 ");
}
function RSPersonHire($xKey){
$this->SetQuery("select * from Person where fStatus=1 and hireId = '$xKey' and personId > 0 order by adminId,levelposId desc,stepSal desc");
}
function RSPersonFLName($xKey,$yKey){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
//echo "select * from Person where (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and personId > 0 and personId != '$xKey' order by personCode";
$this->SetQuery("select * from Person where (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and personId > 0 and personId != '$xKey' order by deptId,adminId,levelposId desc,stepSal desc");
}
function RSPersonLvPosH($xKey,$yKey){
if($yKey == 17)
$this->SetQuery("SELECT * FROM Person, Position WHERE Person.fStatus=1 AND Person.hireId='$xKey' AND Person.pId=Position.pId;");
else
$this->SetQuery("SELECT * FROM Person, Position WHERE Person.fStatus=1 AND Person.hireId='$xKey' AND Position.levelId='$yKey' AND Person.pId=Position.pId;");
}
function RSPersonForEsalary($deptId){
if($deptId == "")
$this->SetQuery("select * from Person where (fStatus=1 or (fStatus=2 and fRetire=8)) and personId > 0 order by hireId,adminId,levelposId desc,stepSal desc");
else
$this->SetQuery("select * from Person where (fStatus=1 or (fStatus=2 and fRetire=8)) and personId > 0 and deptId = '$deptId' order by hireId,adminId,levelposId desc,stepSal desc");
}
function RSPersonCFLNameRpPerson($xKey,$yKey,$zKey,$wKey){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and fRetire!=9 and fRetire!=1 and fRetire!=2 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLNameRpPerson2($xKey,$yKey,$wKey){
//echo "select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and fRetire=9 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc";
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and fRetire=9 and deptId='$wKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLNameRpPerson3($xKey,$yKey,$wKey){
//echo "select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and (fRetire=1 or fRetire=2) and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc";
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and (fRetire=1 or fRetire=2) and deptId='$wKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonCFLNameRpPerson4($xKey,$yKey,$zKey,$wKey){
//echo "select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and (fRetire=1 or fRetire=2) and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc";
$this->SetQuery("select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function SearchPersonCFLNameRpPerson($wKey){
//echo "select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and fRetire=9 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc";
if ($this->SetQuery("select * from Person where fStatus=1 and fRetire=9 and deptId='$wKey' and personId > 0 ")){
return 1;
}else {
return 0;
}
}
function SearchPersonCFLNameRpPerson2($wKey){
//echo "select * from Person where personCode like '%$xKey%' and (fName like '%$yKey%' or lName like '%$yKey%') and fStatus=1 and fRetire=9 and hireId='$zKey' and deptId='$wKey' and personId > 0 order by personcode,adminposId,levelposId desc,salary desc";
if ($this->SetQuery("select * from Person where fStatus=1 and (fRetire=1 or fRetire=2) and deptId='$wKey' and personId > 0 ")){
return 1;
}else {
return 0;
}
}
function UpPlanForPerson($level,$salary,$step,$plan,$personId){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->Dml("update Person set levelposId='$level', salary='$salary', stepSal='$step', useSalary ='$plan' where personId='$personId'");
}
function UpPlanForPerson2($level,$salary,$step,$plan,$personId){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->Dml("update Person set levelposId2='$level', salary2='$salary', stepSal2='$step', useSalary2 ='$plan' where personId='$personId'");
}
function RSPersonDeptNoRe129($xKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and (fRetire!=1 or fRetire!=2) and fRetire!=9 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonDeptRe9($xKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and fRetire=9 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonDeptRe12($xKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and (fRetire=1 or fRetire=2) and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonDeptNoRe129Noper($xKey,$yKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and (fRetire!=1 or fRetire!=2) and fRetire!=9 and personId > 0 and personId != '$yKey' order by adminId,levelposId desc,salary desc");
}
function RSPersonDeptNoRe129Head($xKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and (fRetire!=1 or fRetire!=2) and fRetire!=9 and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonForCheckLeave(){
$this->SetQuery("select * from Person where fStatus=1 order by hireId,adminId,levelposId desc,stepSal desc");
}
function kkJ18($ap,$dkp,$par,$hire){
$this->SetQuery("SELECT count( Person.personId ) as num
FROM (
Person
INNER JOIN Position ON Person.pId = Position.pId
)
WHERE (
(
(
Person.fStatus
) = '1'
)
)
AND Position.partyId = '$par'
AND Position.deptkpId = '$dkp'
AND Position.poskindId = '$hire'
AND Person.AdminposId = '$ap'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function kkJ18Help($ap,$dkp,$par,$hire){
$this->SetQuery("SELECT count( Person.personId ) as num
FROM (
Person
INNER JOIN Position ON Person.pId = Position.pId
)
WHERE (
(
(
Person.fStatus
) = '1'
)
)
AND (Person.enterType = '4' OR Person.enterType = '5')
AND Position.partyId != '$par'
AND Position.deptkpId = '$dkp'
AND Position.poskindId = '$hire'
AND Person.AdminposId = '$ap'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function kkJ18Help2($ap,$par,$hire){
$this->SetQuery("SELECT count( Person.personId ) as num
FROM (
Person
INNER JOIN Position ON Person.pId = Position.pId
)
WHERE (
(
(
Person.fStatus
) = '1'
)
)
AND (Person.enterType = '4' OR Person.enterType = '5')
AND Position.partyId != '$par'
AND Position.poskindId = '$hire'
AND Person.AdminposId = '$ap'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function rpkkJ18Help2($par,$hire){
$this->SetQuery("SELECT *,cast( Position.posId AS unsigned ) AS newposId FROM (
Person
INNER JOIN Position ON Person.pId = Position.pId
)
WHERE (
(
(
Person.fStatus
) = '1'
)
)
AND (Person.enterType = '4' OR Person.enterType = '5')
AND Position.partyId != '$par' AND Position.poskindId = '$hire' order by newposId");
}
function RSPersonForSheet(){
$this->SetQuery("select * from Person where (((fStatus=1 or fStatus=2)and enterType!=5 and fRetire=0) or (fRetire=1 or fRetire=2)) and hireId=1 and personId > 0 order by personCode");
}
function RSPersonByHireMoneyForGive($xKey){
$this->SetQuery("select * from Person where ((fStatus=1 and hireId=1) or (fStatus=2 and (hireId=8 or hireId=1))) and personId > 0 order by fStatus desc,fRetire,levelposId desc,stepSal desc");
}
function RSPersonDeptNoRe129Name($xKey,$yKey){
$this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and (fRetire!=1 or fRetire!=2) and fRetire!=9 and personId > 0 and (fName LIKE '%$yKey%' or lName LIKE '%$yKey%')order by adminId,levelposId desc,salary desc");
}
function RSPersonPTS($xKey){
//echo "select * from Person where fStatus=1 and adminposId='$xKey' order by deptId,adminId,levelposId desc,salary desc";
$this->SetQuery("select * from Person where fStatus=1 and adminposId='$xKey' order by deptId,adminId,levelposId desc,salary desc");
}
function SearchPstimeInOut($searchdeptDate){
echo "select a.*,b.TmPersonID as TmPersonID from Person a left join TimeInOut b on a.personId=b.TmPersonID and a.personId>0 and b.TmDate='$searchdeptDate' where b.TmPersonID is NULL order by a.personId <br>";
/* $this->SetQuery("select a.* ,b.* from Person a left join TimeInOut b on a.personId>0 and b.TmDate='$searchdeptDate' and a.personId=b.TmPersonID order by a.personId ");
SELECT t. *
FROM `TxLog` t
LEFT JOIN update_info u
*/
$this->SetQuery("select a.*,b.TmPersonID as TmPersonID from Person a left join TimeInOut b on a.personId=b.TmPersonID and a.personId>0 and b.TmDate='$searchdeptDate' where b.TmPersonID is NULL order by a.personId ");
}
function RSPersonByDeptId($xKey){
$this->SetQuery("select * from Person where deptId='$xKey' and personId > 0 and fStatus=1 order by adminId,levelposId desc,salary desc");
}
function RSPersonf1(){
//
$this->dpSet = false;
$this->SetQuery("select * from Person where fStatus = 1 order by personId desc");
}
function RSPersonhireCheckTimeInOut(){
$this->SetQuery("select * from Person where personId > 0 and (hireId=1 || hireId=2 || hireId=3) and fStatus = 1 order by personId");
}
function RSPersonHApLv($h,$ap,$lv){
if($h != 8)
{
if($h == "")
$h= "%";
if($ap == "")
$ap = "%";
if($lv == "")
$lv = "%";
$this->SetQuery("select * from Person where fStatus=1 and hireId LIKE '$h' and adminposId LIKE '$ap' and levelposId LIKE '$lv' order by adminId,levelposId desc,salary desc");
} else {
if($h == "")
$h= "%";
if($ap == "")
$ap = "%";
if($lv == "")
$lv = "%";
$this->SetQuery("select * from Person where fRetire=8 and adminposId LIKE '$ap' order by adminId,levelposId desc,salary desc");
}
}
function SearchByKeyLH($xKey,$yKey,$zKey){
if ($this->SetQuery("select * from Person INNER JOIN Education ON Person.personId = Education.personId where Person.hireId= '$xKey' and Person.majortypeId = '$zKey' and Education.levelId= '$yKey' and Education.hightest= 'Y' and Person.fStatus=1 and Person.personId > 0")){
return 1;
}else {
return 0;
}
}
function SearchByKeyLH2($xKey,$yKey){
if ($this->SetQuery("select * from Person INNER JOIN Education ON Person.personId = Education.personId where Person.hireId= '$xKey' and Education.levelId= '$yKey' and Education.hightest= 'Y' and Person.fStatus=1 and Person.personId > 0")){
return 1;
}else {
return 0;
}
}
function RSPersonhirelevel($xKey,$yKey,$zKey){
$this->SetQuery("select * from Person INNER JOIN Education ON Person.personId = Education.personId where Person.hireId= '$xKey' and Person.majortypeId = '$zKey' and Education.levelId= '$yKey' and Education.hightest= 'Y' and Person.fStatus=1 and Person.personId > 0 order by Person.adminId,Person.levelposId desc,Person.salary desc");
}
function RSPersonhirelevel2($xKey,$yKey){
$this->SetQuery("select * from Person INNER JOIN Education ON Person.personId = Education.personId where Person.hireId= '$xKey' and Education.levelId= '$yKey' and Education.hightest= 'Y' and Person.fStatus=1 and Person.personId > 0 order by Person.adminId,Person.levelposId desc,Person.salary desc");
}
function SearchHeadDept($xKey){
if ($this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and (adminId=7 || adminId=8 || adminId=9 || adminId=10 || adminId=11 || adminId=12 ||adminId=13) and personId > 0 order by adminId,levelposId desc,salary desc")){
return 1;
}else {
return 0;
}
}
function RSBetweenlevelpos($zKey,$xKey,$h,$date){
$this->SetQuery("select * from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.hireId= '$h' and Person.fStatus=1 and Person.personId > 0 and Person.levelposId >= '$zKey' and Person.levelposId <='$xKey' and PersonT.practicDate<='$date' ");
}
function RShirestatus($h,$date){
$this->SetQuery("select * from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.hireId= '$h' and Person.fStatus=1 and Person.personId > 0 and PersonT.practicDate<='$date' ");
}
function UpfStatus($personId,$f,$con){
if($con == "R") { //echo "update Person set fRetire='$f' where personId='$personId'";
$this->Dml("update Person set fRetire='$f' where personId='$personId'");}
else{ //echo "update Person set fStatus='$f' where personId='$personId'";
$this->Dml("update Person set fStatus='$f' where personId='$personId'");}
}
function RSPersonfNamelName($xKey){
if ($this->SetQuery("select * from Person where (fName like '%$xKey%' or lName like '%$xKey%') and fStatus=1 and personId > 0 order by adminId,levelposId desc,salary desc")){
return 1;
}else {
return 0;
}
}
function RSPersonPTS2($xKey,$h){
//echo "select * from Person where fStatus=1 and adminposId='$xKey' order by deptId,adminId,levelposId desc,salary desc";
$this->SetQuery("select * from Person where fStatus=1 and adminposId='$xKey' and hireId LIKE '%$h' and fRetire !=9 and fRetire !=1 and fRetire !=2 order by deptId,adminId,levelposId desc,salary desc");
}
// ---------- Start Esupport ----------
function RSPersonByFStatusIs1AndFRetireOrderHireIdAdminIdLevelposId($fRetire){
$this->SetQuery("select * from Person where fStatus=1 and fRetire not in ($fRetire) order by hireId, adminId, levelposId desc");
}
function RSPersonByDpIdAndFStatusIs1AndFRetireOrderHireIdAdminIdLevelposId($dpId, $fRetire){
$this->SetQuery("select * from Person where deptId='$dpId' and fStatus=1 and fRetire not in ($fRetire) order by hireId, adminId, levelposId desc");
}
// ---------- End Esupport ----------
function RSPersonComehelpAdminpos($con,$enterType1,$enterType2,$fStatus,$adminposId){
//echo "select * from Person where fStatus=1 and adminposId='$xKey' order by deptId,adminId,levelposId desc,salary desc";
if($con == "A")
$this->SetQuery("select * from Person where fStatus='$fStatus' and (enterType = '$enterType1' or enterType ='$enterType2') and adminposId = '$adminposId' order by adminId,levelposId desc,salary desc");
else
$this->SetQuery("select * from Person where fStatus='$fStatus' and (enterType = '$enterType1' or enterType ='$enterType2') order by adminId,levelposId desc,salary desc");
}
function SearchAdminDept($xKey,$yKey){
if ($this->SetQuery("select * from Person where fStatus=1 and deptId='$xKey' and adminId='$yKey' and personId > 0 order by adminId,levelposId desc,salary desc")){
return 1;
}else {
return 0;
}
}
function kkJ18pos($par,$hire){
$this->SetQuery("SELECT *,cast( Position.posId AS unsigned ) AS newposId
FROM (
Person
INNER JOIN Position ON Person.pId = Position.pId
)
WHERE (
(
(
Person.fStatus
) = '1'
)
)
AND Position.partyId = '$par'
AND Position.poskindId = '$hire'
order by newposId ");
}
function RSGpAdminposByHire($h){
$this->SetQuery("select * from Person where fStatus=1 and hireId='$h' and personId > 0 group by adminposId");
}
function RSPersonHireGpByAdminpos($h,$p){
$this->SetQuery("select * from Person where fStatus=1 and hireId='$h' and adminposId='$p' and personId > 0 order by adminId,levelposId desc,salary desc");
}
function RSPersonByHireandDepfStatus($xKey,$yKey){
$this->SetQuery("select * from Person where hireId='$xKey' and deptId='$yKey' and personId > 0 and fStatus = 1 order by adminId,levelposId desc,salary desc");
}
function UpSalaryPersonsp($salary,$personId){
//$this->SetQuery("select * from Person where personCode like '$xKey%' and fName like '$yKey%' and lName like '$zKey%' order by personCode");
$this->Dml("update Person set salary='$salary', salary2='$salary' where personId='$personId'");
}
function SearchByKeyLHedu($xKey,$yKey,$zKey){
if ($this->SetQuery("select * from Person INNER JOIN Education ON Person.personId = Education.personId where Person.hireId= '$xKey' and Person.majortypeId = '$zKey' and Education.levelId= '$yKey' and Education.hightest= 'Y' and Person.fStatus=1 and Person.fRetire=9 and Person.personId > 0")){
return 1;
}else {
return 0;
}
}
function CountPersonDeptHire($h,$dept,$date){
$this->SetQuery("select count(Person.personId) as num from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.hireId= '$h' and Person.deptId= '$dept' and Person.fStatus=1 and Person.personId > 0 and PersonT.practicDate<='$date'");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RSPersonDeptHire($h,$dept,$date){
if($h == "" && $dept == "")
$this->SetQuery("select * from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.fStatus=1 and Person.personId > 0 and PersonT.practicDate<='$date' order by Person.hireId, Person.adminId, Person.levelposId desc, Person.salary desc");
else if($h == "" && $dept != "")
$this->SetQuery("select * from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.deptId= '$dept' and Person.fStatus=1 and Person.personId > 0 and PersonT.practicDate<='$date' order by Person.hireId, Person.adminId, Person.levelposId desc, Person.salary desc");
else if($h != "" && $dept == "")
$this->SetQuery("select * from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.hireId = '$h' and Person.fStatus=1 and Person.personId > 0 and PersonT.practicDate<='$date' order by Person.hireId, Person.adminId, Person.levelposId desc, Person.salary desc");
else if($h != "" && $dept != "")
$this->SetQuery("select * from Person INNER JOIN PersonT ON Person.personId = PersonT.personId where Person.hireId = '$h' and Person.deptId= '$dept' and Person.fStatus=1 and Person.personId > 0 and PersonT.practicDate<='$date' order by Person.hireId, Person.adminId, Person.levelposId desc, Person.salary desc");
}
function SearchBoss(){
if ($this->SetQuery("select * from Person where fStatus=1 and adminId=5 ")){ // 5 is boss
return 1;
}else {
return 0;
}
}
function RSHead(){
if ($this->SetQuery("select * from Person where fStatus=1 and (adminId=7 || adminId=8 || adminId=9 || adminId=10 || adminId=11 || adminId=12 ||adminId=13) ")){ // 5 is boss
return 1;
}else {
return 0;
}
}
function RSGeneral(){
$this->SetQuery("select * from Person where fStatus=1 and (adminId=14 || adminId=15 || adminId=16) order by adminId,levelposId desc,salary desc");
}
//----------eoffice
function RSPersonEoffice(){
if ($this->SetQuery("select personId from Person where fStatus = 1 order by personId desc")){
return 1;
}else {
return 0;
}
}
function RSPersonworkIIncollege(){
$this->SetQuery("select *,CONVERT(Person.fName using tis620) as fn from Person where fStatus=1 and (fRetire != 1 or fRetire != 2) order by hireId,enterType,partyId,fn");
}
function RSPersonfNamelNamedeptId($xKey,$deptId){
if ($this->SetQuery("select * from Person where (fName like '%$xKey%' or lName like '%$xKey%') and fStatus=1 and personId > 0 and deptId='$deptId' order by adminId,levelposId desc,salary desc")){
return 1;
}else {
return 0;
}
}
//-----------------
} //--End class base_Person--
?>
|