RProjectController.php 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146
  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. $this->measureauditact->setUncheck($auditArray['maid']);
  812. $this->numofperact->updateAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], 'checking', $maxTimes['times']);
  813. //获取并改变上一个审批人为审批中状态
  814. $lastmeasureauditact = $this->measureauditact->getMyAuditStatus($lastRowArray['pmid'], $lastRowArray['numpname'], $maxTimes['times'], $_POST['last']);
  815. $this->measureauditact->updateMastatus($lastmeasureauditact['maid']);
  816. // SMS Start
  817. $TenderArray = $this->actmeasure->getRowByPmid($lastRowArray['pmid']);
  818. $userProArray = $this->profile->getProWithUid($_POST['last']);
  819. if (isset($userProArray) && ($userProArray['mobile'])) {// // XXXX(标段名),陈特,已审批通过。请您继续审批。
  820. $retval = $this->__auditNotice($userProArray['mobile'], Doo::conf()->SMS_TIPS_PRE . '您好,' . $TenderArray["pmname"] . Doo::conf()->SMS_TIPS["AUDIT_NOTICE_AUDITOR4"]);
  821. }
  822. // SMS End
  823. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  824. die();
  825. }
  826. $this->data['pmid'] = $lastRowArray['pmid'];
  827. $this->data['numpname'] = $lastRowArray['numpname'];
  828. $this->data['times'] = $lastRowArray['times'];
  829. $this->data['pid'] = $this->params['pid'];
  830. $firstUser = 0;
  831. foreach ($auditUserArray as $key => $value) {
  832. $strAvatar = $this->auth->getAvatar($value['auditoruid']);
  833. $i = $key + 1;
  834. if ($value['auditoruid'] == $this->auth->getUid()) {
  835. $this->data['mastatus'] = $value['mastatus'];
  836. $this->data['maid'] = $value['maid'];
  837. if($key == 0){
  838. $firstUser = 1;
  839. }else{
  840. $this->data['lastUserID'] = $auditUserArray[$key-1]['auditoruid'];
  841. $this->data['lastUsername'] = $this->profile->getProWithUid($auditUserArray[$key-1]['auditoruid'])['name'];
  842. $this->data['lastUserCompany'] = $this->profile->getProWithUid($auditUserArray[$key-1]['auditoruid'])['company'];
  843. }
  844. }
  845. if ($value['mastatus'] == 'uncheck') {
  846. $statuStr = '';
  847. $statucolorStr = '';
  848. $statushtml = '<li title="" class=""><img src="' . $strAvatar . '"></li>';
  849. }
  850. if ($value['mastatus'] == 'checking') {
  851. $statuStr = '<h4 class="colOrange">审批中</h4>';
  852. $statucolorStr = 'colOrange';
  853. $statushtml = '<li title="审批中" class="wait"><span data-icon="k" aria-hidden="true"></span> <img src="' . $strAvatar . '"></li>';
  854. }
  855. if ($value['mastatus'] == 'checked') {
  856. $statuStr = '<h4 class="colGreen">审批完成(' . date('Y-m-d', $value['audittime']) . ')</h4>';
  857. $statucolorStr = 'colGreen';
  858. $statushtml = '<li title="审批通过" class="pass"><span data-icon="d" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
  859. }
  860. if ($value['mastatus'] == 'checkno') {
  861. $statuStr = '<h4 class="colRed">审批不通过(' . date('Y-m-d', $value['audittime']) . ')</h4>';
  862. $statucolorStr = 'colRed';
  863. $statushtml = '<li title="审批不通过" class="notpass"><span data-icon="e" aria-hidden="true"></span><img src="' . $strAvatar . '"></li>';
  864. }
  865. $auditUserArray[$key]['statuStr'] = $statuStr;
  866. $auditUserArray[$key]['statucolorStr'] = $statucolorStr;
  867. $auditUserArray[$key]['statushtml'] = $statushtml;
  868. $auditUserArray[$key]['k'] = $i;
  869. $auditUserArray[$key]['name'] = $this->profile->getProWithUid($value['auditoruid'])['name'];
  870. }
  871. $strAvatar = $this->auth->getAvatar($measureArray['uid']);
  872. $orginArray['avatar'] = '<img src="' . $strAvatar . '"></li>';
  873. $orginArray['name'] = $this->profile->getProWithUid($measureArray['uid'])['name'];
  874. $attfileArray = $this->attfile->getFirstFile($lastRowArray['pmid'], $lastRowArray['numpname'], $lastRowArray['times']);
  875. $orginArray['time'] = date('Y-m-d', $attfileArray['intime']);
  876. $this->data['auditArray'] = $auditUserArray;
  877. $this->data['orginArray'] = $orginArray;
  878. $this->data['pmid'] = $this->params['pmid'];
  879. $this->data['pid'] = $this->params['pid'];
  880. $this->data['mpid'] = $this->params['mpid'];
  881. $this->data['firstUser'] = $firstUser;
  882. $this->render('r-project-section-report', $this->data, TRUE);
  883. }
  884. /**
  885. * 。
  886. * 标段ID,期号
  887. */
  888. private function __auditNotice($mobile, $text)
  889. {
  890. $smsSwitch = $this->aconfig->getOne(array('select' => 'smsSwitch', 'asArray' => TRUE))['smsSwitch'];
  891. if ($smsSwitch > 0)
  892. return $this->sms->sendSms($mobile, $text);
  893. }
  894. /*
  895. *
  896. * 中间计量表草图列表
  897. */
  898. public function proSectionInterMediate(){
  899. //草图功能开关控制
  900. if($this->data['imediateSwitch'] == 0){
  901. exit('中间计量表草图添加功能未启用...');
  902. }
  903. // 面包屑导航项目
  904. $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  905. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  906. foreach ($mpidArray as $k1 => $v1) {
  907. if ($v1['pid'] != $this->params['pid'])
  908. $this->data['allproArray'][] = $this->project->getRowByPid($v1['pid']);
  909. }
  910. $this->data['currproArray'] = $this->project->getRowByPid($this->params['pid']);
  911. // 面包屑导航合同
  912. $conArray = $this->contractact->getAll();
  913. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  914. if (isset($measureArray['stid'])) {
  915. foreach ($conArray as $kkk => $vvv) {
  916. if ($vvv['stid'] == $measureArray['stid']) {
  917. $this->data['currconArray'] = $vvv;
  918. } else {
  919. if ($vvv['pid'] == $this->params['pid'])
  920. $this->data['allconArray'][] = $vvv;
  921. }
  922. }
  923. } else {
  924. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  925. }
  926. // 面包屑导航标段
  927. $this->data['curractmeasureArray'] = NULL;
  928. $this->data['allactmeasureArray'] = [];
  929. $auditArray = $this->measureauditact->getUserPmid($this->auth->getUid());
  930. foreach ($auditArray as $key => $value) {
  931. $pmidArray[] = $value['pmid'];
  932. }
  933. $actmeasureArray = $this->actmeasure->getAll();
  934. foreach ($actmeasureArray as $kkkk => $vvvv) {
  935. if ($vvvv['stid'] == $measureArray['stid']) {
  936. if(in_array($vvvv['pmid'],$pmidArray)){
  937. if (($vvvv['pmid'] == $this->params['pmid'])) {
  938. $this->data['curractmeasureArray'] = $vvvv;
  939. } else {
  940. $this->data['allactmeasureArray'][] = $vvvv;
  941. }
  942. }
  943. }
  944. }
  945. Doo::loadHelper('DooPager');
  946. $pagestr = '';
  947. $sqlstr = ' 1';
  948. $this->data['phaseno'] = '';
  949. $this->data['nosign'] = '';
  950. //获取项目信息
  951. $searchsql = 'isinter!=0 and sid IN (SELECT sid FROM jl_sign_audit WHERE jl_sign_audit.audituid='.$this->auth->getUid().')';
  952. if(isset($this->params['pid']) && is_numeric($this->params['pid'])){
  953. $pagestr .= '/'.$this->params['pid'];
  954. $sqlstr .= ' and project='.$this->params['pid'];
  955. //获取标段信息
  956. if(isset($this->params['pmid']) && is_numeric($this->params['pmid'])){
  957. $pagestr .= '/section/'.$this->params['pmid'];
  958. $sqlstr .= ' and tender='.$this->params['pmid'];
  959. //获取期数信息
  960. $phasenolist = $this->sign->getSignGroupByPhaseno($this->params['pmid'],$searchsql);
  961. if(!empty($phasenolist)){
  962. foreach($phasenolist as $pk => $pv){
  963. $phasenolist[$pk]['numpname'] = $pv['phaseno'];
  964. }
  965. }
  966. if(isset($this->params['mpid']) && is_numeric($this->params['mpid'])){
  967. $this->data['phaseno'] = $this->params['mpid'];
  968. $pagestr .= '/phaseno/'.$this->params['mpid'];
  969. $sqlstr .= ' and phaseno='.$this->params['mpid'];
  970. }
  971. }
  972. }
  973. $totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
  974. $pager = new DooPager(Doo::conf()->APP_URL . 'rproject'.$pagestr.'/intermediate/page', $totalArchive, 10, 100);
  975. $pager->setCss('', 'disabled', 'active');
  976. if (isset($this->params['pindex']))
  977. $pager->paginate(intval($this->params['pindex']));
  978. else
  979. $pager->paginate(1);
  980. if ($pager->limit != ' -10,10')
  981. $list = $this->sign->getSignList($sqlstr.' and '.$searchsql,$pager->limit);
  982. if(isset($list) && !empty($list)){
  983. foreach($list as $k => $v){
  984. //获取项目名,标段名,标段期数
  985. $project = $this->project->getRowByPid($v['project']);
  986. $tender = $this->actmeasure->getRowByPmid($v['tender']);
  987. // $phaseno = $this->numofperact->getCurrStatus($v['phaseno']);
  988. $list[$k]['project'] = $project['pname'];
  989. $list[$k]['tender'] = $tender['pmname'];
  990. // $list[$k]['phaseno'] = $phaseno['numpname'];
  991. $list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
  992. $list[$k]['auditname'] = $this->auth->getName($v['audituid']);
  993. }
  994. }
  995. $numStatusArray = $this->numofperact->getLastStatus3($this->params['pid'], $this->params['pmid']);
  996. if (!isset($numStatusArray['currstatus'])) {
  997. $numStatusArray['currstatus'] = 'uncheck';
  998. }
  999. $this->data['list'] = isset($list) ? $list : '';
  1000. $this->data['phasenolist'] = isset($phasenolist) ? $phasenolist : '';
  1001. $this->data['pager'] = $pager->output;
  1002. $this->data['pid'] = $this->params['pid'];
  1003. $this->data['pmid'] = $this->params['pmid'];
  1004. $this->data['mpid'] = $numStatusArray['mpid'];
  1005. $this->render('r-project-section-intermediate', $this->data, TRUE);
  1006. }
  1007. /**
  1008. *
  1009. * 中间计量表视图
  1010. */
  1011. public function signView()
  1012. {
  1013. //草图功能开关控制
  1014. if($this->data['imediateSwitch'] == 0){
  1015. exit('中间计量表草图添加功能未启用...');die;
  1016. }
  1017. if(!isset($this->params['sid']) || !is_numeric($this->params['sid'])){
  1018. exit('没有报表参数');
  1019. }
  1020. //获取报表信息
  1021. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  1022. if(empty($signmsg) || $signmsg['isinter'] != 3){
  1023. exit('不存在此中间计量表');
  1024. }
  1025. $backurl = '/rproject/'.$signmsg['project'].'/section/'.$signmsg['tender'].'/intermediate';
  1026. //获取项目名,标段名,标段期数
  1027. $project = $this->project->getRowByPid($signmsg['project']);
  1028. $tender = $this->actmeasure->getRowByPmid($signmsg['tender']);
  1029. // $phaseno = $this->numofperact->getCurrStatus($signmsg['phaseno']);
  1030. $signmsg['project'] = $project['pname'];
  1031. $signmsg['tender'] = $tender['pmname'];
  1032. // $signmsg['phaseno'] = $phaseno['numpname'];
  1033. //获取签署人列表
  1034. $signauditlist = $this->sign->getSignAuditList($this->params['sid']);
  1035. if(!empty($signauditlist)){
  1036. foreach($signauditlist as $k => $v){
  1037. //获取签署人头像
  1038. $signauditlist[$k]['index'] = $k+1;
  1039. $signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
  1040. }
  1041. }
  1042. //获取报表图片
  1043. $maxwidth = 794; //默认图片最大宽度 a4
  1044. $maxheight = 1123; //默认图片最大高度 a4
  1045. if(!empty($signmsg['widhei'])){
  1046. $widhei = explode('_', $signmsg['widhei']);
  1047. $style = $widhei[0].'mm '.$widhei[1].'mm';
  1048. }else{
  1049. $style = '210mm 297mm';
  1050. }
  1051. $signattlist = $this->sign->getSignAttList($this->params['sid']);
  1052. if(!empty($signattlist)){
  1053. foreach($signattlist as $sak => $sav){
  1054. $signattlist[$sak]['auditatt'] = $this->sign->getSignAuditAttList($sav['said']);
  1055. if($sak == 0){
  1056. $imgmsg = getimagesize(Doo::conf()->APP_URL.$sav['filepath']);
  1057. $maxwidth = $imgmsg[0];
  1058. $maxheight = $imgmsg[1];
  1059. }
  1060. }
  1061. }
  1062. $this->data['signmsg'] = $signmsg;
  1063. $this->data['auditlist'] = $signauditlist;
  1064. $this->data['attlist'] = $signattlist;
  1065. $this->data['backurl'] = $backurl;
  1066. $this->data['maxwidth'] = $maxwidth;
  1067. $this->data['maxheight'] = $maxheight;
  1068. $this->data['style'] = $style;
  1069. $this->render('sign-view-page', $this->data, TRUE);
  1070. }
  1071. }
  1072. ?>