|
@@ -7,15 +7,19 @@ Doo::loadModel('numofper');
|
|
|
*
|
|
|
* @author zongheng
|
|
|
*/
|
|
|
-class NumofperAct {
|
|
|
+class NumofperAct
|
|
|
+{
|
|
|
|
|
|
private $__numofperact;
|
|
|
|
|
|
- function __construct() {
|
|
|
+ function __construct()
|
|
|
+ {
|
|
|
$this->__numofperact = new Numofper();
|
|
|
}
|
|
|
|
|
|
- public function insert($pid, $uid, $tenderid, $stid, $phaseno, $currcontractval, $currchangeval, $stopnowtotal, $currdone, $curralltotal, $times = 0) {
|
|
|
+ public function insert($pid, $uid, $tenderid, $stid, $phaseno, $currcontractval, $currchangeval, $stopnowtotal, $currdone, $curralltotal, $times = 0)
|
|
|
+ {
|
|
|
+ $this->__numofperact->iszero = 0;
|
|
|
$this->__numofperact->uid = $uid;
|
|
|
$this->__numofperact->pid = $pid;
|
|
|
$this->__numofperact->pmid = $tenderid;
|
|
@@ -33,7 +37,8 @@ class NumofperAct {
|
|
|
return $this->__numofperact->insert();
|
|
|
}
|
|
|
|
|
|
- public function redoRow($pid, $tenderid, $stid, $phaseno, $times) {
|
|
|
+ public function redoRow($pid, $tenderid, $stid, $phaseno, $times)
|
|
|
+ {
|
|
|
$this->__numofperact->pid = $pid;
|
|
|
$this->__numofperact->pmid = $tenderid;
|
|
|
$this->__numofperact->stid = $stid;
|
|
@@ -50,72 +55,89 @@ class NumofperAct {
|
|
|
return $this->__numofperact->insert();
|
|
|
}
|
|
|
|
|
|
- public function getRowByMpid($mpid) {
|
|
|
+ public function getRowByMpid($mpid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCountTotalnum($pmid) {
|
|
|
+ public function getCountTotalnum($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->count(array('where' => 'pmid=? and currstatus != \'checkno\' ', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCountTotalnum2($pmid) {
|
|
|
+ public function getCountTotalnum2($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'numpname', 'where' => 'pmid=?', 'param' => array($pmid), 'groupby' => 'numpname', 'desc' => 'numpname', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getMaxStatusTimes($pmid, $numpname) {
|
|
|
+ public function getMaxStatusTimes($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'currstatus', 'where' => 'pmid=? and numpname=?', 'param' => array($pmid, $numpname), 'desc' => 'times', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// for API
|
|
|
- public function getMaxTimes($pmid, $numpname) {
|
|
|
+ public function getMaxTimes($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'times,currstatus', 'where' => 'pmid=? and numpname=?', 'param' => array($pmid, $numpname), 'desc' => 'times', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCountTotalplus($pmid) {
|
|
|
+ public function getCountTotalplus($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(curralltotal) as totalplus', 'where' => 'pmid=?', 'groupby' => 'numpname', 'desc' => 'times', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStopNow($pmid) {
|
|
|
+ public function getStopNow($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(stopnowtotal) as sntotal', 'where' => 'pmid=?', 'groupby' => 'numpname', 'desc' => 'times', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStopNowTotal($pmid) {
|
|
|
+ public function getStopNowTotal($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'stopnowtotal as sntotal', 'where' => 'pmid=?', 'groupby' => 'pmid,numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStopNowSt($stid) {
|
|
|
+ public function getStopNowSt($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(stopnowtotal) as sntotal', 'where' => 'stid=?', 'param' => array($stid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStopNowT($pmid) {
|
|
|
+ public function getStopNowT($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(stopnowtotal) as sntotal', 'where' => 'pmid=?', 'param' => array($pmid), 'DESC' => 'audittime', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrDoneSt($stid) {
|
|
|
+ public function getCurrDoneSt($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currdone) as currdone', 'where' => 'stid=?', 'param' => array($stid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrDonePmid($pmid) {
|
|
|
+ public function getCurrDonePmid($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'currdone as currdone', 'where' => 'pmid=?', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrTotal($pmid) {
|
|
|
+ public function getCurrTotal($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currcontractval) as currtotal', 'where' => 'pmid=?', 'groupby' => 'numpname', 'desc' => 'times', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrAlltotal($pmid) {
|
|
|
+ public function getCurrAlltotal($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'currdone as currtotal', 'where' => 'pmid=?', 'param' => array($pmid), 'groupby' => 'pmid,numpname', 'desc' => 'numpname', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrdoneNew($pmid) {
|
|
|
+ public function getCurrdoneNew($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'currdone as currtotal', 'where' => 'pmid=?', 'param' => array($pmid), 'desc' => 'mpid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCountTotalSTID($stid) {
|
|
|
+ public function getCountTotalSTID($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(curralltotal) as totalplus', 'where' => 'stid=? and currstatus != \'checkno\'', 'param' => array($stid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCountTotalSTID2($stid) {
|
|
|
+ public function getCountTotalSTID2($stid)
|
|
|
+ {
|
|
|
$pdArray = NULL;
|
|
|
$pdArray = $this->getPMID($stid);
|
|
|
if ($pdArray)
|
|
@@ -127,73 +149,90 @@ class NumofperAct {
|
|
|
}
|
|
|
|
|
|
// 根据条件STID获取分组后的PMID
|
|
|
- public function getPMID($stid) {
|
|
|
+ public function getPMID($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('select' => 'pmid', 'where' => 'stid=? and currstatus != \'checkno\'', 'groupby' => 'pmid', 'param' => array($stid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
// 根据条件STID获取分组后的PMID
|
|
|
- public function getMaxNumORTimes($pmid) {
|
|
|
+ public function getMaxNumORTimes($pmid)
|
|
|
+ {
|
|
|
$pmidArray = $this->__numofperact->getOne(array('where' => 'pmid=?', 'param' => array($pmid), 'desc' => 'mpid', 'asArray' => TRUE));
|
|
|
return $pmidArray['curralltotal'];
|
|
|
}
|
|
|
|
|
|
- public function getNumByStid($stid) {
|
|
|
+ public function getNumByStid($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'stid=?', 'param' => array($stid), 'desc' => 'mpid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowByPmid($pmid) {
|
|
|
+ public function getRowByPmid($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'pmid=? and currstatus != \'checkno\'', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getGroupByLastOne($pmid) {
|
|
|
+ public function getGroupByLastOne($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'pmid=? and currstatus!=\'checkno\'', 'groupby' => 'numpname', 'desc' => 'numpname,times', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getGroupByLastOne2($pmid) {
|
|
|
+ public function getGroupByLastOne2($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'pmid=?', 'groupby' => 'numpname', 'desc' => 'numpname,times', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowByPmid2($pmid) {
|
|
|
+ public function getRowByPmid2($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'pmid=?', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowTender($pmid) {
|
|
|
+ public function getRowTender($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'pmid=?', 'orderby' => 'numpname', 'param' => array($pmid), 'desc' => 'mpid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowTender2($pmid) {
|
|
|
+ public function getRowTender2($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pmid=?', 'orderby' => 'numpname', 'param' => array($pmid), 'desc' => 'mpid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRowTenderCurr($pmid) {
|
|
|
+ public function getRowTenderCurr($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('where' => 'numpname=(SELECT max(numpname) FROM jl_measure_numofper where pmid=?) and pmid=?', 'orderby' => 'numpname', 'param' => array($pmid, $pmid), 'desc' => 'mpid', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getAlluserMeasureAudit($bid, $num) {
|
|
|
+ public function getAlluserMeasureAudit($bid, $num)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'mpid', 'where' => 'pmid=? and numpname=?', 'param' => array($bid, $num), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getNumOfStatus($bid, $num) {
|
|
|
+ public function getNumOfStatus($bid, $num)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pmid=? and numpname=?', 'param' => array($bid, $num), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrStatus($mpid) {
|
|
|
+ public function getCurrStatus($mpid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'mpid=?', 'param' => array($mpid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getRow($pmid, $numpname, $times = 0) {
|
|
|
+ public function getRow($pmid, $numpname, $times = 0)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function hasTheTimesRow($pmid, $numpname, $times = 0) {
|
|
|
+ public function hasTheTimesRow($pmid, $numpname, $times = 0)
|
|
|
+ {
|
|
|
return $this->__numofperact->count(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($pmid, $numpname, $times), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getMaxRowStatus($pmid, $numpname) {
|
|
|
+ public function getMaxRowStatus($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pmid=? and numpname=?', 'param' => array($pmid, $numpname), 'desc' => 'times', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getChecknoRow($pmid, $numpname) {
|
|
|
+ public function getChecknoRow($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pmid=? and numpname=?', 'desc' => 'times', 'param' => array($pmid, $numpname), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
@@ -201,56 +240,68 @@ class NumofperAct {
|
|
|
// return $this->__numofperact->getOne(array('where' => 'numpname=(SELECT max(numpname) FROM jl_measure_numofper where pid=? and pmid=? and stid=?)', 'param' => array($pid, $pmid, $stid), 'asArray' => TRUE));
|
|
|
// }
|
|
|
|
|
|
- public function getLastStatus($pid, $pmid) {
|
|
|
+ public function getLastStatus($pid, $pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pid=? and pmid=? and currstatus != \'checkno\'', 'desc' => 'numpname', 'param' => array($pid, $pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getLastStatus2($pid, $pmid) {
|
|
|
+ public function getLastStatus2($pid, $pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pid=? and pmid=?', 'groupby' => 'pmid,numpname,times', 'desc' => 'times', 'param' => array($pid, $pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getLastStatus3($pid, $pmid) {
|
|
|
+ public function getLastStatus3($pid, $pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pid=? and pmid=?', 'desc' => 'numpname', 'param' => array($pid, $pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getLastRow($pid, $pmid) {
|
|
|
+ public function getLastRow($pid, $pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pid=? and pmid=?', 'groupby' => 'numpname,times', 'desc' => 'mpid', 'param' => array($pid, $pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getChangTotal($pid) {
|
|
|
+ public function getChangTotal($pid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currchangeval) as changtotal', 'where' => 'pid=? and currstatus != \'checkno\'', 'param' => array($pid), 'asArray' => TRUE))['changtotal'];
|
|
|
}
|
|
|
|
|
|
- public function getCurrDone($pid) {
|
|
|
+ public function getCurrDone($pid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currdone) as currdone', 'where' => 'pid=?', 'param' => array($pid), 'asArray' => TRUE))['currdone'];
|
|
|
}
|
|
|
|
|
|
- public function getCurrDoneNow($pid) {
|
|
|
+ public function getCurrDoneNow($pid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currdone) as currdone', 'where' => 'pid=? and currstatus!=\'checkno\'', 'param' => array($pid), 'asArray' => TRUE))['currdone'];
|
|
|
}
|
|
|
|
|
|
- public function getCheckedCurrdone($stid) {
|
|
|
+ public function getCheckedCurrdone($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currdone) as currdone', 'where' => 'stid = ?', 'param' => array($stid), 'asArray' => TRUE))['currdone'];
|
|
|
}
|
|
|
|
|
|
- public function getMaxCurrStatus($pid, $pmid, $stid) {
|
|
|
+ public function getMaxCurrStatus($pid, $pmid, $stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'numpname = (SELECT max(numpname) FROM jl_measure_numofper where pid = ? and pmid = ? and stid = ?)', 'param' => array($pid, $pmid, $stid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
//标段下最新一期
|
|
|
- public function getLastNew($pmid) {
|
|
|
+ public function getLastNew($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'stopnowtotal, currdone', 'where' => 'pmid = ?', 'groupby' => 'pmid, numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
// return $this->__numofperact->getOne(array('select' => 'stopnowtotal, currdone', 'where' => 'pmid = ? and currstatus!=\'checkno\'', 'orderby' => 'numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
//标段下最新一期
|
|
|
- public function getLastNew2($pmid) {
|
|
|
+ public function getLastNew2($pmid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('where' => 'pmid = ?', 'groupby' => 'pmid, numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
// return $this->__numofperact->getOne(array('select' => 'stopnowtotal, currdone', 'where' => 'pmid = ? and currstatus!=\'checkno\'', 'orderby' => 'numpname', 'desc' => 'numpname', 'param' => array($pmid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
//更新数据
|
|
|
- public function updateNumofper($tenderid, $phaseno, $itemArray, $times = 0) {
|
|
|
+ public function updateNumofper($tenderid, $phaseno, $itemArray, $times = 0)
|
|
|
+ {
|
|
|
if (!is_array($itemArray)) {
|
|
|
return FALSE;
|
|
|
}
|
|
@@ -263,7 +314,8 @@ class NumofperAct {
|
|
|
}
|
|
|
|
|
|
//更新数据
|
|
|
- public function updateAuditStatus($tenderid, $phaseno, $statuno = 'checking', $times = 0) {
|
|
|
+ public function updateAuditStatus($tenderid, $phaseno, $statuno = 'checking', $times = 0)
|
|
|
+ {
|
|
|
$this->__numofperact->currstatus = $statuno;
|
|
|
$this->__numofperact->audittime = time();
|
|
|
return $this->__numofperact->update(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($tenderid, $phaseno, $times)));
|
|
@@ -272,25 +324,30 @@ class NumofperAct {
|
|
|
// public function getCurrdoneSTID($stid) {
|
|
|
// return $this->__numofperact->getOne(array('select' => 'sum(currdone) as totalplus', 'where' => 'stid=?', 'param' => array($stid), 'asArray' => TRUE));
|
|
|
// }
|
|
|
- public function getCurrdoneSTID($stid) {
|
|
|
+ public function getCurrdoneSTID($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->getOne(array('select' => 'sum(currdone) as totalplus', 'where' => 'stid=? and currstatus!=\'checkno\'', 'param' => array($stid), 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCurrDoneSMontht($stid) {
|
|
|
+ public function getCurrDoneSMontht($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('select' => 'sum(currdone) as currdone,FROM_UNIXTIME(audittime,"%Y-%m") as month', 'where' => 'stid=?'
|
|
|
- , 'param' => array($stid), 'groupby' => 'FROM_UNIXTIME(audittime,"%Y-%m")', 'asc' => 'audittime', 'asArray' => TRUE));
|
|
|
+ , 'param' => array($stid), 'groupby' => 'FROM_UNIXTIME(audittime,"%Y-%m")', 'asc' => 'audittime', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getStopNowStMonth($stid) {
|
|
|
+ public function getStopNowStMonth($stid)
|
|
|
+ {
|
|
|
return $this->__numofperact->find(array('select' => 'sum(stopnowtotal) as sntotal,FROM_UNIXTIME(audittime,"%Y-%m") as month', 'where' => 'stid=? '
|
|
|
- , 'param' => array($stid), 'groupby' => 'FROM_UNIXTIME(audittime,"%Y-%m")', 'asc' => 'audittime', 'asArray' => TRUE));
|
|
|
+ , 'param' => array($stid), 'groupby' => 'FROM_UNIXTIME(audittime,"%Y-%m")', 'asc' => 'audittime', 'asArray' => TRUE));
|
|
|
}
|
|
|
|
|
|
- public function getCountTimes($pmid, $numpname, $times) {
|
|
|
+ public function getCountTimes($pmid, $numpname, $times)
|
|
|
+ {
|
|
|
return $this->__numofperact->count(array('where' => 'pmid=? and numpname=? and times=?', 'param' => array($pmid, $numpname, $times)));
|
|
|
}
|
|
|
|
|
|
- public function getCountNumpname($pmid, $numpname) {
|
|
|
+ public function getCountNumpname($pmid, $numpname)
|
|
|
+ {
|
|
|
return $this->__numofperact->count(array('where' => 'pmid=? and numpname=?', 'param' => array($pmid, $numpname)));
|
|
|
}
|
|
|
|