RProjectController.php 58 KB

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