'未审核', 'checking' => '审核中', 'checked' => '已审核', 'checkno' => '未通过'); public function __construct() { $this->auth = new Auth(); $this->attfile = new attFile(); $this->profile = new Profile(); $this->project = new Project(); $this->contractact = new Contractact(); $this->actmeasure = new actMeasure(); $this->measureauditact = new MeasureauditAct(); $this->numofperact = new NumofperAct(); $this->data['rootUrl'] = Doo::conf()->APP_URL; $this->data['currChannle'] = 'r'; $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid()); } public function beforeRun($resource, $action) { // $uGroups = $this->profile->getProWithUid($this->auth->getUid()); // $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action); // if (!$falg) // return Doo::acl()->defaultFailedRoute; if ($this->auth->getUid()) { $uGroups = $this->profile->getProWithUid($this->auth->getUid()); $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action); if (!$falg) return Doo::acl()->defaultFailedRoute; } else { return Doo::acl()->defaultFailedRoute; } } public function index() { $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid()); if (isset($mpidArray[0]['pid'])) { foreach ($mpidArray as $key => $value) { $this->data['proArray'][$key] = $this->project->getRowByPid($value['pid']); $this->data['proArray'][$key]['contracttotal'] = $this->actmeasure->getTotalWithPid($value['pid']); $this->data['proArray'][$key]['changTotal'] = $this->numofperact->getChangTotal($value['pid']); // $this->data['proArray'][$key]['contracttotal'] += $this->data['proArray'][$key]['changTotal']; $this->data['proArray'][$key]['currdone'] = $this->numofperact->getCurrDoneNow($value['pid']); if (($this->data['proArray'][$key]['contracttotal'] > 0) && ($this->data['proArray'][$key]['currdone'] > 0)) { $this->data['proArray'][$key]['pcurrdone'] = round(($this->data['proArray'][$key]['currdone'] / $this->data['proArray'][$key]['contracttotal']) * 100) . '%'; } else { $this->data['proArray'][$key]['pcurrdone'] = '0%'; } $this->data['proArray'][$key]['bcontracttotal'] = number_format($this->data['proArray'][$key]['contracttotal'], 2, '.', ','); $this->data['proArray'][$key]['bchangTotal'] = number_format($this->data['proArray'][$key]['changTotal'], 2, '.', ','); } } else { $this->data['proArray'] = array(); } $this->render('r-project', $this->data); } public function proOverview() { // $this->data['pros'] = $this->project->getAll(); // if (isset($_POST['pname']) && $_POST['pname']) { // $this->project->insertProject($_POST['pname']); // return Doo::conf()->APP_URL . 'project/index'; // } $this->data['pid'] = $this->params['pid']; $this->render('w-project-detail', $this->data); } public function proSection() { $this->data['allproArray'] = $this->project->getAll(); $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']); $this->data['conArray'] = $this->contractact->getRowByPid($this->params['pid']); $auditArray = $this->measureauditact->getUserPmid($this->auth->getUid()); foreach ($auditArray as $key => $value) { $pmidArray[] = $value['pmid']; } foreach ($this->data['conArray'] as $key => $value) { $html = null; $hetongTotal = $dispstopnowtotal = $dispnowtotal = $countNum = 0; $nstopnowtotal = $ncurrdone = $nnowtotal = number_format(0, 2, '.', ','); $pstopnowtotal = '0%'; $pcurrdone = '0%'; $ncurrdone = number_format(0, 2, '.', ','); $pnowtotal = '0%'; $dispcurrdone = '0%'; $numStatusArray['currstatus'] = 'uncheck'; $StidArray = $this->actmeasure->getAllbyStid($value['stid']); $currdoneInt = $this->numofperact->getCurrdoneSTID($value['stid'])['totalplus']; if (isset($StidArray)) foreach ($StidArray as $k => $v) { if (in_array($v['pmid'], $pmidArray)) { $snTotal = $this->numofperact->getStopNowTotal($v['pmid']); //根据标段ID获取最新一期(包括不通过) $currcomTotal = $this->numofperact->getCurrdoneNew($v['pmid']); //截止目前 $ncurrdone = number_format($currcomTotal['currtotal'], 2, '.', ','); $nstopnowtotal = number_format($snTotal['sntotal'], 2, '.', ','); if ($v['contracttotal'] > 0) { $nnowtotal = number_format($v['contracttotal'] - $currcomTotal['currtotal'] - $snTotal['sntotal'], 2, '.', ','); $pstopnowtotal = round(($snTotal['sntotal'] / $v['contracttotal']) * 100); $pcurrdone = round(($currcomTotal['currtotal'] / $v['contracttotal']) * 100); } $dispcurrdone = $pcurrdone . '%'; $dispstopnowtotal = $pstopnowtotal . '%'; $pnowtotal = 100 - $pcurrdone - $pstopnowtotal; $dispnowtotal = $pnowtotal . '%'; $countNum = $this->numofperact->getCountTotalnum($v['pmid']); $numStatusArray = $this->numofperact->getLastStatus($this->params['pid'], $v['pmid']); if (!isset($numStatusArray['currstatus'])) { $numStatusArray['currstatus'] = 'uncheck'; } $html .= ' ' . $v['pmname'] . ' 第 ' . $countNum . ' 期(' . $this->statusArray[$numStatusArray['currstatus']] . ') ¥' . number_format($v['contracttotal'], 2, '.', ',') . '
' . $dispstopnowtotal . '
' . $dispcurrdone . '
' . $dispnowtotal . '
'; $hetongTotal += $v['contracttotal']; } } $this->data['conArray'][$key]['htmlstr'] = $html; $this->data['conArray'][$key]['hetongTotal'] = number_format($hetongTotal, 2, '.', ','); $this->data['conArray'][$key]['phetongTotal'] = 0; $this->data['conArray'][$key]['nhetongTotal'] = 0; $this->data['conArray'][$key]['phetongTotal2'] = 0; $this->data['conArray'][$key]['ncurrdoneInt'] = 0; $this->data['conArray'][$key]['phetongTotal'] = round(($currdoneInt / $hetongTotal) * 100) . '%'; $this->data['conArray'][$key]['nhetongTotal'] = number_format($currdoneInt, 2, '.', ','); $this->data['conArray'][$key]['phetongTotal2'] = round((($hetongTotal - $currdoneInt) / $hetongTotal) * 100) . '%'; $this->data['conArray'][$key]['ncurrdoneInt'] = number_format($hetongTotal - $currdoneInt, 2, '.', ','); } $this->render('r-project-section', $this->data, TRUE); } function proSectionMeasure() { $this->data['allproArray'] = $this->project->getAll(); $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']); $this->data['pid'] = $this->params['pid']; $this->data['mpid'] = $this->params['mpid']; $this->data['mastatus'] = $this->measureauditact->getStatusByMpid($this->params['mpid'])['mastatus']; if (isset($_POST['submit'])) { if ($_POST['submit'] == 'ok') { $this->measureauditact->setStatusTrue($this->params['mpid']); return Doo::conf()->APP_URL . 'rproject/' . $this->params['pid'] . '/section/' . $this->params['mpid'] . '/measure'; } if ($_POST['submit'] == 'no') { $this->measureauditact->setStatusFalse($this->params['mpid']); return Doo::conf()->APP_URL . 'rproject/' . $this->params['pid'] . '/section/' . $this->params['mpid'] . '/measure'; } } // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']); // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename']; // if ($handle = opendir($extPathdir)) { // while (false !== ($file = readdir($handle))) { // $filename = pathinfo($file); // if ($filename['extension'] == 'json') // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file)); // } // closedir($handle); // } // $this->data['proArray'] = $proArray; $this->render('r-project-section-measure', $this->data, TRUE); } Function fNumber($number) { if ($number == '') Return "-"; $nlen = strlen($number); while ($nlen > 3) { $fNumber = "," . substr($number, $nlen - 3, 3); $number = substr($number, 0, -3); $nlen = strlen($number); } if ($nlen <= 3) { $fNumber = $number . $fNumber; } Return $fNumber; } public function welcome() { // if (!$this->auth->isLoggedIn()) // return Doo::conf()->APP_URL; if ($this->profile->getProWithUid($_SESSION['uid'])['userid']) return Doo::conf()->APP_URL . 'project/list'; if (isset($_POST['welform'])) { $profileUserArray = $_POST; $profileUserArray['userid'] = $_SESSION['uid']; $this->profile->insertProfile($profileUserArray); // 无自增字段返回0 return Doo::conf()->APP_URL . 'project/list'; } $this->render('welcome', $this->data); } public function prolist() { // if (!$this->auth->isLoggedIn()) // return Doo::conf()->APP_URL; // $proArray = new stdClass(); // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']); // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename']; // if ($handle = opendir($extPathdir)) { // while (false !== ($file = readdir($handle))) { // $filename = pathinfo($file); // if ($filename['extension'] == 'json') // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file)); // } // closedir($handle); // } // $this->data['proArray'] = null; $this->render('s-project', $this->data); } public function proDetail() { // 项目名称 $this->data['allproArray'] = $this->project->getAll(); $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']); $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']); $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']); foreach ($this->data['MeasureArray'] as $key => $value) { if ($measureArray['contracttotal'] > ($value['currdone'] > 0)) { $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100); } else { $this->data['MeasureArray'][$key]['lessTotal'] = 0; } } $this->data['pmid'] = $this->params['pmid']; $this->data['pid'] = $this->params['pid']; $this->render('r-project-section-detail', $this->data, TRUE); } } ?>