|
@@ -13,7 +13,6 @@ Doo::loadClass('sms');
|
|
|
Doo::loadClass('change');
|
|
|
Doo::loadModelAt('aconfig', 'admin');
|
|
|
Doo::loadClass('Hashids/Hashids');
|
|
|
-
|
|
|
/* * proDetail
|
|
|
* MainController
|
|
|
* Feel free to delete the methods and replace them with your own code.
|
|
@@ -38,6 +37,12 @@ class ChangeController extends DooController
|
|
|
|
|
|
public function beforeRun($resource, $action)
|
|
|
{
|
|
|
+ if(isset($_POST['sessionid'])){
|
|
|
+ session_id($_POST['sessionid']);
|
|
|
+ setcookie('PHPSESSID',$_POST['sessionid']);
|
|
|
+ session_start();
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->auth->getUid()) {
|
|
|
$uGroups = $this->profile->getProWithUid($this->auth->getUid());
|
|
|
$falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
|
|
@@ -148,6 +153,7 @@ class ChangeController extends DooController
|
|
|
|
|
|
//算法 ---> 把一个二维数组按内容转换成一个三维数组
|
|
|
$prolist = array();
|
|
|
+ $pmidlistArray = array();
|
|
|
if(!empty($sectionlist)){
|
|
|
$newlist = array();
|
|
|
$i = 0;
|
|
@@ -156,6 +162,7 @@ class ChangeController extends DooController
|
|
|
$newkey = $value['pid'];
|
|
|
$newst = $value['stid'];
|
|
|
$newpm = $value['pmid'];
|
|
|
+ array_push($pmidlistArray,$newpm);
|
|
|
if(!isset($newlist[$newkey])){
|
|
|
$newlist[$newkey]['i'] = $i;
|
|
|
$prolist[$i]['open'] = 0;
|
|
@@ -188,7 +195,7 @@ class ChangeController extends DooController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //获取需要您审批的签署表cid,pid,stid,pmid信息,并open所有需要审批的节点
|
|
|
+ //获取需要您审批的签署表cid,pid,stid,pmid信息,并默认open所有节点
|
|
|
$cListmsg = $this->change->getNeedChangeNumbyUid($this->auth->getUid()) != 0 ? $this->change->getNeedChangeAllList($this->auth->getUid()) : '';
|
|
|
$pidArray = $stidArray = $pmidArray = array();
|
|
|
if(!empty($cListmsg)){
|
|
@@ -198,50 +205,72 @@ class ChangeController extends DooController
|
|
|
array_push($pmidArray,$clv['pmid']);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $pmid = isset($this->params['pmid']) ? $this->params['pmid'] : $prolist[0]['stlist'][0]['pmlist'][0]['pmid'];
|
|
|
- $pmArray = $this->actmeasure->getRowByPmid($pmid);
|
|
|
- if(!empty($pmArray)){
|
|
|
+ $sql = '';
|
|
|
+ $pmid = isset($this->params['pmid']) ? $this->params['pmid'] : '';
|
|
|
+ $userchangepower = 1;
|
|
|
+ if(!empty($prolist)){
|
|
|
foreach($prolist as $pk => $pv){
|
|
|
- if($pmArray['pid'] == $pv['pid'] || in_array($pv['pid'], $pidArray)){
|
|
|
- $prolist[$pk]['open'] = $pmArray['pid'] == $pv['pid'] ? 1 : 2;
|
|
|
+ if(in_array($pv['pid'], $pidArray)){
|
|
|
+ $prolist[$pk]['open'] = 2;
|
|
|
foreach($prolist[$pk]['stlist'] as $sk => $sv){
|
|
|
- if($pmArray['stid'] == $sv['stid'] || in_array($sv['stid'], $stidArray)){
|
|
|
- $prolist[$pk]['stlist'][$sk]['open'] = $pmArray['stid'] == $sv['stid'] ? 1 : 2;
|
|
|
+ if(in_array($sv['stid'], $stidArray)){
|
|
|
+ $prolist[$pk]['stlist'][$sk]['open'] = 2;
|
|
|
foreach($prolist[$pk]['stlist'][$sk]['pmlist'] as $mk => $mv){
|
|
|
- if($pmArray['pmid'] == $mv['pmid'] || in_array($mv['pmid'], $pmidArray)){
|
|
|
- $prolist[$pk]['stlist'][$sk]['pmlist'][$mk]['open'] = $pmArray['pmid'] == $mv['pmid'] ? 1 : 2;
|
|
|
-// break;
|
|
|
+ if(in_array($mv['pmid'], $pmidArray)){
|
|
|
+ $prolist[$pk]['stlist'][$sk]['pmlist'][$mk]['open'] = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //存在标段则该标段加粗
|
|
|
+ if(!empty($pmid)){
|
|
|
+ $pmArray = $this->actmeasure->getRowByPmid($pmid);
|
|
|
+ foreach($prolist as $pk => $pv){
|
|
|
+ if($pmArray['pid'] == $pv['pid']){
|
|
|
+ $prolist[$pk]['open'] = 1;
|
|
|
+ foreach($prolist[$pk]['stlist'] as $sk => $sv){
|
|
|
+ if($pmArray['stid'] == $sv['stid']){
|
|
|
+ $prolist[$pk]['stlist'][$sk]['open'] = 1;
|
|
|
+ foreach($prolist[$pk]['stlist'][$sk]['pmlist'] as $mk => $mv){
|
|
|
+ if($pmArray['pmid'] == $mv['pmid']){
|
|
|
+ $prolist[$pk]['stlist'][$sk]['pmlist'][$mk]['open'] = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
-// break;
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
-// break;
|
|
|
}
|
|
|
+ $userchangepower = $this->auth->getUid() == $pmArray['uid'] ? 1 : 0;
|
|
|
+ $this->data['pmArray'] = $pmArray;
|
|
|
+ }else{
|
|
|
+ $sql .= ' and pmid in ('.implode(',',$pmidlistArray).')';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//只有原报人才可以创建变更令和上报变更令
|
|
|
- $this->data['userchangepower'] = $this->auth->getUid() == $pmArray['uid'] ? 1 : 0;
|
|
|
+ $this->data['userchangepower'] = $userchangepower;
|
|
|
|
|
|
- $changelist = $this->change->getChangeListbyPmid($pmid);
|
|
|
+ $changelist = $this->change->getChangeListbyPmid($pmid,' 1'.$sql);
|
|
|
$this->data['firstuse'] = empty($changelist) ? 1 : 0;
|
|
|
- $status = (isset($this->params['status']) && is_numeric($this->params['status']) && $this->params['status'] != 2) || ($this->params['status'] == 2 && $this->auth->getUid() == $pmArray['uid']) ? $this->params['status'] : 1;
|
|
|
+ $status = isset($this->params['status']) && is_numeric($this->params['status']) ? $this->params['status'] : 1;
|
|
|
$this->data['status'] = $status;
|
|
|
- $this->data['pmArray'] = $pmArray;
|
|
|
$this->data['prolist'] = $prolist;
|
|
|
|
|
|
$this->data['num1'] = $this->change->getNumbyMydetail($pmid,$this->auth->getUid());
|
|
|
- $this->data['num2'] = $this->change->getNumbystatus($pmid,'uncheck','back');
|
|
|
- $this->data['num3'] = $this->change->getNumbystatus($pmid,'checking');
|
|
|
- $this->data['num4'] = $this->change->getNumbystatus($pmid,'checked');
|
|
|
- $this->data['num5'] = $this->change->getNumbystatus($pmid,'checkno');
|
|
|
+ $this->data['num2'] = $this->change->getNumbystatus($pmid,'uncheck','back',$sql);
|
|
|
+ $this->data['num3'] = $this->change->getNumbystatus($pmid,'checking','',$sql);
|
|
|
+ $this->data['num4'] = $this->change->getNumbystatus($pmid,'checked','',$sql);
|
|
|
+ $this->data['num5'] = $this->change->getNumbystatus($pmid,'checkno','',$sql);
|
|
|
|
|
|
//获取列表内容
|
|
|
Doo::loadHelper('DooPager');
|
|
|
- $pagestr = '/'.$pmid.'/'.$status;
|
|
|
- $totalArchive = $status != 1 ? $this->change->getNumbystatus($pmid,$this->changeStatus[$status]) : $this->change->getNumbyMydetail($pmid,$this->auth->getUid());
|
|
|
+ $pagestr = !empty($pmid) ? '/tender/'.$pmid.'/status/'.$status : '/status/'.$status;
|
|
|
+ $totalArchive = $status != 1 ? $this->change->getNumbystatus($pmid,$this->changeStatus[$status],'',$sql) : $this->change->getNumbyMydetail($pmid,$this->auth->getUid());
|
|
|
$pager = new DooPager(Doo::conf()->APP_URL . 'change/index'.$pagestr.'/page', $totalArchive, 10, 100);
|
|
|
$pager->setCss('', 'disabled', 'active');
|
|
|
if (isset($this->params['pindex']))
|
|
@@ -249,7 +278,7 @@ class ChangeController extends DooController
|
|
|
else
|
|
|
$pager->paginate(1);
|
|
|
if ($pager->limit != ' -10,10')
|
|
|
- $list = $status != 1 ? ($status ==2 ? $this->change->getListbyStatus($pmid,$this->changeStatus[$status], $pager->limit,'back') : $this->change->getListbyStatus($pmid,$this->changeStatus[$status], $pager->limit)) : $this->change->getListbyMydetail($pmid,$this->auth->getUid(), $pager->limit);
|
|
|
+ $list = $status != 1 ? ($status ==2 ? $this->change->getListbyStatus($pmid,$this->changeStatus[$status], $pager->limit,'back',$sql) : $this->change->getListbyStatus($pmid,$this->changeStatus[$status], $pager->limit,'',$sql)) : $this->change->getListbyMydetail($pmid,$this->auth->getUid(), $pager->limit);
|
|
|
if(isset($list) && !empty($list)){
|
|
|
foreach($list as $lk => $lv){
|
|
|
if($status == 3){
|
|
@@ -257,14 +286,18 @@ class ChangeController extends DooController
|
|
|
$list[$lk]['checkman'] = $checkman['name'];
|
|
|
// $list[$lk]['checkstatus'] = $this->statusArray[$checkman['status']];
|
|
|
}
|
|
|
+ $list[$lk]['pmname'] = $this->actmeasure->getRowByPmid($lv['pmid'])['pmname'];
|
|
|
$list[$lk]['username'] = $this->auth->getRowByUid($lv['uid'])['name'];
|
|
|
$list[$lk]['changeCategory'] = $this->changeCategory[$lv['category']];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//uid
|
|
|
$this->data['uid'] = $this->auth->getUid();
|
|
|
$this->data['list'] = isset($list) ? $list : '';
|
|
|
+ $this->data['pmid'] = $pmid;
|
|
|
$this->data['pager'] = $pager->output;
|
|
|
+
|
|
|
$this->render('biangeng-poj', $this->data, TRUE);
|
|
|
}
|
|
|
|
|
@@ -301,6 +334,86 @@ class ChangeController extends DooController
|
|
|
if(empty($pmArray)){
|
|
|
exit('不存在此标段');
|
|
|
}
|
|
|
+
|
|
|
+ include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
+ $decimalnum = $this->getdecimal($changeArray['decimalnum']);
|
|
|
+
|
|
|
+ if(isset($_POST['table']) && $_POST['table'] == '_all'){
|
|
|
+ //获取所有清单列表数据,包括所有审批人
|
|
|
+ //获取用户审批变更清单的列表
|
|
|
+ $auditlist = $this->change->getChangeAuditbylastlist($cid,$changeArray['times']);
|
|
|
+
|
|
|
+ //获取清单,按清单编号排序
|
|
|
+ $clist = $this->change->getChangeAuditListbycid($cid);
|
|
|
+ $ototalnum = 0;
|
|
|
+ $ctotalnum = 0;
|
|
|
+ $stotalnum = 0;
|
|
|
+ $listtablehtml = '<table class="table table-striped table-bordered nowrap" id="tablelist" cellspacing="0" width="100%">
|
|
|
+ <thead>
|
|
|
+ <tr><th rowspan="2" class="text-center" width="100">清单编号</th><th rowspan="2" class="text-center">名称</th><th rowspan="2" class="text-center">单位</th><th rowspan="2" class="text-center">单价</th><th colspan="2" class="text-center">原设计</th><th colspan="2" class="text-center">申报变更</th>';
|
|
|
+ $thhtml = '<th class="text-center">数量</th>
|
|
|
+ <th class="text-center">金额</th>
|
|
|
+ <th class="text-center">数量</th>
|
|
|
+ <th class="text-center">金额</th>';
|
|
|
+ $utotalarr = array();
|
|
|
+ foreach ($auditlist as $ak => $av) {
|
|
|
+ $listtablehtml .= '<th colspan="2" class="text-center">'.$av['name'].' 审批</th>';
|
|
|
+ $thhtml .= '<th class="text-center">数量</th><th class="text-center">金额</th>';
|
|
|
+ $utotalarr[$ak]['uid'] = $av['uid'];
|
|
|
+ $utotalarr[$ak]['status'] = $av['status'];
|
|
|
+ $utotalarr[$ak]['usum'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ $listtablehtml .= '</tr><tr>'. $thhtml .'</tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="list">';
|
|
|
+ if (!empty($clist)) {
|
|
|
+ foreach ($clist as $ck => $cv) {
|
|
|
+ $osum = floatval($cv['unitprice']) * floatval($cv['oamount']);
|
|
|
+ $osum = $cv['lid'] != 0 ? todecimal($osum,$decimalnum['costdnum']) : $osum;
|
|
|
+ $clist[$ck]['osum'] = $osum;
|
|
|
+ $ototalnum += $osum;
|
|
|
+
|
|
|
+ $csum = todecimal(floatval($cv['unitprice']) * floatval($cv['camount']),$decimalnum['costdnum']);
|
|
|
+ $clist[$ck]['csum'] = $csum;
|
|
|
+ $ctotalnum += $csum;
|
|
|
+
|
|
|
+ $listtablehtml .= '<tr class="clist"><td>' . $cv['lnum'] . '</td><td>' . $cv['lname'] . '</td><td>' . $cv['unit'] . '</td><td>' . tofloat($cv['unitprice']) . '</td><td>' . $cv['oamount'] . '</td><td>' . $osum . '</td><td>' . $cv['camount'] . '</td><td>' . $csum . '</td>';
|
|
|
+
|
|
|
+ $userjson = json_decode($cv['auditjson'], true);
|
|
|
+ $tdhtml = '';
|
|
|
+ foreach ($userjson as $uk => $uv) {
|
|
|
+ if($uv['ucamount'] != ''){
|
|
|
+ //update utotalarr value=>usum
|
|
|
+ foreach($utotalarr as $tk => $tv){
|
|
|
+ if($tv['uid'] == $uv['uid'] && $tv['status'] == 'checked'){
|
|
|
+ $usum = todecimal(floatval($cv['unitprice'])*floatval($uv['ucamount']),$decimalnum['costdnum']);
|
|
|
+ $tdhtml .= '<td>'.$uv['ucamount'].'</td><td>'.$usum.'</td>';
|
|
|
+ $utotalarr[$tk]['usum'] = todecimal(floatval($utotalarr[$tk]['usum'])+$usum,$decimalnum['costdnum']);
|
|
|
+ break;
|
|
|
+ }elseif($tv['uid'] == $uv['uid']){
|
|
|
+ $tdhtml .= '<td></td><td></td>';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $tdhtml .= '<td></td><td></td>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $listtablehtml = $listtablehtml.$tdhtml.'</tr>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $listtablehtml .= '</tbody><tfoot><tr class="info"><td>合计</td><td></td><td></td><td></td><td></td><td>'.$ototalnum.'</td><td></td><td>'.todecimal($ctotalnum,$decimalnum['costdnum']).'</td>';
|
|
|
+ foreach($utotalarr as $tk => $tv){
|
|
|
+ $addtd = $tv['usum'] != 0 ? todecimal($tv['usum'],$decimalnum['costdnum']) : '';
|
|
|
+ $listtablehtml .= '<td></td><td>'.$addtd.'</td>';
|
|
|
+ }
|
|
|
+ $listtablehtml .= '</tr>
|
|
|
+ </tfoot>
|
|
|
+ </table>';
|
|
|
+ echo json_encode(array('code' => 200, 'html' => $listtablehtml));
|
|
|
+ die;
|
|
|
+ }
|
|
|
$this->data['pmArray'] = $pmArray;
|
|
|
$ctypelist = array();
|
|
|
if(!empty($changeArray['ctype'])){
|
|
@@ -315,7 +428,6 @@ class ChangeController extends DooController
|
|
|
$changeArray['companyname'] = $this->change->getCompanybyid($changeArray['companyid'])['name'];
|
|
|
$this->data['changeArray'] = $changeArray;
|
|
|
|
|
|
-
|
|
|
//获取清单,按清单编号排序
|
|
|
$clist = $this->change->getChangeAuditListbycid($cid);
|
|
|
$ototalnum = 0;
|
|
@@ -324,15 +436,16 @@ class ChangeController extends DooController
|
|
|
if(!empty($clist)){
|
|
|
foreach($clist as $ck => $cv){
|
|
|
$osum = floatval($cv['unitprice'])*floatval($cv['oamount']);
|
|
|
+ $osum = $cv['lid'] != 0 ? todecimal($osum,$decimalnum['costdnum']) : $osum;
|
|
|
$clist[$ck]['osum'] = $osum;
|
|
|
$ototalnum += $osum;
|
|
|
|
|
|
- $csum = floatval($cv['unitprice'])*floatval($cv['camount']);
|
|
|
+ $csum = todecimal(floatval($cv['unitprice'])*floatval($cv['camount']),$decimalnum['costdnum']);
|
|
|
$clist[$ck]['csum'] = $csum;
|
|
|
$ctotalnum += $csum;
|
|
|
|
|
|
if($cv['samount'] != ''){
|
|
|
- $ssum = floatval($cv['unitprice'])*floatval($cv['samount']);
|
|
|
+ $ssum = todecimal(floatval($cv['unitprice'])*floatval($cv['samount']),$decimalnum['costdnum']);
|
|
|
$clist[$ck]['ssum'] = $ssum;
|
|
|
$stotalnum += $ssum;
|
|
|
}else{
|
|
@@ -341,10 +454,9 @@ class ChangeController extends DooController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
- $this->data['ototalnum'] = tofloat($ototalnum);
|
|
|
- $this->data['ctotalnum'] = tofloat($ctotalnum);
|
|
|
- $this->data['stotalnum'] = $stotalnum != 0 ? tofloat($stotalnum) : '';
|
|
|
+ $this->data['ototalnum'] = $ototalnum;
|
|
|
+ $this->data['ctotalnum'] = todecimal($ctotalnum,$decimalnum['costdnum']);
|
|
|
+ $this->data['stotalnum'] = $stotalnum != 0 ? todecimal($stotalnum,$decimalnum['costdnum']) : '';
|
|
|
$this->data['clist'] = $clist;
|
|
|
|
|
|
//获取附件
|
|
@@ -385,10 +497,17 @@ class ChangeController extends DooController
|
|
|
exit('不是原报人无法创建变更令');
|
|
|
}
|
|
|
|
|
|
+ //取标段位数设置
|
|
|
+ $decimalnum = $this->getdecimal($pmArray['cdecimalnum']);
|
|
|
+ $this->data['costdnum'] = $decimalnum['costdnum'];
|
|
|
+ $this->data['numberdnum'] = $decimalnum['numberdnum'];
|
|
|
+
|
|
|
+ include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
+
|
|
|
//表单提交
|
|
|
if(isset($_POST['pnum'])){
|
|
|
if(isset($_POST['checking'])){
|
|
|
- if(empty($_POST['pnum']) || !isset($_POST['pname']) || empty($_POST['pname']) || !isset($_POST['mnum']) || empty($_POST['mnum']) || !isset($_POST['description']) || empty($_POST['description']) || !isset($_POST['changeaudit']) || empty($_POST['changeaudit']) || !isset($_POST['changelist']) || !isset($_POST['changewhitelist'])){
|
|
|
+ if(empty($_POST['pnum']) || !isset($_POST['pname']) || empty($_POST['pname']) || !isset($_POST['description']) || empty($_POST['description']) || !isset($_POST['changeaudit']) || empty($_POST['changeaudit']) || !isset($_POST['changelist']) || !isset($_POST['changewhitelist'])){
|
|
|
exit('参数缺失或为空');
|
|
|
}
|
|
|
if(empty($_POST['changelist']) && empty($_POST['changewhitelist'])){
|
|
@@ -470,9 +589,9 @@ class ChangeController extends DooController
|
|
|
$clist = explode(',',$_POST['changelist']);
|
|
|
foreach($clist as $ck => $cv){
|
|
|
$clistarr = explode('_',$cv);
|
|
|
- if(!empty($clistarr[1]) && is_numeric($clistarr[1])){
|
|
|
+ if(is_numeric($clistarr[1])){
|
|
|
$changelistArr = $this->change->getChangeListbyid($clistarr[0]);
|
|
|
- $total += floatval($changelistArr['unitprice'])*floatval($clistarr[1]);
|
|
|
+ $total += todecimal(floatval($changelistArr['unitprice'])*floatval($clistarr[1]),$decimalnum['costdnum']);
|
|
|
|
|
|
$cauditlist = new ChangeAuditList();
|
|
|
$cauditlist->pid = $pmArray['pid'];
|
|
@@ -495,8 +614,8 @@ class ChangeController extends DooController
|
|
|
$wlist = explode(',',$_POST['changewhitelist']);
|
|
|
foreach($wlist as $wk => $wv){
|
|
|
$wlistarr = explode(';',explode('->',$wv)[1]);
|
|
|
- if(!empty($wlistarr[0]) && !empty($wlistarr[1]) && !empty($wlistarr[3]) && !empty($wlistarr[4]) && !empty($wlistarr[5]) && is_numeric($wlistarr[3]) && is_numeric($wlistarr[4]) && is_numeric($wlistarr[5])){
|
|
|
- $total += floatval($wlistarr[3])*floatval($wlistarr[5]);
|
|
|
+ if(!empty($wlistarr[0]) && !empty($wlistarr[1]) && is_numeric($wlistarr[3]) && is_numeric($wlistarr[4]) && is_numeric($wlistarr[5])){
|
|
|
+ $total += todecimal(floatval($wlistarr[3])*floatval($wlistarr[5]),$decimalnum['costdnum']);
|
|
|
|
|
|
$cauditlist = new ChangeAuditList();
|
|
|
$cauditlist->pid = $pmArray['pid'];
|
|
@@ -517,22 +636,23 @@ class ChangeController extends DooController
|
|
|
}
|
|
|
|
|
|
//变更令添加变更总金额
|
|
|
- $this->change->updateChangeTotalamount($cid,$total);
|
|
|
+ $this->change->updateChangeTotalamount($cid,todecimal($total,$decimalnum['costdnum']));
|
|
|
|
|
|
$status = isset($_POST['uncheck']) ? 2 : 3;
|
|
|
- return '/change/index/'.$pmArray['pmid'].'/'.$status;
|
|
|
+ return '/change/index/tender/'.$pmArray['pmid'].'/status/'.$status;
|
|
|
}else{
|
|
|
exit('添加到变更令失败');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $this->data['companylist'] = $this->change->getCompanyList();
|
|
|
+ $this->data['companylist'] = $this->change->getCompanyList($pmid);
|
|
|
|
|
|
$list = $this->change->getChangeListbyPmid($pmid);
|
|
|
if(!empty($list)){
|
|
|
foreach($list as $k => $v){
|
|
|
$totalamount = floatval($v['unitprice'])*floatval($v['amount']);
|
|
|
$list[$k]['totalamount'] = $totalamount;
|
|
|
+ $list[$k]['index'] = $k+1;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -580,13 +700,13 @@ class ChangeController extends DooController
|
|
|
$lastnum = $this->change->getLastChangePnum($this->params['pmid']);
|
|
|
if(!empty($lastnum)){
|
|
|
//正则获取申请编号
|
|
|
- $pattern = '/(?!\d{3,6})(\D|\d)|\d{3,6}/i';
|
|
|
+ $pattern = '/(?!\d{3,6})(\D|\d)|19\d{2}|20\d{2}|\d{3,6}/i';
|
|
|
preg_match_all($pattern, $lastnum['pnum'],$str);
|
|
|
$arr = $str[0];
|
|
|
$pnum = '';
|
|
|
for($i = 0; $i < count($arr); $i++){
|
|
|
if(mb_strlen($arr[$i],'UTF8') > 1){
|
|
|
- if($arr[$i] == date('Y',time()) || $arr[$i] == date('Y',strtotime("-1 year"))){
|
|
|
+ if(preg_match('/19\d{2}|20\d{2}/i',$arr[$i])){
|
|
|
$pnum .= $arr[$i];
|
|
|
}else{
|
|
|
$pnum .= $this->makenum($arr[$i]);
|
|
@@ -599,6 +719,12 @@ class ChangeController extends DooController
|
|
|
}else{
|
|
|
$this->data['pnum'] = '变更申请编号001';
|
|
|
}
|
|
|
+
|
|
|
+ $cfuhashids = new Hashids\Hashids('cfileupload', 15);
|
|
|
+ $this->data['uid'] = $this->auth->getUid();
|
|
|
+ $verification = $cfuhashids->encode($pmArray['pmid'],$this->auth->getUid());
|
|
|
+ $this->data['verification'] = $verification;
|
|
|
+
|
|
|
$this->render('biangeng-new', $this->data, TRUE);
|
|
|
}else{
|
|
|
exit('不存在此标段');
|
|
@@ -635,6 +761,10 @@ class ChangeController extends DooController
|
|
|
exit('不存在此标段');
|
|
|
}
|
|
|
|
|
|
+ include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
+ $decimalnum = $this->getdecimal($changeArray['decimalnum']);
|
|
|
+// $step = $this->makestep($decimalnum['numberdnum']);
|
|
|
+
|
|
|
//审批结果
|
|
|
if(isset($_POST['approval']) && is_numeric($_POST['approval'])){
|
|
|
$status = $_POST['status'];
|
|
@@ -654,7 +784,7 @@ class ChangeController extends DooController
|
|
|
$lid = explode('_',$v)[0];
|
|
|
$ucamount = explode('_',$v)[1] != '' ? explode('_',$v)[1] : 0;
|
|
|
$oneauditlist = $this->change->getOneChangeAuditList($lid);
|
|
|
- $totalamount += floatval($oneauditlist['unitprice'])*floatval($ucamount);
|
|
|
+ $totalamount += todecimal(floatval($oneauditlist['unitprice'])*floatval($ucamount),$decimalnum['costdnum']);
|
|
|
$auditjson = json_decode($oneauditlist['auditjson'],true);
|
|
|
foreach($auditjson as $ak => $av){
|
|
|
if($av['uid'] == $this->auth->getUid()){
|
|
@@ -669,7 +799,7 @@ class ChangeController extends DooController
|
|
|
$cauditlist->update();
|
|
|
}
|
|
|
//更新change总金额
|
|
|
- $this->change->updateChangeTotalamount($cid,$totalamount);
|
|
|
+ $this->change->updateChangeTotalamount($cid,todecimal($totalamount,$decimalnum['costdnum']));
|
|
|
|
|
|
//更改下一个审批状态或结束审批
|
|
|
$audit = new ChangeAudit();
|
|
@@ -689,6 +819,7 @@ class ChangeController extends DooController
|
|
|
if($flag){
|
|
|
$changes = new Change();
|
|
|
$changes->cid = $cid;
|
|
|
+ $changes->bnum = isset($_POST['bnum']) ? $_POST['bnum'] : $changeArray['pnum'];
|
|
|
$changes->status = 'checked';
|
|
|
$changes->sintime = $sintime;
|
|
|
$changes->update();
|
|
@@ -735,26 +866,26 @@ class ChangeController extends DooController
|
|
|
$auditjson = json_decode($cv['auditjson'],true);
|
|
|
$samount = '';
|
|
|
if(empty($lastlastuid)){
|
|
|
- $totalamount += floatval($cv['unitprice'])*floatval($cv['camount']);
|
|
|
+ $totalamount += todecimal(floatval($cv['unitprice'])*floatval($cv['camount']),$decimalnum['costdnum']);
|
|
|
}
|
|
|
foreach($auditjson as $jk => $jv){
|
|
|
if(!empty($lastlastuid) && $jv['uid'] == $lastlastuid){
|
|
|
- $totalamount += floatval($cv['unitprice'])*floatval($jv['ucamount']);
|
|
|
+ $totalamount += todecimal(floatval($cv['unitprice'])*floatval($jv['ucamount']),$decimalnum['costdnum']);
|
|
|
$samount = $jv['ucamount'];
|
|
|
}
|
|
|
|
|
|
- if($jv['uid'] == $lastuid){
|
|
|
- $auditjson[$jk]['ucamount'] = '';
|
|
|
- }
|
|
|
+// if($jv['uid'] == $lastuid){
|
|
|
+// $auditjson[$jk]['ucamount'] = '';
|
|
|
+// }
|
|
|
}
|
|
|
$cauditlist = new ChangeAuditList();
|
|
|
$cauditlist->id = $cv['id'];
|
|
|
$cauditlist->samount = $samount;
|
|
|
- $cauditlist->auditjson = json_encode($auditjson);
|
|
|
+// $cauditlist->auditjson = json_encode($auditjson);
|
|
|
$cauditlist->update();
|
|
|
}
|
|
|
//更新change总金额
|
|
|
- $this->change->updateChangeTotalamount($cid,$totalamount);
|
|
|
+ $this->change->updateChangeTotalamount($cid,todecimal($totalamount,$decimalnum['costdnum']));
|
|
|
|
|
|
}elseif(isset($_POST['back']) && $_POST['back'] == 2){
|
|
|
//退回到提交人,重新上报
|
|
@@ -772,7 +903,7 @@ class ChangeController extends DooController
|
|
|
$clist = $this->change->getChangeAuditListbycid($cid);
|
|
|
$totalamount = 0;
|
|
|
foreach($clist as $ck => $cv){
|
|
|
- $totalamount += floatval($cv['unitprice'])*floatval($cv['camount']);
|
|
|
+ $totalamount += todecimal(floatval($cv['unitprice'])*floatval($cv['camount']),$decimalnum['costdnum']);
|
|
|
|
|
|
$cauditlist = new ChangeAuditList();
|
|
|
$cauditlist->id = $cv['id'];
|
|
@@ -785,7 +916,7 @@ class ChangeController extends DooController
|
|
|
$changes = new Change();
|
|
|
$changes->cid = $cid;
|
|
|
$changes->status = 'back';
|
|
|
- $changes->totalamount = $totalamount;
|
|
|
+ $changes->totalamount = todecimal($totalamount,$decimalnum['costdnum']);
|
|
|
$changes->update();
|
|
|
}
|
|
|
}elseif($status == 'checkno'){
|
|
@@ -863,40 +994,44 @@ class ChangeController extends DooController
|
|
|
</thead>
|
|
|
<tbody id="list">';
|
|
|
if (!empty($clist)) {
|
|
|
- include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
foreach ($clist as $ck => $cv) {
|
|
|
$osum = floatval($cv['unitprice']) * floatval($cv['oamount']);
|
|
|
+ $osum = $cv['lid'] != 0 ? todecimal($osum,$decimalnum['costdnum']) : $osum;
|
|
|
$clist[$ck]['osum'] = $osum;
|
|
|
$ototalnum += $osum;
|
|
|
|
|
|
- $csum = floatval($cv['unitprice']) * floatval($cv['camount']);
|
|
|
+ $csum = todecimal(floatval($cv['unitprice']) * floatval($cv['camount']),$decimalnum['costdnum']);
|
|
|
$clist[$ck]['csum'] = $csum;
|
|
|
$ctotalnum += $csum;
|
|
|
|
|
|
- if($cv['samount'] != ''){
|
|
|
- $ssum = floatval($cv['unitprice'])*floatval($cv['samount']);
|
|
|
- $samount = $cv['samount'];
|
|
|
- $stotalnum += $ssum;
|
|
|
- }else{
|
|
|
- $ssum = $csum;
|
|
|
- $samount = $cv['camount'];
|
|
|
- $stotalnum += $ssum;
|
|
|
- }
|
|
|
- $listtablehtml .= '<tr class="clist"><td>' . $cv['lnum'] . '</td><td>' . $cv['lname'] . '</td><td>' . $cv['unit'] . '</td><td>' . tofloat($cv['unitprice']) . '</td><td>' . $cv['oamount'] . '</td><td>' . tofloat($osum) . '</td><td>' . $cv['camount'] . '</td><td>' . tofloat($csum) . '</td>';
|
|
|
+ $listtablehtml .= '<tr class="clist"><td>' . $cv['lnum'] . '</td><td>' . $cv['lname'] . '</td><td>' . $cv['unit'] . '</td><td>' . tofloat($cv['unitprice']) . '</td><td>' . $cv['oamount'] . '</td><td>' . $osum . '</td><td>' . $cv['camount'] . '</td><td>' . $csum . '</td>';
|
|
|
|
|
|
$userjson = json_decode($cv['auditjson'], true);
|
|
|
$tdhtml = '';
|
|
|
foreach ($userjson as $uk => $uv) {
|
|
|
if ($uv['uid'] == $checkinguid) {
|
|
|
- $tdhtml .= '<td><input class="form-control input-sm" type="number" min="0" step="0.001" listid="'.$cv['id'].'" value="'.$samount.'" placeholder="请输入变更数量"></td><td class="cnum">'.tofloat($ssum).'</td>';
|
|
|
+ if($uv['ucamount'] != '') {
|
|
|
+ $ssum = todecimal(floatval($cv['unitprice'])*floatval($uv['ucamount']),$decimalnum['costdnum']);
|
|
|
+ $samount = $uv['ucamount'];
|
|
|
+ $stotalnum += $ssum;
|
|
|
+ }else if ($cv['samount'] != ''){
|
|
|
+ $ssum = todecimal(floatval($cv['unitprice'])*floatval($cv['samount']),$decimalnum['costdnum']);
|
|
|
+ $samount = $cv['samount'];
|
|
|
+ $stotalnum += $ssum;
|
|
|
+ }else{
|
|
|
+ $ssum = $csum;
|
|
|
+ $samount = $cv['camount'];
|
|
|
+ $stotalnum += $ssum;
|
|
|
+ }
|
|
|
+ $tdhtml .= '<td><input class="form-control input-sm" type="text" onkeyup="RegNum(this,event,'.$decimalnum['numberdnum'].')" listid="'.$cv['id'].'" value="'.$samount.'" placeholder="请输入变更数量"></td><td class="cnum">'.$ssum.'</td>';
|
|
|
}else{
|
|
|
if($uv['ucamount'] != ''){
|
|
|
- $usum = floatval($cv['unitprice'])*floatval($uv['ucamount']);
|
|
|
- $tdhtml .= '<td>'.$uv['ucamount'].'</td><td>'.tofloat($usum).'</td>';
|
|
|
+ $usum = todecimal(floatval($cv['unitprice'])*floatval($uv['ucamount']),$decimalnum['costdnum']);
|
|
|
+ $tdhtml .= '<td>'.$uv['ucamount'].'</td><td>'.$usum.'</td>';
|
|
|
//update utotalarr value=>usum
|
|
|
foreach($utotalarr as $tk => $tv){
|
|
|
if($tv['uid'] == $uv['uid']){
|
|
|
- $utotalarr[$tk]['usum'] = floatval($utotalarr[$tk]['usum'])+$usum;
|
|
|
+ $utotalarr[$tk]['usum'] = todecimal(floatval($utotalarr[$tk]['usum'])+$usum,$decimalnum['costdnum']);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -908,9 +1043,9 @@ class ChangeController extends DooController
|
|
|
$listtablehtml = $listtablehtml.$tdhtml.'</tr>';
|
|
|
}
|
|
|
}
|
|
|
- $listtablehtml .= '</tbody><tfoot><tr class="info"><td>合计</td><td></td><td></td><td></td><td></td><td>'.tofloat($ototalnum).'</td><td></td><td>'.tofloat($ctotalnum).'</td>';
|
|
|
+ $listtablehtml .= '</tbody><tfoot><tr class="info"><td>合计</td><td></td><td></td><td></td><td></td><td>'.$ototalnum.'</td><td></td><td>'.todecimal($ctotalnum,$decimalnum['costdnum']).'</td>';
|
|
|
foreach($utotalarr as $tk => $tv){
|
|
|
- $addtd = $tv['status'] == 'checking' ? tofloat($stotalnum) : ($tv['usum'] != 0 ? tofloat($tv['usum']) : '');
|
|
|
+ $addtd = $tv['status'] == 'checking' ? todecimal($stotalnum,$decimalnum['costdnum']) : ($tv['usum'] != 0 ? todecimal($tv['usum'],$decimalnum['costdnum']) : '');
|
|
|
$checkinghtml = $tv['status'] == 'checking' ? ' class="utotalnum"': '';
|
|
|
$listtablehtml .= '<td></td><td'. $checkinghtml .'>'.$addtd.'</td>';
|
|
|
}
|
|
@@ -946,6 +1081,15 @@ class ChangeController extends DooController
|
|
|
$auditlist2 = $this->change->getChangeAuditsbySort($cid);
|
|
|
$this->data['auditlist'] = $auditlist2;
|
|
|
|
|
|
+ //判断是否为本标段终审人
|
|
|
+ $auditArray = $this->change->getChangeAuditLastUser($cid);
|
|
|
+ $this->data['isenduser'] = $auditArray['uid'] == $this->auth->getUid() ? 1 : 0;
|
|
|
+
|
|
|
+ $cfuhashids = new Hashids\Hashids('cfileupload', 15);
|
|
|
+ $this->data['uid'] = $this->auth->getUid();
|
|
|
+ $verification = $cfuhashids->encode($pmArray['pmid'],$this->auth->getUid());
|
|
|
+ $this->data['verification'] = $verification;
|
|
|
+
|
|
|
$this->render('biangeng-approval', $this->data, TRUE);exit;
|
|
|
}
|
|
|
}
|
|
@@ -968,10 +1112,41 @@ class ChangeController extends DooController
|
|
|
exit('不是原报人无法修改或重新上报变更令');
|
|
|
}
|
|
|
|
|
|
+ include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
+ //取标段位数设置
|
|
|
+ $decimalnum = $this->getdecimal($changeArray['decimalnum']);
|
|
|
+ $this->data['costdnum'] = $decimalnum['costdnum'];
|
|
|
+ $this->data['numberdnum'] = $decimalnum['numberdnum'];
|
|
|
+
|
|
|
+ //删除变更令
|
|
|
+ if(isset($_POST['delete']) && !empty($_POST['delete']) && $changeArray['status'] == 'uncheck'){
|
|
|
+ //需要删除变更令表,清单表,变更审批人表,附件表及附件
|
|
|
+ $this->change->delChangebyCid($cid);
|
|
|
+
|
|
|
+ $this->change->delChangeAuditListbyCid($cid);
|
|
|
+
|
|
|
+ $this->change->delChangeAuditbyCid($cid);
|
|
|
+
|
|
|
+ $changeAttList = $this->change->getChangeAttListbycid($cid);
|
|
|
+ if(!empty($changeAttList)){
|
|
|
+ Doo::loadModel('changeatt');
|
|
|
+ include (DOO::conf()->SITE_PATH . 'protected/plugin/io.han.php');
|
|
|
+ $pathf = DOO::conf()->SITE_PATH;
|
|
|
+ foreach($changeAttList as $k => $v){
|
|
|
+ $this->IoHandler = new IoHandler();
|
|
|
+ $this->IoHandler->DeleteFile($pathf.$v['filepath']);
|
|
|
+
|
|
|
+ $changeAtt = new ChangeAtt();
|
|
|
+ $changeAtt->delChangeAttbyFid($v['id']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return '/change/index/tender/'.$pmArray['pmid'];
|
|
|
+ }
|
|
|
+
|
|
|
//表单提交
|
|
|
if(isset($_POST['pnum'])){
|
|
|
if(isset($_POST['status']) && $_POST['status'] == 'checking'){
|
|
|
- if(empty($_POST['pnum']) || !isset($_POST['pname']) || empty($_POST['pname']) || !isset($_POST['mnum']) || empty($_POST['mnum']) || !isset($_POST['description']) || empty($_POST['description']) || !isset($_POST['changeaudit']) || empty($_POST['changeaudit']) || !isset($_POST['changelist']) || !isset($_POST['changewhitelist'])){
|
|
|
+ if(empty($_POST['pnum']) || !isset($_POST['pname']) || empty($_POST['pname']) || !isset($_POST['description']) || empty($_POST['description']) || !isset($_POST['changeaudit']) || empty($_POST['changeaudit']) || !isset($_POST['changelist']) || !isset($_POST['changewhitelist'])){
|
|
|
exit('参数缺失或为空');
|
|
|
}
|
|
|
if(empty($_POST['changelist']) && empty($_POST['changewhitelist'])){
|
|
@@ -1048,7 +1223,7 @@ class ChangeController extends DooController
|
|
|
|
|
|
//先删除变更令所有清单列,再重新添加
|
|
|
$cauditlist2 = new ChangeAuditList();
|
|
|
- $this->change->delChangeAuditListbyCid($cid);
|
|
|
+ $cauditlist2->delChangeAuditListbyCid($cid);
|
|
|
|
|
|
|
|
|
//清单添加,不分顺序,最终展示按清单编号排序
|
|
@@ -1057,9 +1232,9 @@ class ChangeController extends DooController
|
|
|
$clist = explode(',',$_POST['changelist']);
|
|
|
foreach($clist as $ck => $cv){
|
|
|
$clistarr = explode('_',$cv);
|
|
|
- if(!empty($clistarr[1]) && is_numeric($clistarr[1])){
|
|
|
+ if(is_numeric($clistarr[1])){
|
|
|
$changelistArr = $this->change->getChangeListbyid($clistarr[0]);
|
|
|
- $total += floatval($changelistArr['unitprice'])*floatval($clistarr[1]);
|
|
|
+ $total += todecimal(floatval($changelistArr['unitprice'])*floatval($clistarr[1]),$decimalnum['costdnum']);
|
|
|
|
|
|
$cauditlist = new ChangeAuditList();
|
|
|
$cauditlist->pid = $pmArray['pid'];
|
|
@@ -1082,8 +1257,8 @@ class ChangeController extends DooController
|
|
|
$wlist = explode(',',$_POST['changewhitelist']);
|
|
|
foreach($wlist as $wk => $wv){
|
|
|
$wlistarr = explode(';',explode('->',$wv)[1]);
|
|
|
- if(!empty($wlistarr[0]) && !empty($wlistarr[1]) && !empty($wlistarr[3]) && !empty($wlistarr[4]) && !empty($wlistarr[5]) && is_numeric($wlistarr[3]) && is_numeric($wlistarr[4]) && is_numeric($wlistarr[5])){
|
|
|
- $total += floatval($wlistarr[3])*floatval($wlistarr[5]);
|
|
|
+ if(!empty($wlistarr[0]) && !empty($wlistarr[1]) && is_numeric($wlistarr[3]) && is_numeric($wlistarr[4]) && is_numeric($wlistarr[5])){
|
|
|
+ $total += todecimal(floatval($wlistarr[3])*floatval($wlistarr[5]),$decimalnum['costdnum']);
|
|
|
|
|
|
$cauditlist = new ChangeAuditList();
|
|
|
$cauditlist->pid = $pmArray['pid'];
|
|
@@ -1104,19 +1279,20 @@ class ChangeController extends DooController
|
|
|
}
|
|
|
|
|
|
//变更令添加变更总金额
|
|
|
- $this->change->updateChangeTotalamount($cid,$total);
|
|
|
+ $this->change->updateChangeTotalamount($cid,todecimal($total,$decimalnum['costdnum']));
|
|
|
|
|
|
$status = isset($_POST['status']) && $_POST['status'] == 'checking' ? 3 : 2;
|
|
|
- return '/change/index/'.$pmArray['pmid'].'/'.$status;
|
|
|
+ return '/change/index/tender/'.$pmArray['pmid'].'/status/'.$status;
|
|
|
}
|
|
|
|
|
|
- $this->data['companylist'] = $this->change->getCompanyList();
|
|
|
+ $this->data['companylist'] = $this->change->getCompanyList($pmArray['pmid']);
|
|
|
|
|
|
$list = $this->change->getChangeListbyPmid($pmArray['pmid']);
|
|
|
if(!empty($list)){
|
|
|
foreach($list as $k => $v){
|
|
|
$totalamount = floatval($v['unitprice'])*floatval($v['amount']);
|
|
|
$list[$k]['totalamount'] = $totalamount;
|
|
|
+ $list[$k]['index'] = $k+1;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1182,10 +1358,8 @@ class ChangeController extends DooController
|
|
|
$addnum = 1;
|
|
|
foreach($clist as $ck => $cv){
|
|
|
$osum = floatval($cv['unitprice'])*floatval($cv['oamount']);
|
|
|
- $clist[$ck]['osum'] = $osum;
|
|
|
- $ototalnum += $osum;
|
|
|
|
|
|
- $csum = floatval($cv['unitprice'])*floatval($cv['camount']);
|
|
|
+ $csum = todecimal(floatval($cv['unitprice'])*floatval($cv['camount']),$decimalnum['costdnum']);
|
|
|
$clist[$ck]['csum'] = $csum;
|
|
|
$ctotalnum += $csum;
|
|
|
|
|
@@ -1193,19 +1367,22 @@ class ChangeController extends DooController
|
|
|
array_push($changeidlist,$cv['lid']);
|
|
|
array_push($changelist,$cv['lid'].'_'.$cv['camount']);
|
|
|
}else{
|
|
|
+ $osum = todecimal($osum,$decimalnum['costdnum']);
|
|
|
+
|
|
|
$clist[$ck]['add'] = $addnum;
|
|
|
array_push($changewhitelist,$addnum.'->'.$cv['lnum'].';'.$cv['lname'].';'.$cv['unit'].';'.$cv['unitprice'].';'.$cv['oamount'].';'.$cv['camount']);
|
|
|
$addnum++;
|
|
|
$clist[$ck]['changeunit'] = $this->changeUnit;
|
|
|
}
|
|
|
+ $clist[$ck]['osum'] = $osum;
|
|
|
+ $ototalnum += $osum;
|
|
|
}
|
|
|
}
|
|
|
- include (DOO::conf()->SITE_PATH . 'protected/plugin/TemplateTag.php');
|
|
|
$this->data['changelist'] = implode(',',$changelist);
|
|
|
$this->data['changewhitelist'] = implode(',',$changewhitelist);
|
|
|
$this->data['changeidlist'] = implode(',',$changeidlist);
|
|
|
- $this->data['ototalnum'] = tofloat($ototalnum);
|
|
|
- $this->data['ctotalnum'] = tofloat($ctotalnum);
|
|
|
+ $this->data['ototalnum'] = $ototalnum;
|
|
|
+ $this->data['ctotalnum'] = todecimal($ctotalnum,$decimalnum['costdnum']);
|
|
|
$this->data['clist'] = $clist;
|
|
|
|
|
|
//获取已添加的附件列表
|
|
@@ -1215,6 +1392,7 @@ class ChangeController extends DooController
|
|
|
foreach ($attlist as $k => $v) {
|
|
|
//加密下载的id
|
|
|
$fid = $this->__hashids->encode($v['id']);
|
|
|
+ $showattlist[$k]['fid'] = $v['id'];
|
|
|
$showattlist[$k]['uid'] = $v['uid'];
|
|
|
$showattlist[$k]['sort'] = $k + 1;
|
|
|
$showattlist[$k]['downurl'] = '/change/file/download/' . $fid;
|
|
@@ -1233,6 +1411,20 @@ class ChangeController extends DooController
|
|
|
$this->data['userArray'] = $this->auth->getRowByUid($this->auth->getUid());
|
|
|
$this->data['list'] = $list;
|
|
|
$this->data['year'] = date('Y',time());
|
|
|
+
|
|
|
+ //输出重新上报的审批列表信息
|
|
|
+ if($changeArray['status'] == 'back'){
|
|
|
+ $auditlist2 = $this->change->getChangeAuditsbySort($cid);
|
|
|
+ $this->data['auditlist2'] = $auditlist2;
|
|
|
+ }
|
|
|
+
|
|
|
+ $cfuhashids = new Hashids\Hashids('cfileupload', 15);
|
|
|
+ $this->data['uid'] = $this->auth->getUid();
|
|
|
+ $verification = $cfuhashids->encode($pmArray['pmid'],$this->auth->getUid());
|
|
|
+ $this->data['verification'] = $verification;
|
|
|
+
|
|
|
+// $this->data['stepnumdnum'] = $this->makestep(intval($decimalnum['numberdnum']));
|
|
|
+
|
|
|
$this->render('biangeng-update', $this->data, TRUE);
|
|
|
}else{
|
|
|
return '/change/detail/' . $cid;
|
|
@@ -1261,9 +1453,13 @@ class ChangeController extends DooController
|
|
|
}
|
|
|
if(!empty($_POST['ac'])){
|
|
|
$addarr = $_POST['ac'];
|
|
|
+ $pmArray = $this->actmeasure->getRowByPmid($_POST['pmid']);
|
|
|
foreach($addarr as $ak => $av){
|
|
|
if(!empty(trim($av))){
|
|
|
$company2 = new ChangeCompany();
|
|
|
+ $company2->pid = $pmArray['pid'];
|
|
|
+ $company2->stid = $pmArray['stid'];
|
|
|
+ $company2->pmid = $pmArray['pmid'];
|
|
|
$company2->name = $av;
|
|
|
$id = $company2->insert();
|
|
|
$selecthtml .= '<option value="'.$id.'">'.$av.'</option>';
|
|
@@ -1302,6 +1498,13 @@ class ChangeController extends DooController
|
|
|
}
|
|
|
|
|
|
public function fileUpload(){
|
|
|
+// session_write_close();
|
|
|
+// if(isset($_POST['sessionid'])){
|
|
|
+// session_id($_POST['sessionid']);
|
|
|
+// setcookie('PHPSESSID',$_POST['sessionid']);
|
|
|
+// session_start();
|
|
|
+// }
|
|
|
+
|
|
|
if(!isset($this->params['pmid']) && !is_numeric($this->params['pmid'])){
|
|
|
exit(json_encode(array('success' => false, 'msg' => '参数有误')));
|
|
|
}
|
|
@@ -1412,6 +1615,61 @@ class ChangeController extends DooController
|
|
|
exit(json_encode(array('code' => 400,'msg' => '判断参数有误')));
|
|
|
}
|
|
|
|
|
|
+ //设置小数位数
|
|
|
+ public function setDecimalnum(){
|
|
|
+ $num = array(0,1,2,3,4,5,6);
|
|
|
+ if(isset($_POST['costdnum']) && isset($_POST['numberdnum']) && in_array(intval($_POST['costdnum']), $num) && in_array(intval($_POST['numberdnum']), $num)){
|
|
|
+
|
|
|
+ $dnum = intval($_POST['costdnum']).'_'.intval($_POST['numberdnum']);
|
|
|
+ //判断更改类型
|
|
|
+ if(isset($_POST['pmid']) && is_numeric($_POST['pmid'])){
|
|
|
+ $pmArray = $this->actmeasure->getRowByPmid($_POST['pmid']);
|
|
|
+ if(!empty($pmArray)){
|
|
|
+ $this->actmeasure->updateChangeDecimalNum($_POST['pmid'],$dnum);
|
|
|
+ exit(json_encode(array('code' => 200,'msg' => '更新小数位数成功')));
|
|
|
+ }else{
|
|
|
+ exit(json_encode(array('code' => 400,'msg' => '不存在此标段')));
|
|
|
+ }
|
|
|
+ }elseif(isset($_POST['cid']) && is_numeric($_POST['cid'])){
|
|
|
+ $changeArray = $this->change->getChangebyid($_POST['cid']);
|
|
|
+ if(!empty($changeArray)){
|
|
|
+ $this->change->updateChangeDecimalNum($_POST['cid'],$dnum);
|
|
|
+ exit(json_encode(array('code' => 200,'msg' => '更新小数位数成功')));
|
|
|
+ }else{
|
|
|
+ exit(json_encode(array('code' => 400,'msg' => '不存在此变更令')));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ exit(json_encode(array('code' => 400,'msg' => '参数或小数位数有误')));
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据位数生成几位小数,0位-》1,1位-》0.1 ,5位-》0.00001
|
|
|
+ function makestep($num){
|
|
|
+ if($num >= 1 && $num <= 6){
|
|
|
+ $arr = [];
|
|
|
+ for($i=0;$i< $num;$i++){
|
|
|
+ if($i != $num-1){
|
|
|
+ $arr[$i] = 0;
|
|
|
+ }else{
|
|
|
+ $arr[$i] = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return '0.'.implode('',$arr);
|
|
|
+ }else{
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取costdnum和numberdnum
|
|
|
+ function getdecimal($arr){
|
|
|
+ //取变更令位数设置
|
|
|
+ $decimalnum = explode('_',$arr);
|
|
|
+ $decimal = array();
|
|
|
+ $decimal['costdnum'] = $decimalnum[0];
|
|
|
+ $decimal['numberdnum'] = $decimalnum[1];
|
|
|
+ return $decimal;
|
|
|
+ }
|
|
|
+
|
|
|
public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0)
|
|
|
{
|
|
|
$count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
|