RProjectController.php 57 KB

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