RProjectController.php 58 KB

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