| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 | 
							- <?php
 
- Doo::loadClass('auth');
 
- Doo::loadClass('attfile');
 
- Doo::loadClass('profile');
 
- Doo::loadClass('project');
 
- Doo::loadClass('contractact');
 
- Doo::loadClass('actmeasure');
 
- Doo::loadClass('measureauditact');
 
- Doo::loadClass('numofperact');
 
- Doo::loadClass('itemmeasurenum');
 
- Doo::loadClass('itemfile');
 
- Doo::loadModelAt('aconfig', 'admin');
 
- Doo::loadClass('sms');
 
- /**
 
-  * MainController
 
-  * Feel free to delete the methods and replace them with your own code.
 
-  *
 
-  * @author darkredz
 
-  */
 
- class RProjectController extends DooController
 
- {
 
-     private $data, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '未审批', 'checking' => '审批中', 'checked' => '已审批', 'checkno' => '未通过'), $aconfig, $sms, $itemfile, $itemmeasurenum;
 
-     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->itemfile = new ItemFile();
 
-         $this->itemmeasurenum = new ItemMeasureNumpofper();
 
-         $this->aconfig = new AConfig();
 
-         $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
 
-         $this->data['rootUrl'] = Doo::conf()->APP_URL;
 
-         $this->data['currChannle'] = 'r';
 
-         $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
 
-         $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
 
-         if (isset($mpidArray[0]['pid'])) {
 
-             $this->data['numofchecking'] = 0;
 
-             foreach ($mpidArray as $key => $value) {
 
-                 // 审批操作按照时间排序多标段
 
-                 $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
 
-             }
 
-         }
 
-         if ($this->data['numofchecking'] == 0) {
 
-             $this->data['numofchecking'] = null;
 
-         }
 
-     }
 
-     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->getAuditProject2($this->auth->getUid());
 
-         if (isset($mpidArray[0]['pid'])) {
 
-             foreach ($mpidArray as $key => $value) {
 
-                 // 审批操作按照时间排序多标段
 
-                 $numOfChecking = $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
 
-                 // end
 
-                 $this->data['proArray'][$key] = $this->project->getRowByPid($value['pid']);
 
-                 $this->data['proArray'][$key]['numofchecking'] = $numOfChecking;
 
-                 $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()
 
-     {
 
-         $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
 
-         foreach ($mpidArray as $k1 => $v1) {
 
-             if ($v1['pid'] != $this->params['pid'])
 
-                 $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
 
-         }
 
-         $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->getLastNew2($v['pmid'])['numpname'];
 
-                         if (!isset($countNum)) {
 
-                             $countNum = 0;
 
-                         }
 
-                         $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $v['pmid']);
 
-                         if (!isset($numStatusArray['currstatus'])) {
 
-                             $numStatusArray['currstatus'] = 'uncheck';
 
-                         }
 
-                         $datatmp = $this->measureauditact->getMyAuditStatus2($numStatusArray['pmid'], $numStatusArray['numpname'], $numStatusArray['times'], $this->auth->getUid());
 
-                         if ($datatmp && ($datatmp['mastatus'] == 'checking')) {
 
-                             $buttonhtml = '<a class="btn btn-warning btn-small" href="/rproject/' . $this->params['pid'] . '/section/' . $v['pmid'] . '/report/' . $numStatusArray['mpid'] . '">开始审批</a>';
 
-                         } else {
 
-                             $buttonhtml = '(<span class="colOrange">' . $this->statusArray[$numStatusArray['currstatus']] . '</span>)';
 
-                         }
 
-                         $html .= '<tr>
 
-                                     <td><a href="/rproject/' . $this->params['pid'] . '/section/' . $v['pmid'] . '/detail">' . $v['pmname'] . '</a></td>
 
-                                     <td class="">第 ' . $countNum . ' 期 ' . $buttonhtml . '</td>
 
-                                     <td class="taR">¥' . number_format($v['contracttotal'], 2, '.', ',') . '</td>
 
-                                     <td>
 
-                                         <div class="progress">
 
-                                         <div class="bar bar-success" style="width: ' . $dispstopnowtotal . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="截止上期完成:¥' . $nstopnowtotal . '">' . $dispstopnowtotal . '</div>
 
-                                         <div class="bar" style="width:' . $dispcurrdone . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="本期完成:¥' . $ncurrdone . '">' . $dispcurrdone . '</div>
 
-                                         <div class="bar bar-gary" style="width:' . $dispnowtotal . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $nnowtotal . '">' . $dispnowtotal . '</div>
 
-                                         </div>
 
-                                     </td>
 
-                                     </tr>';
 
-                         $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()
 
-     {
 
-         $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid());
 
-         foreach ($mpidArray as $k1 => $v1) {
 
-             if ($v1['pid'] != $this->params['pid'])
 
-                 $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
 
-         }
 
-         $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 proSectionFiles()
 
-     {
 
-         $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid());
 
-         foreach ($mpidArray as $k1 => $v1) {
 
-             if ($v1['pid'] != $this->params['pid'])
 
-                 $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
 
-         }
 
-         $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
 
-         $this->data['itematta'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid']);
 
-         foreach ($this->data['itematta'] as $k => $v) {
 
-             $fileArray = $this->itemfile->getItemFile($v['iaid']);
 
-             $this->data['itematta'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
 
-             $this->data['itematta'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
 
-             $this->data['itematta'][$k]['filename'] = $fileArray['filename'];
 
-             $this->data['itematta'][$k]['fileext'] = $fileArray['fileext'];
 
-             $this->data['itematta'][$k]['iaid'] = $fileArray['iaid'];
 
-             $this->data['itematta'][$k]['tips'] = $v['tips'];
 
-         }
 
-         $this->data['pid'] = $this->params['pid'];
 
-         $this->data['pmid'] = $this->params['pmid'];
 
-         $this->data['mpid'] = $this->params['mpid'];
 
-         $this->render('r-project-section-files', $this->data, TRUE);
 
-     }
 
-     /**
 
-      * @return actMeasure
 
-      */
 
-     public function proSectionGetFiles()
 
-     {
 
-         $attaArray = $this->itemfile->getItemFile($this->params['iaid']);
 
-         $this->file_down($attaArray['filepath'], $attaArray['filesize'], $attaArray['filename']);
 
-         return;
 
-     }
 
-     /**
 
-      * 文件下载
 
-      * @param $filepath 文件路径
 
-      * @param $filename 文件名称
 
-      */
 
-     function file_down($filepath, $filesize, $filename = '')
 
-     {
 
-         if (!$filename)
 
-             $filename = basename($filepath);
 
-         if ($this->is_ie())
 
-             $filename = rawurlencode($filename);
 
-         $filetype = $this->fileext($filename);
 
- //        $filesize = sprintf("%u", filesize($filepath));
 
-         if (ob_get_length() !== false)
 
-             @ob_end_clean();
 
-         header('Pragma: public');
 
-         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
 
-         header('Cache-Control: no-store, no-cache, must-revalidate');
 
-         header('Cache-Control: pre-check=0, post-check=0, max-age=0');
 
-         header('Content-Transfer-Encoding: binary');
 
-         header('Content-Encoding: none');
 
-         header('Content-type: ' . $filetype);
 
-         header('Content-Disposition: attachment; filename="' . $filename . '"');
 
-         header('Content-length: ' . $filesize);
 
-         @readfile($filepath);
 
-         exit;
 
-     }
 
-     /**
 
-      * IE浏览器判断
 
-      */
 
-     function is_ie()
 
-     {
 
-         $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
 
-         if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false))
 
-             return false;
 
-         if (strpos($useragent, 'msie ') !== false)
 
-             return true;
 
-         return false;
 
-     }
 
-     /**
 
-      * 取得文件扩展
 
-      *
 
-      * @param $filename 文件名
 
-      * @return 扩展名
 
-      */
 
-     function fileext($filename)
 
-     {
 
-         return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
 
-     }
 
-     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()
 
-     {
 
-         $numStatusArray = $this->numofperact->getLastRow($this->params['pid'], $this->params['pmid']);
 
-         // 项目名称
 
-         $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
 
-         foreach ($mpidArray as $k1 => $v1) {
 
-             if ($v1['pid'] != $this->params['pid'])
 
-                 $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
 
-         }
 
-         $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->data['mpid'] = $numStatusArray['mpid'];
 
-         $this->render('r-project-section-detail', $this->data, TRUE);
 
-     }
 
-     public function proReport()
 
-     {
 
-         // 面包屑导航
 
-         // 期数列表
 
-         $tmpArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
 
-         foreach ($tmpArray as $k => $v) {
 
-             $intTime = $this->numofperact->getMaxTimes($v['pmid'], $v['numpname'])['times'];
 
-             $nfArray[] = $this->numofperact->getRow($v['pmid'], $v['numpname'], $intTime);
 
-         }
 
-         foreach ($nfArray as $k => $v) {
 
-             if ($v['mpid'] == $this->params['mpid']) {
 
-                 $this->data['mpid'] = $v['mpid'];
 
-                 $this->data['MeasureArray2'][] = $v;
 
-                 $this->data['currnum'] = $v['numpname'];
 
-             } else {
 
-                 $this->data['numArray'][] = $v;
 
-             }
 
-         }
 
-         $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
 
-         foreach ($this->data['MeasureArray2'] as $key => $value) {
 
-             if ($value['mpid'] == $this->params['mpid']) {
 
-                 $this->data['MeasureArray2'][$key]['currstatus'] = $this->statusArray[$value['currstatus']];
 
-                 if ($measureArray['contracttotal'] > ($value['currdone'] > 0)) {
 
-                     $this->data['MeasureArray2'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
 
-                 } else {
 
-                     $this->data['MeasureArray2'][$key]['lessTotal'] = 0;
 
-                 }
 
-             }
 
-         }
 
-         //
 
-         $lastRowArray = $this->numofperact->getLastNew2($this->params['pmid']);
 
-         $maxTimes = $this->numofperact->getMaxTimes($lastRowArray['pmid'], $lastRowArray['numpname']);
 
- //        $auditUserArray = $this->measureauditact->getAllAudit($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
 
-         $maxtimez = $this->measureauditact->getRowGroupByTimes($this->params['mpid']);
 
-         $auditUserArray = $this->measureauditact->getRowByMpidTimes($this->params['mpid'], $maxtimez['times']);
 
-         $auditArray = $this->measureauditact->getLastNewRowInfo($lastRowArray['pmid'], $lastRowArray['numpname'], $this->auth->getUid());
 
-         if (isset($_POST['act'])) {
 
-             $auditStatusArray = array('checkno', 'checked');
 
-             $myAuditStatus = $this->measureauditact->getMyAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times'], $this->auth->getUid());
 
-             if (in_array($myAuditStatus['mastatus'], $auditStatusArray)) {
 
-                 echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
 
-                 die();
 
-             }
 
-         }
 
-         if ($_POST['act'] == 'p') {
 
-             if ($this->measureauditact->setMyAuditPass($auditArray['maid'], $_POST['content'], 1, $this->auth->getUid())) {
 
-                 $countAudit = count($auditUserArray);
 
-                 $this->attfile->updateHash($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
 
-                 if ($auditArray['last'] == 1) {
 
-                     $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checked', $maxTimes['times']);
 
-                     echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
 
-                     die();
 
-                 } else {
 
-                     if (($countAudit == 2) && ($auditUserArray[1]['last'] == 1) && ($auditUserArray[0]['maid'] == $auditArray['maid'])) {
 
-                         $this->measureauditact->updateMastatus($auditUserArray[1]['maid']);
 
-                         $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
 
-                         echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
 
-                         die();
 
-                     }
 
-                     if (($countAudit > 2)) {
 
-                         foreach ($auditUserArray as $k => $v) {
 
-                             if ($v['maid'] == $auditArray['maid']) {
 
-                                 if ($k == ($countAudit - 1)) {//如果是最后一个
 
-                                     $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
 
-                                     // SMS Start
 
-                                     $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
 
-                                     // var_dump($verifyUserArray);
 
-                                     $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[0]['pmid']);
 
-                                     // var_dump($pmnameArray);
 
-                                     // SMS End
 
-                                 } else {
 
-                                     $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);
 
-                                     // SMS Start
 
-                                     $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
 
-                                     // var_dump($verifyUserArray);
 
-                                     $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k + 1]['pmid']);
 
-                                     // var_dump($pmnameArray);
 
-                                     // SMS End
 
-                                 }
 
-                                 // SMS Start
 
-                                 if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
 
-                                     $retval = $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
 
- //                                        var_dump($pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
 
- //                                        var_dump($retval);
 
- //                                        var_dump($this->sms->getErrors());
 
-                                 }
 
-                                 // SMS End
 
-                                 $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
 
-                                 echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
 
-                                 die();
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         if ($_POST['act'] == 'np') {
 
-             $this->measureauditact->setCheckno($auditArray['maid'], $_POST['content'], 1);
 
-             $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checkno', $maxTimes['times']);
 
-             $this->attfile->updateHash($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
 
-             echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
 
-             die();
 
-         }
 
-         $this->data['pmid'] = $lastRowArray['pmid'];
 
-         $this->data['numpname'] = $lastRowArray['numpname'];
 
-         $this->data['times'] = $lastRowArray['times'];
 
-         $this->data['pid'] = $this->params['pid'];
 
-         foreach ($auditUserArray as $key => $value) {
 
-             $strAvatar = $this->auth->getAvatar($value['auditoruid']);
 
-             $i = $key + 1;
 
-             if ($value['auditoruid'] == $this->auth->getUid()) {
 
-                 $this->data['mastatus'] = $value['mastatus'];
 
-                 $this->data['maid'] = $value['maid'];
 
-             }
 
-             if ($value['mastatus'] == 'uncheck') {
 
-                 $statuStr = '';
 
-                 $statucolorStr = '';
 
-                 $statushtml = '<li title="" class=""><img src="' . $strAvatar . '"></li>';
 
-             }
 
-             if ($value['mastatus'] == 'checking') {
 
-                 $statuStr = '<h4 class="colOrange">审批中</h4>';
 
-                 $statucolorStr = 'colOrange';
 
-                 $statushtml = '<li title="审批中" class="wait"><span data-icon="k" aria-hidden="true"></span> <img src="' . $strAvatar . '"></li>';
 
-             }
 
-             if ($value['mastatus'] == 'checked') {
 
-                 $statuStr = '<h4 class="colGreen">审批完成(' . date('Y-m-d', $value['audittime']) . ')</h4>';
 
-                 $statucolorStr = 'colGreen';
 
-                 $statushtml = '<li title="审批通过" class="pass"><span data-icon="d" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
 
-             }
 
-             if ($value['mastatus'] == 'checkno') {
 
-                 $statuStr = '<h4 class="colRed">审批不通过(' . date('Y-m-d', $value['audittime']) . ')</h4>';
 
-                 $statucolorStr = 'colRed';
 
-                 $statushtml = '<li title="审批不通过" class="notpass"><span data-icon="e" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
 
-             }
 
-             $auditUserArray[$key]['statuStr'] = $statuStr;
 
-             $auditUserArray[$key]['statucolorStr'] = $statucolorStr;
 
-             $auditUserArray[$key]['statushtml'] = $statushtml;
 
-             $auditUserArray[$key]['k'] = $i;
 
-             $auditUserArray[$key]['name'] = $this->profile->getProWithUid($value['auditoruid'])['name'];
 
-         }
 
-         $this->data['auditArray'] = $auditUserArray;
 
-         $this->data['pmid'] = $this->params['pmid'];
 
-         $this->data['pid'] = $this->params['pid'];
 
-         $this->data['mpid'] = $this->params['mpid'];
 
-         $this->render('r-project-section-report', $this->data, TRUE);
 
-     }
 
-     /**
 
-      *   。
 
-      *   标段ID,期号
 
-      */
 
-     private function __auditNotice($mobile, $text)
 
-     {
 
-         $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
 
-         if ($smsSwitch > 0)
 
-             return $this->sms->sendSms($mobile, $text);
 
-     }
 
- }
 
- ?>
 
 
  |