'未审批', 'checking' => '审批中', 'checked' => '审批通过', 'checkno' => '审批不通过');
public function beforeRun($resource, $action)
{
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 __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->numofperact = new NumofperAct();
$this->measureauditact = new MeasureauditAct();
$this->data['rootUrl'] = Doo::conf()->APP_URL;
$this->data['currChannle'] = 'p';
$this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
$mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
if (isset($mpidArray[0]['pid'])) {
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;
}
}
/**
*
* @return type
*/
public function index()
{
if (isset($_POST['pname']) && $_POST['pname']) {
$this->project->insertProject($this->auth->getUid(), $_POST['pname']);
return Doo::conf()->APP_URL . 'project/index';
}
if (isset($_POST['target_pname']) && $_POST['target_pname'] && isset($_POST['ppid']) && $_POST['ppid']) {
$this->project->updateProName($_POST['ppid'], $_POST['target_pname']);
return Doo::conf()->APP_URL . 'project/index';
}
$this->data['pros'] = $this->project->getAll($this->auth->getUid());
if (isset($this->data['pros'][0]['pid'])) {
foreach ($this->data['pros'] as $key => $value) {
$this->data['pros'][$key]['numMeasure'] = $this->actmeasure->getMearsureCount($value['pid']);
$this->data['pros'][$key]['contracttotal'] = $this->actmeasure->getTotalWithPid($value['pid']);
$this->data['pros'][$key]['changTotal'] = $this->numofperact->getChangTotal($value['pid']);
// $this->data['pros'][$key]['contracttotal'] += $this->data['pros'][$key]['changTotal'];
$this->data['pros'][$key]['currdone'] = $this->numofperact->getCurrDoneNow($value['pid']);
if ($this->data['pros'][$key]['contracttotal']) {
$this->data['pros'][$key]['pcurrdone'] = round(($this->data['pros'][$key]['currdone'] / $this->data['pros'][$key]['contracttotal']) * 100) . '%';
} else {
$this->data['pros'][$key]['pcurrdone'] = '0%';
}
$this->data['pros'][$key]['bcontracttotal'] = number_format($this->data['pros'][$key]['contracttotal'], 2, '.', ',');
$this->data['pros'][$key]['bchangTotal'] = number_format($this->data['pros'][$key]['changTotal'], 2, '.', ',');
}
} else {
$this->data['pros'] = [];
}
$this->render('w-project', $this->data, TRUE);
}
public function proOverview()
{
$conArray = $this->contractact->getRowByPid($this->params['pid']);
$this->data['projectDate'] = '';
$this->data['conArray'][] = array();
$this->getFav();
// $this->data['measureArray'] = $this->actmeasure->getRowByPids($this->params['pid']);
// foreach ($this->data['measureArray'] as $key => $value) {
// $this->data['measureArray'][$key]['stopNow'] = $this->numofperact->getStopNow($value['pmid'])['sntotal'];
// $this->data['measureArray'][$key]['pstopnow'] = round(($this->data['measureArray'][$key]['stopNow'] / $value['contracttotal']) * 100);
// }
$this->data['pid'] = $this->params['pid'];
$this->data['conArray'] = $conArray;
$contracttotal = 0;
// 不同标段和值
// $list = $this->numofperact->getStopNowStMonth($v['stid']); //print_r($list);
// if (empty($list))
// $startMonth = date("Y-m");
// else
// $startMonth = $list[0]['month'];
// //$list=Array ( 0 => Array ( 'sntotal' => 20000 ,'month' => '2014-09' ),1 => Array ( 'sntotal' => 40000, 'month' => '2016-10' ) );
// $d = 0;
// $mDList = $mList = array();
// $toMD = date("Y-m");
// foreach ($list as $value) {
// $flag = true;
// do {
// $MD = date("Y-m", strtotime($startMonth . " " . $d . " month")); //echo $MD."/".$value['month']."
";
// array_push($mDList, "'" . $MD . "'");
// array_push($mList, $MD);
//
// if ($MD == $toMD)//if(strtotime($MD)>=strtotime($toMD))
// $flag = false;
// if ($d > 0 && ($MD == $value['month'] || $toMD == $value['month']))
// $flag = false;
// $d++;
//// if ($d==10)
//// $flag=false;
// } while ($flag);
// }
// $this->data['projectDate'] = implode(',', $mDList);
//
// $dataList = array();
// $sntotalTA = 0;
// foreach ($mList as $va) {
// $falg = true;
// foreach ($list as $value) {
// if ($va == $value['month']) {
// $sntotalTA+=$value['sntotal'];
// $PER = round($sntotalTA / $contracttotal, 3) * 100;
// array_push($dataList, $PER);
// $falg = false;
// break;
// }
// }
// if ($falg)
// array_push($dataList, 0);
// }
// $this->data['conArray'][$k]['monthStopnow'] = $dataList;
//
// $list = $this->numofperact->getCurrDoneSMontht($v['stid']);
// $dataList = array();
// $currdoneTA = 0;
// foreach ($mList as $va) {
// $falg = true;
// foreach ($list as $value) {
// if ($va == $value['month']) {
// $currdoneTA+=$value['currdone'];
// $PER = round($currdoneTA / $contracttotal, 3) * 100;
// array_push($dataList, $PER);
// $falg = false;
// break;
// }
// }
// if ($falg)
// array_push($dataList, 0);
// }
// $this->data['conArray'][$k]['monthCurrdone'] = $dataList;
//
$totalstid = 0;
$monthArray = [];
foreach ($this->data['conArray'] as $k => $v) {
$this->data['conArray'][$k]['pstopnow'] = $this->data['conArray'][$k]['pscurrdone'] = 0;
$retval = $this->actmeasure->getAllbyStidSum($v['stid']);
$contracttotal += $retval[0]['contracttotal'];
$totalstid += $this->actmeasure->getTotal($v['stid'])['total'];
$total = $this->actmeasure->getTotal($v['stid'])['total'];
if ($total) {
$this->data['conArray'][$k]['total'] = round($total, 2);
} else {
$this->data['conArray'][$k]['total'] = 0;
}
$sntotal = $this->numofperact->getCountTotalSTID2($v['stid'])['totalplus'];
if ($sntotal) {
$this->data['conArray'][$k]['stopnow'] = round($sntotal, 2);
} else {
$this->data['conArray'][$k]['stopnow'] = 0;
}
$this->data['conArray'][$k]['currdone'] = $this->numofperact->getCurrDoneSt($v['stid'])['currdone'];
if ($this->data['conArray'][$k]['total'] > 0) {
$this->data['conArray'][$k]['pstopnow'] = round(($this->data['conArray'][$k]['stopnow'] / $this->data['conArray'][$k]['total']) * 100);
$this->data['conArray'][$k]['pscurrdone'] = round(($this->data['conArray'][$k]['currdone'] / $this->data['conArray'][$k]['total']) * 100);
}
// 分组出年月 每个月份的独立相加
$month = $this->numofperact->getStopNowStMonth($v['stid']);
foreach ($month as $key => $value) {
$allmonth[] = $value;
if (!in_array($value['month'], $monthArray))
$monthArray = $value['month'];
}
// 分组出年月 每个月份的独立相加
$month1 = $this->numofperact->getCurrDoneSMontht($v['stid']);
foreach ($month1 as $key => $value) {
$allmonth1[] = $value;
}
}
// 中文表述年月
foreach ($monthArray as $kk => $vv) {
foreach ($allmonth as $keyk => $valuev) {
if ($valuev['month'] == $vv)
$total[$kk] += $valuev['sntotal'];
}
foreach ($allmonth1 as $k1 => $v1) {
if ($v1['month'] == $vv)
$total1[$kk] += $v1['currdone'];
}
$ymarray = split('-', $vv);
$cnym = '\'' . $ymarray[1] . '月' . '\'';
if ($kk == 0)
$cnym = '\'' . $ymarray[0] . '年' . $ymarray[1] . '月' . '\'';
$cnymArray[] = $cnym;
}
foreach ($total as $value2) {
$total3[] = round(($value2 / $totalstid) * 100);
}
foreach ($total1 as $value11) {
$total4[] = round(($value11 / $totalstid) * 100);
}
$this->data['projectDate'] = implode(',', $cnymArray);
$this->data['t1'] = implode(',', $total3);
$this->data['t2'] = implode(',', $total4);
$this->render('w-project-detail', $this->data, TRUE);
}
public function proSection()
{
if (isset($_POST['stid']) && isset($_POST['proname'])) {
$this->contractact->updateStName($_POST['stid'], $_POST['proname']);
return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
}
$this->getFav();
$contractArray = $this->contractact->getRowByPid($this->params['pid']); // 获取合同段
$htmlstr = NULL;
foreach ($contractArray as $k => $v) {// 获取所有合同段
$retval = $this->actmeasure->getAllbyStid($v['stid']); // 获取标段
$bdhtmlstr = NULL;
$bdhtmlstr = '
标段名 计量期数 总价 截止上期完成/本期完成/未完成