ProjectController.php 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. <?php
  2. Doo::loadClass('auth');
  3. Doo::loadClass('attfile');
  4. Doo::loadClass('profile');
  5. Doo::loadClass('project');
  6. Doo::loadClass('contractact');
  7. Doo::loadClass('actmeasure');
  8. Doo::loadClass('numofperact');
  9. Doo::loadClass('measureauditact');
  10. Doo::loadClass('itemmeasurenum');
  11. Doo::loadClass('itemfile');
  12. Doo::loadClass('attachment');
  13. Doo::loadHelper('DooPager');
  14. Doo::loadClass('sign');
  15. Doo::loadModelAt('aconfig', 'admin');
  16. /* * proDetail
  17. * MainController
  18. * Feel free to delete the methods and replace them with your own code.
  19. *
  20. * @author darkredz
  21. */
  22. class ProjectController extends DooController
  23. {
  24. private $data, $sign, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>'), $aconfig, $itemmeasurenum, $itemfle, $att;
  25. public function beforeRun($resource, $action)
  26. {
  27. if ($this->auth->getUid()) {
  28. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  29. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  30. if (!$falg)
  31. return Doo::acl()->defaultFailedRoute;
  32. } else {
  33. return Doo::acl()->defaultFailedRoute;
  34. }
  35. }
  36. public function __construct()
  37. {
  38. $this->auth = new Auth();
  39. $this->attfile = new attFile();
  40. $this->profile = new Profile();
  41. $this->project = new Project();
  42. $this->contractact = new Contractact();
  43. $this->actmeasure = new actMeasure();
  44. $this->numofperact = new NumofperAct();
  45. $this->measureauditact = new MeasureauditAct();
  46. $this->itemmeasurenum = new ItemMeasureNumpofper();
  47. $this->aconfig = new AConfig();
  48. $this->itemfle = new ItemFile();
  49. $this->att = new attachment();
  50. $this->sign = new Signn();
  51. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  52. $this->data['currChannle'] = 'p';
  53. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  54. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  55. if (isset($mpidArray[0]['pid'])) {
  56. $this->data['numofchecking'] = 0;
  57. foreach ($mpidArray as $key => $value) {
  58. // 审批操作按照时间排序多标段
  59. $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  60. }
  61. }
  62. if (!isset($this->data['numofchecking']) || $this->data['numofchecking'] == 0) {
  63. $this->data['numofchecking'] = null;
  64. }
  65. $this->data['signSwitch'] = $this->aconfig->getOne(array('select' => 'signswitch', 'asArray' => TRUE))['signswitch'];
  66. //获取需要您签署的数目
  67. if($this->data['signSwitch'] > 0)
  68. $this->data['needSignNum'] = $this->sign->getNeedSignNumbyUid($this->auth->getUid()) != 0 ? $this->sign->getNeedSignNumbyUid($this->auth->getUid()) : '';
  69. //获取桌面版本
  70. $this->getsoftware();
  71. //草图入口
  72. $this->data['imediateSwitch'] = $this->aconfig->getOne(array('select' => 'imediateswitch', 'asArray' => TRUE))['imediateswitch'];
  73. }
  74. function getsoftware(){
  75. $StrJson = ($this->aconfig->getOne(array('select' => 'upgradeinfo', 'asArray' => TRUE))['upgradeinfo']);
  76. $upgradeinfo = json_decode($StrJson, true);
  77. if ($upgradeinfo) {
  78. $this->data['version'] = $upgradeinfo['version'];
  79. $this->data['download'] = $upgradeinfo['download'];
  80. }
  81. }
  82. /**
  83. *
  84. * @return type
  85. */
  86. public function index()
  87. {
  88. if (isset($_POST['pname']) && $_POST['pname']) {
  89. $this->project->insertProject($this->auth->getUid(), $_POST['pname']);
  90. return Doo::conf()->APP_URL . 'project/index';
  91. }
  92. if (isset($_POST['target_pname']) && $_POST['target_pname'] && isset($_POST['ppid']) && $_POST['ppid']) {
  93. $this->project->updateProName($_POST['ppid'], $_POST['target_pname']);
  94. return Doo::conf()->APP_URL . 'project/index';
  95. }
  96. $this->data['pros'] = $this->project->getAll($this->auth->getUid());
  97. if (isset($this->data['pros'][0]['pid'])) {
  98. foreach ($this->data['pros'] as $key => $value) {
  99. $this->data['pros'][$key]['index'] = $key%8+1;
  100. $this->data['pros'][$key]['numMeasure'] = $this->actmeasure->getMearsureCount($value['pid']);
  101. $this->data['pros'][$key]['contracttotal'] = $this->actmeasure->getTotalWithPid($value['pid']);
  102. $this->data['pros'][$key]['changTotal'] = $this->numofperact->getChangTotal($value['pid']);
  103. // $this->data['pros'][$key]['contracttotal'] += $this->data['pros'][$key]['changTotal'];
  104. $this->data['pros'][$key]['currdone'] = $this->numofperact->getCurrDoneNow($value['pid']);
  105. if ($this->data['pros'][$key]['contracttotal']) {
  106. $this->data['pros'][$key]['pcurrdone'] = round(($this->data['pros'][$key]['currdone'] / $this->data['pros'][$key]['contracttotal']) * 100) . '%';
  107. } else {
  108. $this->data['pros'][$key]['pcurrdone'] = '0%';
  109. }
  110. $this->data['pros'][$key]['bcontracttotal'] = number_format($this->data['pros'][$key]['contracttotal'], 2, '.', ',');
  111. $this->data['pros'][$key]['bchangTotal'] = number_format($this->data['pros'][$key]['changTotal'], 2, '.', ',');
  112. }
  113. } else {
  114. $this->data['pros'] = [];
  115. }
  116. $this->render('w-project', $this->data, TRUE);
  117. }
  118. public function proOverview()
  119. {
  120. $conArray = $this->contractact->getRowByPid($this->params['pid']);
  121. $this->data['projectDate'] = '';
  122. $this->data['conArray'][] = array();
  123. $this->getFav();
  124. // $this->data['measureArray'] = $this->actmeasure->getRowByPids($this->params['pid']);
  125. // foreach ($this->data['measureArray'] as $key => $value) {
  126. // $this->data['measureArray'][$key]['stopNow'] = $this->numofperact->getStopNow($value['pmid'])['sntotal'];
  127. // $this->data['measureArray'][$key]['pstopnow'] = round(($this->data['measureArray'][$key]['stopNow'] / $value['contracttotal']) * 100);
  128. // }
  129. $this->data['pid'] = $this->params['pid'];
  130. $this->data['conArray'] = $conArray;
  131. $contracttotal = 0;
  132. // 不同标段和值
  133. // $list = $this->numofperact->getStopNowStMonth($v['stid']); //print_r($list);
  134. // if (empty($list))
  135. // $startMonth = date("Y-m");
  136. // else
  137. // $startMonth = $list[0]['month'];
  138. // //$list=Array ( 0 => Array ( 'sntotal' => 20000 ,'month' => '2014-09' ),1 => Array ( 'sntotal' => 40000, 'month' => '2016-10' ) );
  139. // $d = 0;
  140. // $mDList = $mList = array();
  141. // $toMD = date("Y-m");
  142. // foreach ($list as $value) {
  143. // $flag = true;
  144. // do {
  145. // $MD = date("Y-m", strtotime($startMonth . " " . $d . " month")); //echo $MD."/".$value['month']."<br/>";
  146. // array_push($mDList, "'" . $MD . "'");
  147. // array_push($mList, $MD);
  148. //
  149. // if ($MD == $toMD)//if(strtotime($MD)>=strtotime($toMD))
  150. // $flag = false;
  151. // if ($d > 0 && ($MD == $value['month'] || $toMD == $value['month']))
  152. // $flag = false;
  153. // $d++;
  154. //// if ($d==10)
  155. //// $flag=false;
  156. // } while ($flag);
  157. // }
  158. // $this->data['projectDate'] = implode(',', $mDList);
  159. //
  160. // $dataList = array();
  161. // $sntotalTA = 0;
  162. // foreach ($mList as $va) {
  163. // $falg = true;
  164. // foreach ($list as $value) {
  165. // if ($va == $value['month']) {
  166. // $sntotalTA+=$value['sntotal'];
  167. // $PER = round($sntotalTA / $contracttotal, 3) * 100;
  168. // array_push($dataList, $PER);
  169. // $falg = false;
  170. // break;
  171. // }
  172. // }
  173. // if ($falg)
  174. // array_push($dataList, 0);
  175. // }
  176. // $this->data['conArray'][$k]['monthStopnow'] = $dataList;
  177. //
  178. // $list = $this->numofperact->getCurrDoneSMontht($v['stid']);
  179. // $dataList = array();
  180. // $currdoneTA = 0;
  181. // foreach ($mList as $va) {
  182. // $falg = true;
  183. // foreach ($list as $value) {
  184. // if ($va == $value['month']) {
  185. // $currdoneTA+=$value['currdone'];
  186. // $PER = round($currdoneTA / $contracttotal, 3) * 100;
  187. // array_push($dataList, $PER);
  188. // $falg = false;
  189. // break;
  190. // }
  191. // }
  192. // if ($falg)
  193. // array_push($dataList, 0);
  194. // }
  195. // $this->data['conArray'][$k]['monthCurrdone'] = $dataList;
  196. //
  197. $totalstid = 0;
  198. $monthArray = [];
  199. foreach ($this->data['conArray'] as $k => $v) {
  200. $this->data['conArray'][$k]['pstopnow'] = $this->data['conArray'][$k]['pscurrdone'] = 0;
  201. $retval = $this->actmeasure->getAllbyStidSum($v['stid']);
  202. $contracttotal += $retval[0]['contracttotal'];
  203. $totalstid += $this->actmeasure->getTotal($v['stid'])['total'];
  204. $total = $this->actmeasure->getTotal($v['stid'])['total'];
  205. if ($total) {
  206. $this->data['conArray'][$k]['total'] = round($total, 2);
  207. } else {
  208. $this->data['conArray'][$k]['total'] = 0;
  209. }
  210. $sntotal = $this->numofperact->getCountTotalSTID2($v['stid'])['totalplus'];
  211. if ($sntotal) {
  212. $this->data['conArray'][$k]['stopnow'] = round($sntotal, 2);
  213. } else {
  214. $this->data['conArray'][$k]['stopnow'] = 0;
  215. }
  216. $this->data['conArray'][$k]['currdone'] = $this->numofperact->getCurrDoneSt($v['stid'])['currdone'];
  217. if ($this->data['conArray'][$k]['total'] > 0) {
  218. $this->data['conArray'][$k]['pstopnow'] = round(($this->data['conArray'][$k]['stopnow'] / $this->data['conArray'][$k]['total']) * 100);
  219. $this->data['conArray'][$k]['pscurrdone'] = round(($this->data['conArray'][$k]['currdone'] / $this->data['conArray'][$k]['total']) * 100);
  220. }
  221. // 分组出年月 每个月份的独立相加 累计完成总量
  222. $month = $this->numofperact->getCurrTotalStMonthNoCheckno($v['stid']);
  223. foreach ($month as $key => $value) {
  224. $allmonth[] = $value;
  225. if (!in_array($value['month'], $monthArray))
  226. $monthArray[] = $value['month'];
  227. }
  228. // 分组出年月 每个月份的独立相加 本月完成总量
  229. $month1 = $this->numofperact->getCurrDoneStMonthNoCheckno($v['stid']);
  230. foreach ($month1 as $key => $value) {
  231. $allmonth1[] = $value;
  232. }
  233. }
  234. // 中文表述年月
  235. $total = $total1 = array();
  236. $startyear = $cnymArray = array();
  237. foreach ($monthArray as $kk => $vv) {
  238. $ymarray = explode('-', $vv);
  239. if (!in_array($ymarray[0], $startyear))
  240. $startyear[] = $ymarray[0];
  241. // $cnym = '\'' . $ymarray[1] . '月' . '\'';
  242. // if ($kk == 0)
  243. // $cnym = '\'' . $ymarray[0] . '年' . $ymarray[1] . '月' . '\'';
  244. // $cnymArray[] = $cnym;
  245. }
  246. $thismonth = 0;
  247. foreach($startyear as $sk => $sv){
  248. for($i = 1; $i <= 12; $i++){
  249. $j = $i < 10 ? '0'.$i : $i;
  250. $month = $sv.'-'.$j;
  251. $thismonth1 = 0;
  252. foreach ($allmonth1 as $k1 => $v1) {
  253. if ($v1['month'] == $month)
  254. $thismonth1 += $v1['currdone'];
  255. }
  256. $total1[] = $thismonth1 != 0 ? $thismonth1 : 0;
  257. foreach ($allmonth as $keyk => $valuev) {
  258. if ($valuev['month'] == $month)
  259. $thismonth += $valuev['currtotal'];
  260. }
  261. $total[] = ($thismonth != 0 && $thismonth1 != 0) ? $thismonth : 0;
  262. $cnymArray[] = $i == 1 ? '\'' .$sv.'年'.$i.'月'. '\'' : '\'' .$i.'月'. '\'';
  263. }
  264. }
  265. foreach ($total as $value2) {
  266. $total3[] = round(($value2 / $totalstid) * 100);
  267. }
  268. foreach ($total1 as $value11) {
  269. $total4[] = round(($value11 / $totalstid) * 100);
  270. }
  271. $this->data['projectDate'] = implode(',', $cnymArray);
  272. $this->data['t1'] = implode(',', $total3);
  273. $this->data['t2'] = implode(',', $total4);
  274. $this->render('w-project-detail', $this->data, TRUE);
  275. }
  276. public function proSection()
  277. {
  278. if (isset($_POST['stid']) && isset($_POST['proname'])) {
  279. $this->contractact->updateStName($_POST['stid'], $_POST['proname']);
  280. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  281. }
  282. $this->getFav();
  283. $contractArray = $this->contractact->getRowByPid($this->params['pid']); // 获取合同段
  284. $htmlstr = NULL;
  285. foreach ($contractArray as $k => $v) {// 获取所有合同段
  286. $retval = $this->actmeasure->getAllbyStid($v['stid']); // 获取标段
  287. $bdhtmlstr = NULL;
  288. $bdhtmlstr = '<thead>
  289. <tr><th class="taC taCble header" width="225">标段名</th><th class="taC" width="140">计量期数</th><th width="115" class="taC">总价</th><th class="taC" width="">截止上期完成/本期完成/未完成</th></tr></thead>
  290. <tbody>';
  291. $biaoduantotalmoney = 0;
  292. $currTotal = 0;
  293. $progress = $otherprogress = '0%';
  294. $currTotal = $this->numofperact->getCountTotalSTID2($v['stid']);
  295. foreach ($retval as $key => $value) {
  296. $displayPercentSnTotalProgress = '0%';
  297. $displayPercentCurrTotalProgress = '0%';
  298. $displayPercentLessTotalProgress = '0%';
  299. $snTotalProgress = $currTotalProgress = $lessTotalProgress = '0%';
  300. $nTotalProgress = $ncurrTotalProgress = $nlessTotalProgress = number_format(0, 2, '.', ',');
  301. $numCount = $this->numofperact->getCountTotalnum2($value['pmid']); // 获取标段已有期数
  302. if (isset($numCount['numpname'])) {
  303. $lastStatusArray = $this->numofperact->getMaxStatusTimes($value['pmid'], $numCount['numpname']);
  304. } else {
  305. $lastStatusArray['currstatus'] = 'uncheck';
  306. $numCount['numpname'] = 0;
  307. }
  308. $totalplus = $this->numofperact->getCountTotalplus($value['pmid']);
  309. $snTotal = $this->numofperact->getStopNowTotal($value['pmid']); //根据标段ID获取最新一期(包括不通过)
  310. $currcomTotal = $this->numofperact->getCurrdoneNew($value['pmid']); //截止目前
  311. $numStatusArray = $this->numofperact->getLastStatus2($this->params['pid'], $value['pmid']);
  312. if ($numCount > 0) {
  313. $nTotalProgress = number_format($snTotal['sntotal'], 2, '.', ',');
  314. $ncurrTotalProgress = number_format($currcomTotal['currtotal'], 2, '.', ',');
  315. $nlessTotalProgress = number_format($value['contracttotal'] - $snTotal['sntotal'] - $currcomTotal['currtotal'], 2, '.', ',');
  316. if (isset($value['contracttotal']) && ($value['contracttotal'] > 0)) {
  317. $snTotalProgress = round(($snTotal['sntotal'] / $value['contracttotal']) * 100);
  318. $currTotalProgress = round(($currcomTotal['currtotal'] / $value['contracttotal']) * 100);
  319. // $lessTotalProgress = round((($value['contracttotal'] - ($currcomTotal['currtotal'] + $snTotal['sntotal'])) / $value['contracttotal']) * 100);
  320. $lessTotalProgress = 100 - $snTotalProgress - $currTotalProgress;
  321. $displayPercentSnTotalProgress = $snTotalProgress . '%';
  322. $displayPercentCurrTotalProgress = $currTotalProgress . '%';
  323. $displayPercentLessTotalProgress = $lessTotalProgress . '%';
  324. }
  325. }
  326. $biaoduantotalmoney += $value['contracttotal'];
  327. $totalmoney = number_format($value['contracttotal'], 2, '.', ',');
  328. if (isset($numStatusArray['currstatus'])) {
  329. $statusStr = '(' . $this->statusArray[$lastStatusArray['currstatus']] . ')';
  330. } else {
  331. $statusStr = '';
  332. }
  333. $displayPercentSnTotalProgresswidth = floatval($displayPercentSnTotalProgress) >= 100 ? '100%' : $displayPercentSnTotalProgress;
  334. $displayPercentCurrTotalProgresswidth = floatval($displayPercentCurrTotalProgress) >= 100 ? '100%' : $displayPercentCurrTotalProgress;
  335. $displayPercentLessTotalProgresswidth = floatval($displayPercentLessTotalProgress) >= 100 ? '100%' : $displayPercentLessTotalProgress;
  336. $bdhtmlstr .= '
  337. <tr>
  338. <td><a href="/project/' . $this->params['pid'] . '/section/' . $value['pmid'] . '/detail">' . $value['pmname'] . '</a></td>
  339. <td class="">第 ' . $numCount['numpname'] . ' 期' . $statusStr . '</td>
  340. <td class="taR">¥' . $totalmoney . '</td>
  341. <td>
  342. <div class="progress">
  343. <div class="progress-bar progress-bar-success" style="width: ' . $displayPercentSnTotalProgresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="截止上期完成:¥' . $nTotalProgress . '">' . $displayPercentSnTotalProgress . '</div>
  344. <div class="progress-bar" style="width:' . $displayPercentCurrTotalProgresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="本期完成:¥' . $ncurrTotalProgress . '">' . $displayPercentCurrTotalProgress . '</div>
  345. <div class="progress-bar progress-bar-gary" style="width:' . $displayPercentLessTotalProgresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $nlessTotalProgress . '">' . $displayPercentLessTotalProgress . '</div>
  346. </div>
  347. </td>
  348. </tr>';
  349. }
  350. $nprogress = $notherprogress = NULL;
  351. // $currTotal = $this->numofperact->getCurrdoneSTID($v['stid']);
  352. if ($biaoduantotalmoney > 0) {
  353. $nprogress = number_format($currTotal['totalplus'], 2, '.', ',');
  354. $notherprogress = number_format($biaoduantotalmoney - $currTotal['totalplus'], 2, '.', ',');
  355. $progress = round(($currTotal['totalplus'] / $biaoduantotalmoney) * 100) . '%'; // 累计完成计量 所有标段合计
  356. $otherprogress = round((($biaoduantotalmoney - $currTotal['totalplus']) / $biaoduantotalmoney) * 100) . '%';
  357. $biaoduantotalmoney = number_format($biaoduantotalmoney, 2, '.', ',');
  358. }
  359. $progresswidth = floatval($progress) >= 100 ? '100%' : $progress;
  360. $otherprogresswidth = floatval($otherprogress) >= 100 ? '100%' : $otherprogress;
  361. $htmlstr .= '<div class="project">
  362. <div class="proSection">
  363. <table class="table">
  364. <thead>
  365. <tr>
  366. <td width="150"><span aria-hidden="true" data-icon="u"></span> ' . $v['stname'] . '<a id="idt_' . $v['stid'] . '" href="#secoption" data-toggle="modal" title="编辑/查看KEY" stid="' . $v['stid'] . '" proname="' . $v['stname'] . '" key="' . $v['stkey'] . '"><span data-icon="S" aria-hidden="true" class="closePanel" data-placement="bottom" data-toggle="tooltip" data-original-title="查看KEY" style="font-size:18px"></span></a></td>
  367. <td width="90">总价:</td><td width="165">¥<b style="font-size:16px">' . $biaoduantotalmoney . '</b></td>
  368. <td width="60">完成进度:</td><td><div class="progress">
  369. <div class="progress-bar progress-bar-success" style="width:' . $progresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="累计完成:¥' . $nprogress . '">' . $progress . '</div>
  370. <div class="progress-bar progress-bar-danger" style="width:' . $otherprogresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $notherprogress . '">' . $otherprogress . '</div>
  371. </div></td>
  372. </tr>
  373. </thead>
  374. </table>
  375. <table class="table table-striped table-hover tablelist">
  376. ' . $bdhtmlstr . '
  377. </tbody>
  378. </table>
  379. </div>
  380. </div>';
  381. }
  382. $this->data['htmlstr'] = $htmlstr;
  383. if (isset($_POST['secname']) && $_POST['secname']) {
  384. $this->contractact->insertContract($this->params['pid'], $this->auth->getUid(), $_POST['secname']);
  385. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  386. }
  387. $this->data['pid'] = $this->params['pid'];
  388. $this->render('w-project-section', $this->data, TRUE);
  389. }
  390. function proSectionFiles()
  391. {
  392. if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
  393. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  394. if ($imnidArray['iaid'] > 0) {
  395. $fileArray = $this->upItemFile('file')[0];
  396. if (isset($fileArray['filepath'])) {
  397. $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  398. if (isset($itemArray)) {
  399. if ($itemArray['oldiaid'] > 0) {
  400. $oldiaid = $itemArray['oldiaid'];
  401. } else {
  402. $oldiaid = $imnidArray['iaid'];
  403. }
  404. $postArray = array('ownerid' => $this->auth->getUid(), 'pid' => $itemArray['pid'], 'pmid' => $itemArray['pmid'], 'filename' => $fileArray['filename'], 'filesize' => $fileArray['filesize'], 'fileext' => $fileArray['fileext'], 'filepath' => $fileArray['filepath'], 'oldiaid' => $oldiaid);
  405. $iaid = $this->itemfle->insertItemFileRecord($postArray);
  406. if ($iaid > 1) {
  407. $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
  408. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  409. die();
  410. }
  411. }
  412. }
  413. }
  414. }
  415. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  416. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  417. if ($imnidArray['iaid'] > 0) {
  418. $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
  419. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  420. die();
  421. }
  422. }
  423. if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
  424. $filename = $_POST['filename'];
  425. $filedesc = $_POST['filedesc'];
  426. $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
  427. if ($imnidArray['iaid'] > 0) {
  428. if (isset($filedesc))
  429. $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc, 0);
  430. if (isset($filename))
  431. $this->itemfle->updateItemFields($imnidArray['iaid'], $filename, 0);
  432. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  433. die();
  434. }
  435. }
  436. // 面包屑导航项目
  437. // $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  438. // $this->data['pmid'] = $this->params['pmid'];
  439. // $allproArray = $this->project->getAll();
  440. // foreach ($allproArray as $kk => $vv) {
  441. // if ($vv['pid'] == $this->params['pid']) {
  442. // $this->data['currproArray'] = $vv;
  443. // } else {
  444. // $this->data['allproArray'][] = $vv;
  445. // }
  446. // }
  447. $this->getFav();
  448. // 面包屑导航合同
  449. $conArray = $this->contractact->getAll();
  450. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  451. if (isset($measureArray['stid'])) {
  452. foreach ($conArray as $kkk => $vvv) {
  453. if ($vvv['stid'] == $measureArray['stid']) {
  454. $this->data['currconArray'] = $vvv;
  455. } else {
  456. if ($vvv['pid'] == $this->params['pid'])
  457. $this->data['allconArray'][] = $vvv;
  458. }
  459. }
  460. } else {
  461. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  462. }
  463. // 面包屑导航标段
  464. $this->data['curractmeasureArray'] = NULL;
  465. $this->data['allactmeasureArray'] = [];
  466. $actmeasureArray = $this->actmeasure->getAll();
  467. foreach ($actmeasureArray as $kkkk => $vvvv) {
  468. if ($vvvv['stid'] == $measureArray['stid']) {
  469. if (($vvvv['pmid'] == $this->params['pmid'])) {
  470. $this->data['curractmeasureArray'] = $vvvv;
  471. } else {
  472. $this->data['allactmeasureArray'][] = $vvvv;
  473. }
  474. }
  475. }
  476. // 选取查询
  477. $groupArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  478. $this->data['groupArray'] = $groupArray;
  479. $owneridArray = $this->itemfle->getGroupOwnerid($this->params['pmid']);
  480. foreach ($owneridArray as $k => $v) {
  481. $this->data['owneridArray'][$k]['name'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  482. $this->data['owneridArray'][$k]['iaid'] = $v['iaid'];
  483. $this->data['owneridArray'][$k]['ownerid'] = $v['ownerid'];
  484. }
  485. // 分页
  486. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid'], 0, $this->params['numpname'], $this->params['userid']);
  487. if ($totalArchive) {
  488. if ($this->params['numpname'] && $this->params['userid']) {
  489. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  490. } elseif ($this->params['numpname']) {
  491. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/page', $totalArchive, 20, 100);
  492. } elseif ($this->params['userid']) {
  493. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  494. } else {
  495. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/page', $totalArchive, 20, 100);
  496. }
  497. $pager->setCss('', 'disabled', 'active');
  498. if (isset($this->params['pindex']))
  499. $pager->paginate(intval($this->params['pindex']));
  500. else
  501. $pager->paginate(1);
  502. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid'], $pager->limit, $this->params['numpname'], $this->params['userid']);
  503. }
  504. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  505. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  506. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  507. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  508. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  509. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  510. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  511. }
  512. $this->data['pid'] = $this->params['pid'];
  513. $this->data['pmid'] = $this->params['pmid'];
  514. $this->data['mpid'] = $this->params['mpid'];
  515. $this->data['userid'] = $this->params['userid'];
  516. $this->data['num'] = $this->params['numpname'];
  517. $this->data['pager'] = $pager->output;
  518. $this->render('w-project-section-files', $this->data, TRUE);
  519. }
  520. function proSectionFilesRecover()
  521. {
  522. if (isset($_POST['optype']) && ($_POST['optype'] == 'reconvery') && isset($_POST['imnid'])) {
  523. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  524. if ($imnidArray['iaid'] > 0) {
  525. $this->itemmeasurenum->recoveryDel($_POST['imnid']);
  526. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  527. die();
  528. }
  529. }
  530. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  531. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  532. if ($imnidArray['iaid'] > 0) {
  533. $iaidArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  534. if ($iaidArray['ownerid'] == $this->auth->getUid()) {
  535. $this->itemfle->delItem($imnidArray['iaid']);
  536. $this->itemmeasurenum->delItemIAID($imnidArray['iaid']);
  537. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  538. die();
  539. } else {
  540. echo json_encode(array('status' => 2), JSON_UNESCAPED_UNICODE);
  541. die();
  542. }
  543. }
  544. }
  545. // 面包屑导航项目
  546. // $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  547. // $this->data['pmid'] = $this->params['pmid'];
  548. // $allproArray = $this->project->getAll();
  549. // foreach ($allproArray as $kk => $vv) {
  550. // if ($vv['pid'] == $this->params['pid']) {
  551. // $this->data['currproArray'] = $vv;
  552. // } else {
  553. // $this->data['allproArray'][] = $vv;
  554. // }
  555. // }
  556. $this->getFav();
  557. // 面包屑导航合同
  558. $conArray = $this->contractact->getAll();
  559. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  560. if (isset($measureArray['stid'])) {
  561. foreach ($conArray as $kkk => $vvv) {
  562. if ($vvv['stid'] == $measureArray['stid']) {
  563. $this->data['currconArray'] = $vvv;
  564. } else {
  565. if ($vvv['pid'] == $this->params['pid'])
  566. $this->data['allconArray'][] = $vvv;
  567. }
  568. }
  569. } else {
  570. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  571. }
  572. // 面包屑导航标段
  573. $this->data['curractmeasureArray'] = NULL;
  574. $this->data['allactmeasureArray'] = [];
  575. $actmeasureArray = $this->actmeasure->getAll();
  576. foreach ($actmeasureArray as $kkkk => $vvvv) {
  577. if ($vvvv['stid'] == $measureArray['stid']) {
  578. if (($vvvv['pmid'] == $this->params['pmid'])) {
  579. $this->data['curractmeasureArray'] = $vvvv;
  580. } else {
  581. $this->data['allactmeasureArray'][] = $vvvv;
  582. }
  583. }
  584. }
  585. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
  586. if ($totalArchive) {
  587. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/recover/page', $totalArchive, 20, 100);
  588. $pager->setCss('', 'disabled', 'active');
  589. if (isset($this->params['pindex']))
  590. $pager->paginate(intval($this->params['pindex']));
  591. else
  592. $pager->paginate(1);
  593. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNumDel($pager->limit, $this->params['pmid']);
  594. }
  595. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  596. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  597. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  598. $this->data['itemMeasureArray'][$k]['delname'] = $this->profile->getProWithUid($v['deluid'])['name'];
  599. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  600. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  601. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  602. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  603. $this->data['itemMeasureArray'][$k]['filepath'] = $fileArray['filepath'];
  604. }
  605. $this->data['pid'] = $this->params['pid'];
  606. $this->data['pmid'] = $this->params['pmid'];
  607. $this->data['mpid'] = $this->params['mpid'];
  608. $this->data['pager'] = $pager->output;
  609. $this->render('w-project-section-files-recover', $this->data, TRUE);
  610. }
  611. /**
  612. * @return actMeasure
  613. */
  614. public function proSectionGetFiles()
  615. {
  616. $attaArray = $this->itemfle->getItemFile($this->params['iaid']);
  617. $this->file_down($attaArray['filepath'], $attaArray['filesize'], $attaArray['filename'] . '.' . $attaArray['fileext']);
  618. return;
  619. }
  620. function getItemFileHistory()
  621. {
  622. if ($this->params['iaid']) {
  623. $iaidArray = $this->itemfle->getItemFile($this->params['iaid']);
  624. if ($iaidArray['oldiaid'] > 0) {
  625. $oldiaidArray = $this->itemfle->getFileHistory($iaidArray['oldiaid']);
  626. $htmlstr = '';
  627. foreach ($oldiaidArray as $k => $v) {
  628. $countInt = $k + 1;
  629. $formatDate = date('Y-m-d H:i:s', $v['intime']);
  630. $profileArray = $this->profile->getProWithUid($v['ownerid']);
  631. $htmlstr .= '<div class="media"><div class="pull-left"><h4>#' . $countInt . '</h4></div><div class="media-body"><h5>' . $profileArray['name'] . '&nbsp;上传于 ' . $formatDate . '</h5><a href="/' . $v['filepath'] . '" target="_blank">' . $v['filename'] . '</a></div></div>';
  632. }
  633. echo json_encode(array('html' => $htmlstr), JSON_UNESCAPED_UNICODE);
  634. die();
  635. }
  636. }
  637. }
  638. Function fNumber($number)
  639. {
  640. if ($number == '')
  641. Return "-";
  642. $nlen = strlen($number);
  643. while ($nlen > 3) {
  644. $fNumber = "," . substr($number, $nlen - 3, 3);
  645. $number = substr($number, 0, -3);
  646. $nlen = strlen($number);
  647. }
  648. if ($nlen <= 3) {
  649. $fNumber = $number . $fNumber;
  650. }
  651. Return $fNumber;
  652. }
  653. private function getFav()
  654. {
  655. $proArray = $this->project->getAll($this->auth->getUid());
  656. $this->data['othrPro'] = [];
  657. foreach ($proArray as $key => $value) {
  658. if ($value['pid'] == $this->params['pid']) {
  659. $this->data['currProName'] = $value['pname'];
  660. $this->data['currProID'] = $value['pid'];
  661. } else {
  662. $this->data['othrPro'][] = $proArray[$key];
  663. }
  664. }
  665. }
  666. public function proSectionMeasure()
  667. {
  668. //此处未做更改,JSON文件已经固定名称
  669. $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  670. if (isset($jsonpath['dirname'])) {
  671. $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  672. if ($handle = opendir($extPathdir)) {
  673. while (false !== ($file = readdir($handle))) {
  674. $filename = NULL;
  675. $filename = pathinfo($file);
  676. if ($filename['extension'] == 'json')
  677. $proArray = json_decode(file_get_contents($extPathdir . '/' . $file), TRUE, JSON_UNESCAPED_UNICODE);
  678. }
  679. closedir($handle);
  680. }
  681. $this->data['proArray'] = $proArray['Bills'];
  682. } else {
  683. $this->data['proArray'] = [];
  684. }
  685. $this->data['mpid'] = $this->params['mpid'];
  686. $this->data['pid'] = $this->params['pid'];
  687. $this->render('w-project-section-measure', $this->data, TRUE);
  688. }
  689. public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0)
  690. {
  691. $count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
  692. if (!$count) {
  693. return $string;
  694. }
  695. if ($len == 0) {
  696. $end = $count; //传入0则替换到最后
  697. } else {
  698. $end = $start + $len; //传入指定长度则为开始长度+指定长度
  699. }
  700. $i = 0;
  701. $returnString = '';
  702. while ($i < $count) { //循环该字符串
  703. $tmpString = mb_substr($string, $i, 1, 'UTF-8'); // 与mb_strlen编码一致
  704. if ($start <= $i && $i < $end) {
  705. $returnString .= $repalce;
  706. } else {
  707. $returnString .= $tmpString;
  708. }
  709. $i++;
  710. }
  711. return $returnString;
  712. }
  713. function unicode_encode($name)
  714. {//to Unicode
  715. $name = iconv('UTF-8', 'UCS-2', $name);
  716. $len = strlen($name);
  717. $str = '';
  718. for ($i = 0; $i < $len - 1; $i = $i + 2) {
  719. $c = $name[$i];
  720. $c2 = $name[$i + 1];
  721. if (ord($c) > 0) {// 两个字节的字
  722. $str .= '\\' . base_convert(ord($c), 10, 16) . base_convert(ord($c2), 10, 16);
  723. } else {
  724. $str .= $c2;
  725. }
  726. }
  727. $str = strtoupper($str);
  728. return $str;
  729. }
  730. function unicode_decode($name)
  731. {//Unicode to
  732. $pattern = '/([\w]+)|(\\\u([\w]{4}))/i';
  733. preg_match_all($pattern, $name, $matches);
  734. if (!empty($matches)) {
  735. $name = '';
  736. for ($j = 0; $j < count($matches[0]); $j++) {
  737. $str = $matches[0][$j];
  738. if (strpos($str, '\\u') === 0) {
  739. $code = base_convert(substr($str, 2, 2), 16, 10);
  740. $code2 = base_convert(substr($str, 4), 16, 10);
  741. $c = chr($code) . chr($code2);
  742. $c = iconv('UCS-2', 'UTF-8', $c);
  743. $name .= $c;
  744. } else {
  745. $name .= $str;
  746. }
  747. }
  748. }
  749. return $name;
  750. }
  751. public function proDetail()
  752. {
  753. // 面包屑导航项目
  754. // $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  755. // $this->data['pmid'] = $this->params['pmid'];
  756. // $allproArray = $this->project->getAll();
  757. // foreach ($allproArray as $kk => $vv) {
  758. // if ($vv['pid'] == $this->params['pid']) {
  759. // $this->data['currproArray'] = $vv;
  760. // } else {
  761. // $this->data['allproArray'][] = $vv;
  762. // }
  763. // }
  764. $this->getFav();
  765. // 面包屑导航合同
  766. $conArray = $this->contractact->getAll();
  767. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  768. if (isset($measureArray['stid'])) {
  769. foreach ($conArray as $kkk => $vvv) {
  770. if ($vvv['stid'] == $measureArray['stid']) {
  771. $this->data['currconArray'] = $vvv;
  772. } else {
  773. if ($vvv['pid'] == $this->params['pid'])
  774. $this->data['allconArray'][] = $vvv;
  775. }
  776. }
  777. } else {
  778. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  779. }
  780. // 面包屑导航标段
  781. $this->data['curractmeasureArray'] = NULL;
  782. $this->data['allactmeasureArray'] = [];
  783. $actmeasureArray = $this->actmeasure->getAll();
  784. foreach ($actmeasureArray as $kkkk => $vvvv) {
  785. if ($vvvv['stid'] == $measureArray['stid']) {
  786. if (($vvvv['pmid'] == $this->params['pmid'])) {
  787. $this->data['curractmeasureArray'] = $vvvv;
  788. } else {
  789. $this->data['allactmeasureArray'][] = $vvvv;
  790. }
  791. }
  792. }
  793. // 图表
  794. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  795. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  796. foreach ($this->data['MeasureArray'] as $key => $value) {
  797. if ($measureArray['contracttotal'] > $value['currdone'] && $value['currdone'] > 0) {
  798. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  799. } else {
  800. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  801. }
  802. }
  803. $this->data['pmid'] = $this->params['pmid'];
  804. $this->data['pid'] = $this->params['pid'];
  805. $this->render('w-project-section-detail', $this->data, TRUE);
  806. }
  807. public function welcome()
  808. {
  809. // if (!$this->auth->isLoggedIn())
  810. // return Doo::conf()->APP_URL;
  811. if ($this->profile->getProWithUid($this->auth->getUid())['userid'])
  812. return Doo::conf()->APP_URL . 'project/list';
  813. if (isset($_POST['welform'])) {
  814. $profileUserArray = $_POST;
  815. $profileUserArray['userid'] = $this->auth->getUid();
  816. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  817. return Doo::conf()->APP_URL . 'project/list';
  818. }
  819. $this->render('welcome', $this->data);
  820. }
  821. // ajax提取密码名称
  822. public function getAjaxSection()
  823. {
  824. if (!$this->isAjax())
  825. return;
  826. echo json_encode($_POST);
  827. }
  828. function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
  829. {
  830. $this->att->setUploadDir();
  831. return $this->att->uploadMut($fildname, $param);
  832. }
  833. /**
  834. * 文件下载
  835. * @param $filepath 文件路径
  836. * @param $filename 文件名称
  837. */
  838. function file_down($filepath, $filesize, $filename = '')
  839. {
  840. if (!$filename)
  841. $filename = basename($filepath);
  842. if ($this->is_ie())
  843. $filename = rawurlencode($filename);
  844. $filetype = $this->fileext($filename);
  845. // $filesize = sprintf("%u", filesize($filepath));
  846. if (ob_get_length() !== false)
  847. @ob_end_clean();
  848. header('Pragma: public');
  849. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  850. header('Cache-Control: no-store, no-cache, must-revalidate');
  851. header('Cache-Control: pre-check=0, post-check=0, max-age=0');
  852. header('Content-Transfer-Encoding: binary');
  853. header('Content-Encoding: none');
  854. header('Content-type: ' . $filetype);
  855. header('Content-Disposition: attachment; filename="' . $filename . '"');
  856. header('Content-length: ' . $filesize);
  857. @readfile($filepath);
  858. exit;
  859. }
  860. /**
  861. * IE浏览器判断
  862. */
  863. function is_ie()
  864. {
  865. $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
  866. if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false))
  867. return false;
  868. if (strpos($useragent, 'msie ') !== false)
  869. return true;
  870. return false;
  871. }
  872. /**
  873. * 取得文件扩展
  874. *
  875. * @param $filename 文件名
  876. * @return 扩展名
  877. */
  878. function fileext($filename)
  879. {
  880. return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
  881. }
  882. /*
  883. *
  884. * 中间计量表草图列表
  885. */
  886. public function proSectionInterMediate(){
  887. //草图功能开关控制
  888. if($this->data['imediateSwitch'] == 0){
  889. exit('中间计量表草图添加功能未启用...');
  890. }
  891. // 面包屑导航项目
  892. $this->getFav();
  893. // 面包屑导航合同
  894. $conArray = $this->contractact->getAll();
  895. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  896. if (isset($measureArray['stid'])) {
  897. foreach ($conArray as $kkk => $vvv) {
  898. if ($vvv['stid'] == $measureArray['stid']) {
  899. $this->data['currconArray'] = $vvv;
  900. } else {
  901. if ($vvv['pid'] == $this->params['pid'])
  902. $this->data['allconArray'][] = $vvv;
  903. }
  904. }
  905. } else {
  906. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  907. }
  908. // 面包屑导航标段
  909. // 面包屑导航标段
  910. $this->data['curractmeasureArray'] = NULL;
  911. $this->data['allactmeasureArray'] = [];
  912. $actmeasureArray = $this->actmeasure->getAll();
  913. foreach ($actmeasureArray as $kkkk => $vvvv) {
  914. if ($vvvv['stid'] == $measureArray['stid']) {
  915. if (($vvvv['pmid'] == $this->params['pmid'])) {
  916. $this->data['curractmeasureArray'] = $vvvv;
  917. } else {
  918. $this->data['allactmeasureArray'][] = $vvvv;
  919. }
  920. }
  921. }
  922. Doo::loadHelper('DooPager');
  923. $pagestr = '';
  924. $sqlstr = ' 1';
  925. // $this->data['project'] = '';
  926. // $this->data['tender'] = '';
  927. $this->data['phaseno'] = '';
  928. $this->data['nosign'] = '';
  929. //获取项目信息
  930. $searchsql = 'isinter=3';
  931. // $itemlist = $this->sign->getSignGroupByProject($searchsql);
  932. // if(!empty($itemlist)){
  933. // foreach($itemlist as $ik => $iv){
  934. // $itemmsg = $this->project->getRowByPid($iv['project']);
  935. // $itemlist[$ik]['pname'] = $itemmsg['pname'];
  936. // }
  937. // }
  938. if(isset($this->params['pid']) && is_numeric($this->params['pid'])){
  939. $pagestr .= '/'.$this->params['pid'];
  940. $sqlstr .= ' and project='.$this->params['pid'];
  941. //获取标段信息
  942. // $tenderlist = $this->sign->getSignGroupByTender($this->params['pid'],$searchsql);
  943. // if(!empty($tenderlist)){
  944. // foreach($tenderlist as $tk => $tv){
  945. // $tendermsg = $this->actmeasure->getRowByPmid($tv['tender']);
  946. // $tenderlist[$tk]['pmname'] = $tendermsg['pmname'];
  947. // }
  948. // }
  949. if(isset($this->params['pmid']) && is_numeric($this->params['pmid'])){
  950. $pagestr .= '/section/'.$this->params['pmid'];
  951. $sqlstr .= ' and tender='.$this->params['pmid'];
  952. //获取期数信息
  953. $phasenolist = $this->sign->getSignGroupByPhaseno($this->params['pmid'],$searchsql);
  954. if(!empty($phasenolist)){
  955. foreach($phasenolist as $pk => $pv){
  956. $phasenolist[$pk]['numpname'] = $pv['phaseno'];
  957. }
  958. }
  959. if(isset($this->params['mpid']) && is_numeric($this->params['mpid'])){
  960. $this->data['phaseno'] = $this->params['mpid'];
  961. $pagestr .= '/phaseno/'.$this->params['mpid'];
  962. $sqlstr .= ' and phaseno='.$this->params['mpid'];
  963. }
  964. }
  965. }
  966. $totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
  967. $pager = new DooPager(Doo::conf()->APP_URL . 'project'.$pagestr.'/intermediate/page', $totalArchive, 10, 100);
  968. $pager->setCss('', 'disabled', 'active');
  969. if (isset($this->params['pindex']))
  970. $pager->paginate(intval($this->params['pindex']));
  971. else
  972. $pager->paginate(1);
  973. if ($pager->limit != ' -10,10')
  974. $list = $this->sign->getSignList($sqlstr.' and '.$searchsql,$pager->limit);
  975. if(isset($list) && !empty($list)){
  976. foreach($list as $k => $v){
  977. //获取项目名,标段名,标段期数
  978. $project = $this->project->getRowByPid($v['project']);
  979. $tender = $this->actmeasure->getRowByPmid($v['tender']);
  980. // $phaseno = $this->numofperact->getCurrStatus($v['phaseno']);
  981. $list[$k]['project'] = $project['pname'];
  982. $list[$k]['tender'] = $tender['pmname'];
  983. // $list[$k]['phaseno'] = $phaseno['numpname'];
  984. $list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
  985. $list[$k]['auditname'] = $this->auth->getName($v['audituid']);
  986. }
  987. }
  988. $this->data['list'] = isset($list) ? $list : '';
  989. // $this->data['itemlist'] = $itemlist;
  990. // $this->data['tenderlist'] = isset($tenderlist) ? $tenderlist : '';
  991. $this->data['phasenolist'] = isset($phasenolist) ? $phasenolist : '';
  992. $this->data['pager'] = $pager->output;
  993. $this->data['pid'] = $this->params['pid'];
  994. $this->data['pmid'] = $this->params['pmid'];
  995. $this->render('w-project-section-intermediate', $this->data, TRUE);
  996. }
  997. /**
  998. *
  999. * 中间计量表视图
  1000. */
  1001. public function signView()
  1002. {
  1003. //草图功能开关控制
  1004. if($this->data['imediateSwitch'] == 0){
  1005. exit('中间计量表草图添加功能未启用...');die;
  1006. }
  1007. if(!isset($this->params['sid']) || !is_numeric($this->params['sid'])){
  1008. exit('没有报表参数');
  1009. }
  1010. //获取报表信息
  1011. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  1012. if(empty($signmsg) || $signmsg['isinter'] != 3){
  1013. exit('不存在此中间计量表');
  1014. }
  1015. $backurl = '/project/'.$signmsg['project'].'/section/'.$signmsg['tender'].'/intermediate';
  1016. //获取项目名,标段名,标段期数
  1017. $project = $this->project->getRowByPid($signmsg['project']);
  1018. $tender = $this->actmeasure->getRowByPmid($signmsg['tender']);
  1019. // $phaseno = $this->numofperact->getCurrStatus($signmsg['phaseno']);
  1020. $signmsg['project'] = $project['pname'];
  1021. $signmsg['tender'] = $tender['pmname'];
  1022. // $signmsg['phaseno'] = $phaseno['numpname'];
  1023. //获取签署人列表
  1024. $signauditlist = $this->sign->getSignAuditList($this->params['sid']);
  1025. if(!empty($signauditlist)){
  1026. foreach($signauditlist as $k => $v){
  1027. //获取签署人头像
  1028. $signauditlist[$k]['index'] = $k+1;
  1029. $signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
  1030. }
  1031. }
  1032. //获取报表图片
  1033. $maxwidth = 794; //默认图片最大宽度 a4
  1034. $maxheight = 1123; //默认图片最大高度 a4
  1035. if(!empty($signmsg['widhei'])){
  1036. $widhei = explode('_', $signmsg['widhei']);
  1037. $style = $widhei[0].'mm '.$widhei[1].'mm';
  1038. }else{
  1039. $style = '210mm 297mm';
  1040. }
  1041. $signattlist = $this->sign->getSignAttList($this->params['sid']);
  1042. if(!empty($signattlist)){
  1043. foreach($signattlist as $sak => $sav){
  1044. $signattlist[$sak]['auditatt'] = $this->sign->getSignAuditAttList($sav['said']);
  1045. if($sak == 0){
  1046. $imgmsg = getimagesize(Doo::conf()->APP_URL.$sav['filepath']);
  1047. $maxwidth = $imgmsg[0];
  1048. $maxheight = $imgmsg[1];
  1049. }
  1050. }
  1051. }
  1052. $this->data['signmsg'] = $signmsg;
  1053. $this->data['auditlist'] = $signauditlist;
  1054. $this->data['attlist'] = $signattlist;
  1055. $this->data['backurl'] = $backurl;
  1056. $this->data['maxwidth'] = $maxwidth;
  1057. $this->data['maxheight'] = $maxheight;
  1058. $this->data['style'] = $style;
  1059. $this->render('sign-view-page', $this->data, TRUE);
  1060. }
  1061. }
  1062. ?>