ProjectController.php 52 KB

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