RProjectController.php 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  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('measureauditact');
  9. Doo::loadClass('numofperact');
  10. Doo::loadModelAt('aconfig', 'admin');
  11. Doo::loadClass('sms');
  12. Doo::loadClass('itemmeasurenum');
  13. Doo::loadClass('itemfile');
  14. Doo::loadClass('attachment');
  15. Doo::loadHelper('DooPager');
  16. Doo::loadClass('sign');
  17. /**
  18. * MainController
  19. * Feel free to delete the methods and replace them with your own code.
  20. *
  21. * @author darkredz
  22. */
  23. class RProjectController extends DooController
  24. {
  25. private $data, $sign, $auth, $attfile, $profile, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '未审批', 'checking' => '审批中', 'checked' => '已审批', 'checkno' => '未通过'), $aconfig, $sms, $itemfile, $itemmeasurenum, $itemfle, $att;
  26. public function __construct()
  27. {
  28. $this->auth = new Auth();
  29. $this->attfile = new attFile();
  30. $this->profile = new Profile();
  31. $this->project = new Project();
  32. $this->contractact = new Contractact();
  33. $this->actmeasure = new actMeasure();
  34. $this->measureauditact = new MeasureauditAct();
  35. $this->numofperact = new NumofperAct();
  36. $this->itemfile = new ItemFile();
  37. $this->itemmeasurenum = new ItemMeasureNumpofper();
  38. $this->aconfig = new AConfig();
  39. $this->itemfle = new ItemFile();
  40. $this->att = new attachment();
  41. $this->sign = new Signn();
  42. $this->sms = new Sms(Doo::conf()->SMS_URL, Doo::conf()->SMS_AUTHKEY);
  43. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  44. $this->data['currChannle'] = 'r';
  45. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  46. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  47. if (isset($mpidArray[0]['pid'])) {
  48. $this->data['numofchecking'] = 0;
  49. foreach ($mpidArray as $key => $value) {
  50. // 审批操作按照时间排序多标段
  51. $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  52. }
  53. }
  54. if (!isset($this->data['numofchecking']) || $this->data['numofchecking'] == 0) {
  55. $this->data['numofchecking'] = null;
  56. }
  57. $this->data['signSwitch'] = $this->aconfig->getOne(array('select' => 'signswitch', 'asArray' => TRUE))['signswitch'];
  58. //获取需要您签署的数目
  59. if($this->data['signSwitch'] > 0)
  60. $this->data['needSignNum'] = $this->sign->getNeedSignNumbyUid($this->auth->getUid()) != 0 ? $this->sign->getNeedSignNumbyUid($this->auth->getUid()) : '';
  61. //获取桌面版本
  62. $this->getsoftware();
  63. //草图入口
  64. $this->data['imediateSwitch'] = $this->aconfig->getOne(array('select' => 'imediateswitch', 'asArray' => TRUE))['imediateswitch'];
  65. }
  66. function getsoftware(){
  67. $StrJson = ($this->aconfig->getOne(array('select' => 'upgradeinfo', 'asArray' => TRUE))['upgradeinfo']);
  68. $upgradeinfo = json_decode($StrJson, true);
  69. if ($upgradeinfo) {
  70. $this->data['version'] = $upgradeinfo['version'];
  71. $this->data['download'] = $upgradeinfo['download'];
  72. }
  73. }
  74. public function beforeRun($resource, $action)
  75. {
  76. // $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  77. // $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  78. // if (!$falg)
  79. // return Doo::acl()->defaultFailedRoute;
  80. if ($this->auth->getUid()) {
  81. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  82. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  83. if (!$falg)
  84. return Doo::acl()->defaultFailedRoute;
  85. } else {
  86. return Doo::acl()->defaultFailedRoute;
  87. }
  88. }
  89. public function index()
  90. {
  91. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  92. if (isset($mpidArray[0]['pid'])) {
  93. foreach ($mpidArray as $key => $value) {
  94. // 审批操作按照时间排序多标段
  95. $numOfChecking = $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  96. // end
  97. $this->data['proArray'][$key] = $this->project->getRowByPid($value['pid']);
  98. $this->data['proArray'][$key]['numofchecking'] = $numOfChecking;
  99. $this->data['proArray'][$key]['contracttotal'] = $this->actmeasure->getTotalWithPid($value['pid']);
  100. $this->data['proArray'][$key]['changTotal'] = $this->numofperact->getChangTotal($value['pid']);
  101. // $this->data['proArray'][$key]['contracttotal'] += $this->data['proArray'][$key]['changTotal'];
  102. $this->data['proArray'][$key]['currdone'] = $this->numofperact->getCurrDoneNow($value['pid']);
  103. if (($this->data['proArray'][$key]['contracttotal'] > 0) && ($this->data['proArray'][$key]['currdone'] > 0)) {
  104. $this->data['proArray'][$key]['pcurrdone'] = round(($this->data['proArray'][$key]['currdone'] / $this->data['proArray'][$key]['contracttotal']) * 100) . '%';
  105. } else {
  106. $this->data['proArray'][$key]['pcurrdone'] = '0%';
  107. }
  108. $this->data['proArray'][$key]['bcontracttotal'] = number_format($this->data['proArray'][$key]['contracttotal'], 2, '.', ',');
  109. $this->data['proArray'][$key]['bchangTotal'] = number_format($this->data['proArray'][$key]['changTotal'], 2, '.', ',');
  110. $this->data['proArray'][$key]['index'] = $key%8+1;
  111. }
  112. } else {
  113. $this->data['proArray'] = array();
  114. }
  115. $this->render('r-project', $this->data);
  116. }
  117. public function proOverview()
  118. {
  119. // $this->data['pros'] = $this->project->getAll();
  120. // if (isset($_POST['pname']) && $_POST['pname']) {
  121. // $this->project->insertProject($_POST['pname']);
  122. // return Doo::conf()->APP_URL . 'project/index';
  123. // }
  124. $this->data['pid'] = $this->params['pid'];
  125. $this->render('w-project-detail', $this->data);
  126. }
  127. public function proSection()
  128. {
  129. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  130. foreach ($mpidArray as $k1 => $v1) {
  131. if ($v1['pid'] != $this->params['pid'])
  132. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  133. }
  134. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  135. $this->data['conArray'] = $this->contractact->getRowByPid($this->params['pid']);
  136. $auditArray = $this->measureauditact->getUserPmid($this->auth->getUid());
  137. foreach ($auditArray as $key => $value) {
  138. $pmidArray[] = $value['pmid'];
  139. }
  140. foreach ($this->data['conArray'] as $key => $value) {
  141. $html = null;
  142. $hetongTotal = $dispstopnowtotal = $dispnowtotal = $countNum = 0;
  143. $nstopnowtotal = $ncurrdone = $nnowtotal = number_format(0, 2, '.', ',');
  144. $pstopnowtotal = '0%';
  145. $pcurrdone = '0%';
  146. $ncurrdone = number_format(0, 2, '.', ',');
  147. $pnowtotal = '0%';
  148. $dispcurrdone = '0%';
  149. // $numStatusArray['currstatus'] = 'uncheck';
  150. $StidArray = $this->actmeasure->getAllbyStid($value['stid']);
  151. $currdoneInt = $this->numofperact->getCurrdoneSTID($value['stid'])['totalplus'];
  152. if (isset($StidArray))
  153. foreach ($StidArray as $k => $v) {
  154. if (in_array($v['pmid'], $pmidArray)) {
  155. $snTotal = $this->numofperact->getStopNowTotal($v['pmid']); //根据标段ID获取最新一期(包括不通过)
  156. $currcomTotal = $this->numofperact->getCurrdoneNew($v['pmid']); //截止目前
  157. $ncurrdone = number_format($currcomTotal['currtotal'], 2, '.', ',');
  158. $nstopnowtotal = number_format($snTotal['sntotal'], 2, '.', ',');
  159. if ($v['contracttotal'] > 0) {
  160. $nnowtotal = number_format($v['contracttotal'] - $currcomTotal['currtotal'] - $snTotal['sntotal'], 2, '.', ',');
  161. $pstopnowtotal = round(($snTotal['sntotal'] / $v['contracttotal']) * 100);
  162. $pcurrdone = round(($currcomTotal['currtotal'] / $v['contracttotal']) * 100);
  163. }
  164. $dispcurrdone = $pcurrdone . '%';
  165. $dispstopnowtotal = $pstopnowtotal . '%';
  166. $pnowtotal = 100 - $pcurrdone - $pstopnowtotal;
  167. $dispnowtotal = $pnowtotal . '%';
  168. $countNum = $this->numofperact->getLastNew2($v['pmid'])['numpname'];
  169. if (!isset($countNum)) {
  170. $countNum = 0;
  171. }
  172. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $v['pmid']);
  173. if (!isset($numStatusArray['currstatus'])) {
  174. $numStatusArray['currstatus'] = 'uncheck';
  175. }
  176. $datatmp = $this->measureauditact->getMyAuditStatus2($numStatusArray['pmid'], $numStatusArray['numpname'], $numStatusArray['times'], $this->auth->getUid());
  177. if ($datatmp && ($datatmp['mastatus'] == 'checking')) {
  178. $buttonhtml = '<a class="btn btn-warning btn-sm" href="/rproject/' . $this->params['pid'] . '/section/' . $v['pmid'] . '/report/' . $numStatusArray['mpid'] . '">开始审批</a>';
  179. } else {
  180. $buttonhtml = '(<span class="colOrange">' . $this->statusArray[$numStatusArray['currstatus']] . '</span>)';
  181. }
  182. $html .= '<tr>
  183. <td><a href="/rproject/' . $this->params['pid'] . '/section/' . $v['pmid'] . '/detail">' . $v['pmname'] . '</a></td>
  184. <td class="">第 ' . $countNum . ' 期 ' . $buttonhtml . '</td>
  185. <td class="taR">¥' . number_format($v['contracttotal'], 2, '.', ',') . '</td>
  186. <td>
  187. <div class="progress">
  188. <div class="progress-bar progress-bar-success" style="width: ' . $dispstopnowtotal . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="截止上期完成:¥' . $nstopnowtotal . '">' . $dispstopnowtotal . '</div>
  189. <div class="progress-bar" style="width:' . $dispcurrdone . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="本期完成:¥' . $ncurrdone . '">' . $dispcurrdone . '</div>
  190. <div class="progress-bar progress-bar-gary" style="width:' . $dispnowtotal . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $nnowtotal . '">' . $dispnowtotal . '</div>
  191. </div>
  192. </td>
  193. </tr>';
  194. $hetongTotal += $v['contracttotal'];
  195. }
  196. }
  197. $this->data['conArray'][$key]['htmlstr'] = $html;
  198. $this->data['conArray'][$key]['hetongTotal'] = number_format($hetongTotal, 2, '.', ',');
  199. $this->data['conArray'][$key]['phetongTotal'] = 0;
  200. $this->data['conArray'][$key]['nhetongTotal'] = 0;
  201. $this->data['conArray'][$key]['phetongTotal2'] = 0;
  202. $this->data['conArray'][$key]['ncurrdoneInt'] = 0;
  203. $this->data['conArray'][$key]['phetongTotal'] = round(($currdoneInt / $hetongTotal) * 100) . '%';
  204. $this->data['conArray'][$key]['nhetongTotal'] = number_format($currdoneInt, 2, '.', ',');
  205. $this->data['conArray'][$key]['phetongTotal2'] = round((($hetongTotal - $currdoneInt) / $hetongTotal) * 100) . '%';
  206. $this->data['conArray'][$key]['ncurrdoneInt'] = number_format($hetongTotal - $currdoneInt, 2, '.', ',');
  207. }
  208. $this->render('r-project-section', $this->data, TRUE);
  209. }
  210. function proSectionMeasure()
  211. {
  212. $mpidArray = $this->measureauditact->getAuditProject($this->auth->getUid());
  213. foreach ($mpidArray as $k1 => $v1) {
  214. if ($v1['pid'] != $this->params['pid'])
  215. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  216. }
  217. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  218. $this->data['pid'] = $this->params['pid'];
  219. $this->data['mpid'] = $this->params['mpid'];
  220. $this->data['mastatus'] = $this->measureauditact->getStatusByMpid($this->params['mpid'])['mastatus'];
  221. if (isset($_POST['submit'])) {
  222. if ($_POST['submit'] == 'ok') {
  223. $this->measureauditact->setStatusTrue($this->params['mpid']);
  224. return Doo::conf()->APP_URL . 'rproject/' . $this->params['pid'] . '/section/' . $this->params['mpid'] . '/measure';
  225. }
  226. if ($_POST['submit'] == 'no') {
  227. $this->measureauditact->setStatusFalse($this->params['mpid']);
  228. return Doo::conf()->APP_URL . 'rproject/' . $this->params['pid'] . '/section/' . $this->params['mpid'] . '/measure';
  229. }
  230. }
  231. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  232. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  233. // if ($handle = opendir($extPathdir)) {
  234. // while (false !== ($file = readdir($handle))) {
  235. // $filename = pathinfo($file);
  236. // if ($filename['extension'] == 'json')
  237. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  238. // }
  239. // closedir($handle);
  240. // }
  241. // $this->data['proArray'] = $proArray;
  242. $this->render('r-project-section-measure', $this->data, TRUE);
  243. }
  244. function proSectionFiles()
  245. {
  246. if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
  247. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  248. if ($imnidArray['iaid'] > 0) {
  249. $fileArray = $this->upItemFile('file')[0];
  250. if (isset($fileArray['filepath'])) {
  251. $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  252. if (isset($itemArray)) {
  253. if ($itemArray['oldiaid'] > 0) {
  254. $oldiaid = $itemArray['oldiaid'];
  255. } else {
  256. $oldiaid = $imnidArray['iaid'];
  257. }
  258. $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);
  259. $iaid = $this->itemfle->insertItemFileRecord($postArray);
  260. if ($iaid > 1) {
  261. $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
  262. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  263. die();
  264. }
  265. }
  266. }
  267. }
  268. }
  269. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  270. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  271. if ($imnidArray['iaid'] > 0) {
  272. $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
  273. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  274. die();
  275. }
  276. }
  277. if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
  278. $filename = $_POST['filename'];
  279. $filedesc = $_POST['filedesc'];
  280. $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
  281. if ($imnidArray['iaid'] > 0) {
  282. if (isset($filename))
  283. $this->itemfle->updateItemFields($imnidArray['iaid'], $filename, 0);
  284. if (isset($filedesc))
  285. $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc, 0);
  286. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  287. die();
  288. }
  289. }
  290. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $this->params['pmid']);
  291. if (!isset($numStatusArray['currstatus'])) {
  292. $numStatusArray['currstatus'] = 'uncheck';
  293. }
  294. // 面包屑导航项目
  295. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  296. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  297. foreach ($mpidArray as $k1 => $v1) {
  298. if ($v1['pid'] != $this->params['pid'])
  299. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  300. }
  301. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  302. // 面包屑导航合同
  303. $conArray = $this->contractact->getAll();
  304. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  305. if (isset($measureArray['stid'])) {
  306. foreach ($conArray as $kkk => $vvv) {
  307. if ($vvv['stid'] == $measureArray['stid']) {
  308. $this->data['currconArray'] = $vvv;
  309. } else {
  310. if ($vvv['pid'] == $this->params['pid'])
  311. $this->data['allconArray'][] = $vvv;
  312. }
  313. }
  314. } else {
  315. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  316. }
  317. // 面包屑导航标段
  318. $this->data['curractmeasureArray'] = NULL;
  319. $this->data['allactmeasureArray'] = [];
  320. $actmeasureArray = $this->actmeasure->getAll();
  321. foreach ($actmeasureArray as $kkkk => $vvvv) {
  322. if ($vvvv['stid'] == $measureArray['stid']) {
  323. if (($vvvv['pmid'] == $this->params['pmid'])) {
  324. $this->data['curractmeasureArray'] = $vvvv;
  325. } else {
  326. $this->data['allactmeasureArray'][] = $vvvv;
  327. }
  328. }
  329. }
  330. // 选取查询
  331. $groupArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  332. $this->data['groupArray'] = $groupArray;
  333. $owneridArray = $this->itemfle->getGroupOwnerid($this->params['pmid']);
  334. foreach ($owneridArray as $k => $v) {
  335. $this->data['owneridArray'][$k]['name'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  336. $this->data['owneridArray'][$k]['iaid'] = $v['iaid'];
  337. $this->data['owneridArray'][$k]['ownerid'] = $v['ownerid'];
  338. }
  339. // 分页
  340. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid'], 0, $this->params['numpname'], $this->params['userid']);
  341. if ($totalArchive) {
  342. if ($this->params['numpname'] && $this->params['userid']) {
  343. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  344. } elseif ($this->params['numpname']) {
  345. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/page', $totalArchive, 20, 100);
  346. } elseif ($this->params['userid']) {
  347. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  348. } else {
  349. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/page', $totalArchive, 20, 100);
  350. }
  351. $pager->setCss('', 'disabled', 'active');
  352. if (isset($this->params['pindex']))
  353. $pager->paginate(intval($this->params['pindex']));
  354. else
  355. $pager->paginate(1);
  356. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid'], $pager->limit, $this->params['numpname'], $this->params['userid']);
  357. }
  358. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  359. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  360. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  361. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  362. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  363. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  364. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  365. }
  366. $this->data['pid'] = $this->params['pid'];
  367. $this->data['pmid'] = $this->params['pmid'];
  368. $this->data['mpid'] = $numStatusArray['mpid'];
  369. $this->data['userid'] = $this->params['userid'];
  370. $this->data['num'] = $this->params['numpname'];
  371. $this->data['pager'] = $pager->output;
  372. $this->render('r-project-section-files', $this->data, TRUE);
  373. }
  374. function proSectionFilesRecover()
  375. {
  376. if (isset($_POST['optype']) && ($_POST['optype'] == 'reconvery') && isset($_POST['imnid'])) {
  377. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  378. if ($imnidArray['iaid'] > 0) {
  379. $this->itemmeasurenum->recoveryDel($_POST['imnid']);
  380. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  381. die();
  382. }
  383. }
  384. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  385. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  386. if ($imnidArray['iaid'] > 0) {
  387. $iaidArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  388. if ($iaidArray['ownerid'] == $this->auth->getUid()) {
  389. $this->itemfle->delItem($imnidArray['iaid']);
  390. $this->itemmeasurenum->delItemIAID($imnidArray['iaid']);
  391. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  392. die();
  393. } else {
  394. echo json_encode(array('status' => 2), JSON_UNESCAPED_UNICODE);
  395. die();
  396. }
  397. }
  398. }
  399. // 面包屑导航项目
  400. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  401. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  402. foreach ($mpidArray as $k1 => $v1) {
  403. if ($v1['pid'] != $this->params['pid'])
  404. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  405. }
  406. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  407. // 面包屑导航合同
  408. $conArray = $this->contractact->getAll();
  409. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  410. if (isset($measureArray['stid'])) {
  411. foreach ($conArray as $kkk => $vvv) {
  412. if ($vvv['stid'] == $measureArray['stid']) {
  413. $this->data['currconArray'] = $vvv;
  414. } else {
  415. if ($vvv['pid'] == $this->params['pid'])
  416. $this->data['allconArray'][] = $vvv;
  417. }
  418. }
  419. } else {
  420. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  421. }
  422. // 面包屑导航标段
  423. $this->data['curractmeasureArray'] = NULL;
  424. $this->data['allactmeasureArray'] = [];
  425. $actmeasureArray = $this->actmeasure->getAll();
  426. foreach ($actmeasureArray as $kkkk => $vvvv) {
  427. if ($vvvv['stid'] == $measureArray['stid']) {
  428. if (($vvvv['pmid'] == $this->params['pmid'])) {
  429. $this->data['curractmeasureArray'] = $vvvv;
  430. } else {
  431. $this->data['allactmeasureArray'][] = $vvvv;
  432. }
  433. }
  434. }
  435. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
  436. if ($totalArchive) {
  437. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/recover/page', $totalArchive, 20, 100);
  438. $pager->setCss('', 'disabled', 'active');
  439. if (isset($this->params['pindex']))
  440. $pager->paginate(intval($this->params['pindex']));
  441. else
  442. $pager->paginate(1);
  443. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNumDel($pager->limit, $this->params['pmid']);
  444. }
  445. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  446. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  447. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  448. $this->data['itemMeasureArray'][$k]['delname'] = $this->profile->getProWithUid($v['deluid'])['name'];
  449. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  450. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  451. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  452. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  453. $this->data['itemMeasureArray'][$k]['filepath'] = $fileArray['filepath'];
  454. }
  455. $this->data['pid'] = $this->params['pid'];
  456. $this->data['pmid'] = $this->params['pmid'];
  457. $this->data['mpid'] = $this->params['mpid'];
  458. $this->data['pager'] = $pager->output;
  459. $this->render('r-project-section-files-recover', $this->data, TRUE);
  460. }
  461. /**
  462. * @return actMeasure
  463. */
  464. public function proSectionGetFiles()
  465. {
  466. $attaArray = $this->itemfile->getItemFile($this->params['iaid']);
  467. $this->file_down($attaArray['filepath'], $attaArray['filesize'], $attaArray['filename'] . '.' . $attaArray['fileext']);
  468. return;
  469. }
  470. /**
  471. * 文件下载
  472. * @param $filepath 文件路径
  473. * @param $filename 文件名称
  474. */
  475. function file_down($filepath, $filesize, $filename = '')
  476. {
  477. if (!$filename)
  478. $filename = basename($filepath);
  479. if ($this->is_ie())
  480. $filename = rawurlencode($filename);
  481. $filetype = $this->fileext($filename);
  482. // $filesize = sprintf("%u", filesize($filepath));
  483. if (ob_get_length() !== false)
  484. @ob_end_clean();
  485. header('Pragma: public');
  486. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  487. header('Cache-Control: no-store, no-cache, must-revalidate');
  488. header('Cache-Control: pre-check=0, post-check=0, max-age=0');
  489. header('Content-Transfer-Encoding: binary');
  490. header('Content-Encoding: none');
  491. header('Content-type: ' . $filetype);
  492. header('Content-Disposition: attachment; filename="' . $filename . '"');
  493. header('Content-length: ' . $filesize);
  494. @readfile($filepath);
  495. exit;
  496. }
  497. /**
  498. * IE浏览器判断
  499. */
  500. function is_ie()
  501. {
  502. $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
  503. if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false))
  504. return false;
  505. if (strpos($useragent, 'msie ') !== false)
  506. return true;
  507. return false;
  508. }
  509. /**
  510. * 取得文件扩展
  511. *
  512. * @param $filename 文件名
  513. * @return 扩展名
  514. */
  515. function fileext($filename)
  516. {
  517. return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
  518. }
  519. Function fNumber($number)
  520. {
  521. if ($number == '')
  522. Return "-";
  523. $nlen = strlen($number);
  524. while ($nlen > 3) {
  525. $fNumber = "," . substr($number, $nlen - 3, 3);
  526. $number = substr($number, 0, -3);
  527. $nlen = strlen($number);
  528. }
  529. if ($nlen <= 3) {
  530. $fNumber = $number . $fNumber;
  531. }
  532. Return $fNumber;
  533. }
  534. public function welcome()
  535. {
  536. // if (!$this->auth->isLoggedIn())
  537. // return Doo::conf()->APP_URL;
  538. if ($this->profile->getProWithUid($_SESSION['uid'])['userid'])
  539. return Doo::conf()->APP_URL . 'project/list';
  540. if (isset($_POST['welform'])) {
  541. $profileUserArray = $_POST;
  542. $profileUserArray['userid'] = $_SESSION['uid'];
  543. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  544. return Doo::conf()->APP_URL . 'project/list';
  545. }
  546. $this->render('welcome', $this->data);
  547. }
  548. public function prolist()
  549. {
  550. // if (!$this->auth->isLoggedIn())
  551. // return Doo::conf()->APP_URL;
  552. // $proArray = new stdClass();
  553. // $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  554. // $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  555. // if ($handle = opendir($extPathdir)) {
  556. // while (false !== ($file = readdir($handle))) {
  557. // $filename = pathinfo($file);
  558. // if ($filename['extension'] == 'json')
  559. // $proArray = json_decode(file_get_contents($extPathdir . '/' . $file));
  560. // }
  561. // closedir($handle);
  562. // }
  563. // $this->data['proArray'] = null;
  564. $this->render('s-project', $this->data);
  565. }
  566. public function proDetail()
  567. {
  568. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $this->params['pmid']);
  569. if (!isset($numStatusArray['currstatus'])) {
  570. $numStatusArray['currstatus'] = 'uncheck';
  571. }
  572. // 面包屑导航项目
  573. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  574. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  575. foreach ($mpidArray as $k1 => $v1) {
  576. if ($v1['pid'] != $this->params['pid'])
  577. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  578. }
  579. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  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. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  609. // $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  610. foreach ($this->data['MeasureArray'] as $key => $value) {
  611. if ($measureArray['contracttotal'] > $value['currdone'] && $value['currdone'] > 0) {
  612. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  613. } else {
  614. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  615. }
  616. }
  617. $this->data['pmid'] = $this->params['pmid'];
  618. $this->data['pid'] = $this->params['pid'];
  619. $this->data['mpid'] = $numStatusArray['mpid'];
  620. $this->render('r-project-section-detail', $this->data, TRUE);
  621. }
  622. public function proReport()
  623. {
  624. // 面包屑导航项目
  625. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  626. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  627. foreach ($mpidArray as $k1 => $v1) {
  628. if ($v1['pid'] != $this->params['pid'])
  629. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  630. }
  631. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  632. // 面包屑导航合同
  633. $conArray = $this->contractact->getAll();
  634. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  635. if (isset($measureArray['stid'])) {
  636. foreach ($conArray as $kkk => $vvv) {
  637. if ($vvv['stid'] == $measureArray['stid']) {
  638. $this->data['currconArray'] = $vvv;
  639. } else {
  640. if ($vvv['pid'] == $this->params['pid'])
  641. $this->data['allconArray'][] = $vvv;
  642. }
  643. }
  644. } else {
  645. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  646. }
  647. // 面包屑导航标段
  648. $this->data['curractmeasureArray'] = NULL;
  649. $this->data['allactmeasureArray'] = [];
  650. $actmeasureArray = $this->actmeasure->getAll();
  651. foreach ($actmeasureArray as $kkkk => $vvvv) {
  652. if ($vvvv['stid'] == $measureArray['stid']) {
  653. if (($vvvv['pmid'] == $this->params['pmid'])) {
  654. $this->data['curractmeasureArray'] = $vvvv;
  655. } else {
  656. $this->data['allactmeasureArray'][] = $vvvv;
  657. }
  658. }
  659. }
  660. // 期数列表
  661. $tmpArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  662. foreach ($tmpArray as $k => $v) {
  663. $intTime = $this->numofperact->getMaxTimes($v['pmid'], $v['numpname'])['times'];
  664. $nfArray[] = $this->numofperact->getRow($v['pmid'], $v['numpname'], $intTime);
  665. }
  666. foreach ($nfArray as $k => $v) {
  667. if ($v['mpid'] == $this->params['mpid']) {
  668. $this->data['mpid'] = $v['mpid'];
  669. $this->data['MeasureArray2'][] = $v;
  670. $this->data['currnum'] = $v['numpname'];
  671. } else {
  672. $this->data['numArray'][] = $v;
  673. }
  674. }
  675. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  676. foreach ($this->data['MeasureArray2'] as $key => $value) {
  677. if ($value['mpid'] == $this->params['mpid']) {
  678. $this->data['MeasureArray2'][$key]['currstatus'] = $this->statusArray[$value['currstatus']];
  679. if ($measureArray['contracttotal'] > ($value['currdone'] > 0)) {
  680. $this->data['MeasureArray2'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  681. } else {
  682. $this->data['MeasureArray2'][$key]['lessTotal'] = 0;
  683. }
  684. }
  685. }
  686. //
  687. $lastRowArray = $this->numofperact->getLastNew2($this->params['pmid']);
  688. $maxTimes = $this->numofperact->getMaxTimes($lastRowArray['pmid'], $lastRowArray['numpname']);
  689. // $auditUserArray = $this->measureauditact->getAllAudit($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
  690. // $maxtimez = $this->measureauditact->getRowGroupByTimes($this->params['mpid']);
  691. $maxtimez = $this->numofperact->getRowByMpid($this->params['mpid']);
  692. $auditUserArray = $this->measureauditact->getRowByMpidTimes($this->params['mpid'], $maxtimez['numpname'], $maxtimez['times']);
  693. $auditArray = $this->measureauditact->getLastNewRowInfo($lastRowArray['pmid'], $lastRowArray['numpname'], $this->auth->getUid());
  694. if (isset($_POST['act'])) {
  695. $auditStatusArray = array('checkno', 'checked');
  696. $myAuditStatus = $this->measureauditact->getMyAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times'], $this->auth->getUid());
  697. if (in_array($myAuditStatus['mastatus'], $auditStatusArray)) {
  698. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  699. die();
  700. }
  701. }
  702. if ($_POST['act'] == 'p') {
  703. if ($this->measureauditact->setMyAuditPass($auditArray['maid'], $_POST['content'], 1, $this->auth->getUid())) {
  704. $countAudit = count($auditUserArray);
  705. $this->attfile->updateHash($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
  706. if ($auditArray['last'] == 1) {
  707. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checked', $maxTimes['times']);
  708. // SMS Start
  709. $TenderArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  710. $userProArray = $this->profile->getProWithUid($TenderArray['uid']);
  711. if (isset($userProArray) && ($userProArray['mobile'])) {
  712. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR3"]);
  713. }
  714. // SMS End
  715. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  716. die();
  717. } else {
  718. if (($countAudit == 2) && ($auditUserArray[1]['last'] == 1) && ($auditUserArray[0]['maid'] == $auditArray['maid'])) {
  719. $this->measureauditact->updateMastatus($auditUserArray[1]['maid']);
  720. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
  721. // SMS Start
  722. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[1]['auditoruid']);
  723. $pmnameArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  724. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
  725. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  726. }
  727. // SMS End
  728. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  729. die();
  730. }
  731. if (($countAudit > 2)) {
  732. foreach ($auditUserArray as $k => $v) {
  733. if ($v['maid'] == $auditArray['maid']) {
  734. if ($k == ($countAudit - 1)) {//如果是最后一个
  735. $this->measureauditact->updateMastatus($auditUserArray[0]['maid']);
  736. // SMS Start
  737. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[0]['auditoruid']);
  738. // var_dump($verifyUserArray);
  739. $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[0]['pmid']);
  740. // var_dump($pmnameArray);
  741. // SMS End
  742. } else {
  743. $this->measureauditact->updateMastatus($auditUserArray[$k + 1]['maid']);
  744. // SMS Start
  745. $verifyUserArray = $this->profile->getVerifiedMobile($auditUserArray[$k + 1]['auditoruid']);
  746. // var_dump($verifyUserArray);
  747. $pmnameArray = $this->actmeasure->getRowByPmid($auditUserArray[$k + 1]['pmid']);
  748. // var_dump($pmnameArray);
  749. // SMS End
  750. }
  751. // SMS Start
  752. if (isset($verifyUserArray) && ($verifyUserArray['mobile'])) {// XXXX(标段名),陈特,已审批通过。请您继续审批。
  753. // $retval = $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  754. $this->__auditNotice($verifyUserArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  755. // var_dump($pmnameArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR2"]);
  756. // var_dump($retval);
  757. // var_dump($this->sms->getErrors());
  758. }
  759. // SMS End
  760. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
  761. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  762. die();
  763. }
  764. }
  765. }
  766. }
  767. }
  768. }
  769. if ($_POST['act'] == 'np') {
  770. $this->measureauditact->setCheckno($auditArray['maid'], $_POST['content'], 1);
  771. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checkno', $maxTimes['times']);
  772. $this->attfile->updateHash($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times']);
  773. // SMS Start
  774. $TenderArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  775. $userProArray = $this->profile->getProWithUid($TenderArray['uid']);
  776. if (isset($userProArray) && ($userProArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
  777. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR4"]);
  778. // var_dump($retval);
  779. // var_dump($this->sms->getErrors());
  780. // $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR4"]);
  781. }
  782. // SMS End
  783. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  784. die();
  785. }
  786. $this->data['pmid'] = $lastRowArray['pmid'];
  787. $this->data['numpname'] = $lastRowArray['numpname'];
  788. $this->data['times'] = $lastRowArray['times'];
  789. $this->data['pid'] = $this->params['pid'];
  790. foreach ($auditUserArray as $key => $value) {
  791. $strAvatar = $this->auth->getAvatar($value['auditoruid']);
  792. $i = $key + 1;
  793. if ($value['auditoruid'] == $this->auth->getUid()) {
  794. $this->data['mastatus'] = $value['mastatus'];
  795. $this->data['maid'] = $value['maid'];
  796. }
  797. if ($value['mastatus'] == 'uncheck') {
  798. $statuStr = '';
  799. $statucolorStr = '';
  800. $statushtml = '<li title="" class=""><img src="' . $strAvatar . '"></li>';
  801. }
  802. if ($value['mastatus'] == 'checking') {
  803. $statuStr = '<h4 class="colOrange">审批中</h4>';
  804. $statucolorStr = 'colOrange';
  805. $statushtml = '<li title="审批中" class="wait"><span data-icon="k" aria-hidden="true"></span> <img src="' . $strAvatar . '"></li>';
  806. }
  807. if ($value['mastatus'] == 'checked') {
  808. $statuStr = '<h4 class="colGreen">审批完成(' . date('Y-m-d', $value['audittime']) . ')</h4>';
  809. $statucolorStr = 'colGreen';
  810. $statushtml = '<li title="审批通过" class="pass"><span data-icon="d" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
  811. }
  812. if ($value['mastatus'] == 'checkno') {
  813. $statuStr = '<h4 class="colRed">审批不通过(' . date('Y-m-d', $value['audittime']) . ')</h4>';
  814. $statucolorStr = 'colRed';
  815. $statushtml = '<li title="审批不通过" class="notpass"><span data-icon="e" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
  816. }
  817. $auditUserArray[$key]['statuStr'] = $statuStr;
  818. $auditUserArray[$key]['statucolorStr'] = $statucolorStr;
  819. $auditUserArray[$key]['statushtml'] = $statushtml;
  820. $auditUserArray[$key]['k'] = $i;
  821. $auditUserArray[$key]['name'] = $this->profile->getProWithUid($value['auditoruid'])['name'];
  822. }
  823. $strAvatar = $this->auth->getAvatar($measureArray['uid']);
  824. $orginArray['avatar'] = '<img src="' . $strAvatar . '"></li>';
  825. $orginArray['name'] = $this->profile->getProWithUid($measureArray['uid'])['name'];
  826. $attfileArray = $this->attfile->getFirstFile($lastRowArray['pmid'], $lastRowArray['numpname'], $lastRowArray['times']);
  827. $orginArray['time'] = date('Y-m-d', $attfileArray['intime']);
  828. $this->data['auditArray'] = $auditUserArray;
  829. $this->data['orginArray'] = $orginArray;
  830. $this->data['pmid'] = $this->params['pmid'];
  831. $this->data['pid'] = $this->params['pid'];
  832. $this->data['mpid'] = $this->params['mpid'];
  833. $this->render('r-project-section-report', $this->data, TRUE);
  834. }
  835. /**
  836. * 。
  837. * 标段ID,期号
  838. */
  839. private function __auditNotice($mobile, $text)
  840. {
  841. $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
  842. if ($smsSwitch > 0)
  843. return $this->sms->sendSms($mobile, $text);
  844. }
  845. /*
  846. *
  847. * 中间计量表草图列表
  848. */
  849. public function proSectionInterMediate(){
  850. //草图功能开关控制
  851. if($this->data['imediateSwitch'] == 0){
  852. exit('中间计量表草图添加功能未启用...');
  853. }
  854. // 面包屑导航项目
  855. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  856. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  857. foreach ($mpidArray as $k1 => $v1) {
  858. if ($v1['pid'] != $this->params['pid'])
  859. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  860. }
  861. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  862. // 面包屑导航合同
  863. $conArray = $this->contractact->getAll();
  864. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  865. if (isset($measureArray['stid'])) {
  866. foreach ($conArray as $kkk => $vvv) {
  867. if ($vvv['stid'] == $measureArray['stid']) {
  868. $this->data['currconArray'] = $vvv;
  869. } else {
  870. if ($vvv['pid'] == $this->params['pid'])
  871. $this->data['allconArray'][] = $vvv;
  872. }
  873. }
  874. } else {
  875. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  876. }
  877. // 面包屑导航标段
  878. $this->data['curractmeasureArray'] = NULL;
  879. $this->data['allactmeasureArray'] = [];
  880. $actmeasureArray = $this->actmeasure->getAll();
  881. foreach ($actmeasureArray as $kkkk => $vvvv) {
  882. if ($vvvv['stid'] == $measureArray['stid']) {
  883. if (($vvvv['pmid'] == $this->params['pmid'])) {
  884. $this->data['curractmeasureArray'] = $vvvv;
  885. } else {
  886. $this->data['allactmeasureArray'][] = $vvvv;
  887. }
  888. }
  889. }
  890. Doo::loadHelper('DooPager');
  891. $pagestr = '';
  892. $sqlstr = ' 1';
  893. $this->data['phaseno'] = '';
  894. $this->data['nosign'] = '';
  895. //获取项目信息
  896. $searchsql = 'isinter=3';
  897. if(isset($this->params['pid']) && is_numeric($this->params['pid'])){
  898. $pagestr .= '/'.$this->params['pid'];
  899. $sqlstr .= ' and project='.$this->params['pid'];
  900. //获取标段信息
  901. if(isset($this->params['pmid']) && is_numeric($this->params['pmid'])){
  902. $pagestr .= '/section/'.$this->params['pmid'];
  903. $sqlstr .= ' and tender='.$this->params['pmid'];
  904. //获取期数信息
  905. $phasenolist = $this->sign->getSignGroupByPhaseno($this->params['pmid'],$searchsql);
  906. if(!empty($phasenolist)){
  907. foreach($phasenolist as $pk => $pv){
  908. $phasenolist[$pk]['numpname'] = $pv['phaseno'];
  909. }
  910. }
  911. if(isset($this->params['mpid']) && is_numeric($this->params['mpid'])){
  912. $this->data['phaseno'] = $this->params['mpid'];
  913. $pagestr .= '/phaseno/'.$this->params['mpid'];
  914. $sqlstr .= ' and phaseno='.$this->params['mpid'];
  915. }
  916. }
  917. }
  918. $totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
  919. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject'.$pagestr.'/intermediate/page', $totalArchive, 10, 100);
  920. $pager->setCss('', 'disabled', 'active');
  921. if (isset($this->params['pindex']))
  922. $pager->paginate(intval($this->params['pindex']));
  923. else
  924. $pager->paginate(1);
  925. if ($pager->limit != ' -10,10')
  926. $list = $this->sign->getSignList($sqlstr.' and '.$searchsql,$pager->limit);
  927. if(isset($list) && !empty($list)){
  928. foreach($list as $k => $v){
  929. //获取项目名,标段名,标段期数
  930. $project = $this->project->getRowByPid($v['project']);
  931. $tender = $this->actmeasure->getRowByPmid($v['tender']);
  932. // $phaseno = $this->numofperact->getCurrStatus($v['phaseno']);
  933. $list[$k]['project'] = $project['pname'];
  934. $list[$k]['tender'] = $tender['pmname'];
  935. // $list[$k]['phaseno'] = $phaseno['numpname'];
  936. $list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
  937. $list[$k]['auditname'] = $this->auth->getName($v['audituid']);
  938. }
  939. }
  940. $this->data['list'] = isset($list) ? $list : '';
  941. $this->data['phasenolist'] = isset($phasenolist) ? $phasenolist : '';
  942. $this->data['pager'] = $pager->output;
  943. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $this->params['pmid']);
  944. if (!isset($numStatusArray['currstatus'])) {
  945. $numStatusArray['currstatus'] = 'uncheck';
  946. }
  947. $this->data['pid'] = $this->params['pid'];
  948. $this->data['pmid'] = $this->params['pmid'];
  949. $this->data['mpid'] = $numStatusArray['mpid'];
  950. $this->render('r-project-section-intermediate', $this->data, TRUE);
  951. }
  952. /**
  953. *
  954. * 中间计量表视图
  955. */
  956. public function signView()
  957. {
  958. //草图功能开关控制
  959. if($this->data['imediateSwitch'] == 0){
  960. exit('中间计量表草图添加功能未启用...');die;
  961. }
  962. if(!isset($this->params['sid']) || !is_numeric($this->params['sid'])){
  963. exit('没有报表参数');
  964. }
  965. //获取报表信息
  966. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  967. if(empty($signmsg) || $signmsg['isinter'] != 3){
  968. exit('不存在此中间计量表');
  969. }
  970. $backurl = '/rproject/'.$signmsg['project'].'/section/'.$signmsg['tender'].'/intermediate';
  971. //获取项目名,标段名,标段期数
  972. $project = $this->project->getRowByPid($signmsg['project']);
  973. $tender = $this->actmeasure->getRowByPmid($signmsg['tender']);
  974. // $phaseno = $this->numofperact->getCurrStatus($signmsg['phaseno']);
  975. $signmsg['project'] = $project['pname'];
  976. $signmsg['tender'] = $tender['pmname'];
  977. // $signmsg['phaseno'] = $phaseno['numpname'];
  978. //获取签署人列表
  979. $signauditlist = $this->sign->getSignAuditList($this->params['sid']);
  980. if(!empty($signauditlist)){
  981. foreach($signauditlist as $k => $v){
  982. //获取签署人头像
  983. $signauditlist[$k]['index'] = $k+1;
  984. $signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
  985. }
  986. }
  987. //获取报表图片
  988. $maxwidth = 794; //默认图片最大宽度 a4
  989. $maxheight = 1123; //默认图片最大高度 a4
  990. if(!empty($signmsg['widhei'])){
  991. $widhei = explode('_', $signmsg['widhei']);
  992. $style = $widhei[0].'mm '.$widhei[1].'mm';
  993. }else{
  994. $style = '210mm 297mm';
  995. }
  996. $signattlist = $this->sign->getSignAttList($this->params['sid']);
  997. if(!empty($signattlist)){
  998. foreach($signattlist as $sak => $sav){
  999. $signattlist[$sak]['auditatt'] = $this->sign->getSignAuditAttList($sav['said']);
  1000. if($sak == 0){
  1001. $imgmsg = getimagesize(Doo::conf()->APP_URL.$sav['filepath']);
  1002. $maxwidth = $imgmsg[0];
  1003. $maxheight = $imgmsg[1];
  1004. }
  1005. }
  1006. }
  1007. $this->data['signmsg'] = $signmsg;
  1008. $this->data['auditlist'] = $signauditlist;
  1009. $this->data['attlist'] = $signattlist;
  1010. $this->data['backurl'] = $backurl;
  1011. $this->data['maxwidth'] = $maxwidth;
  1012. $this->data['maxheight'] = $maxheight;
  1013. $this->data['style'] = $style;
  1014. $this->render('sign-view-page', $this->data, TRUE);
  1015. }
  1016. }
  1017. ?>