ProjectController.php 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  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('numofperact');
  9. Doo::loadClass('measureauditact');
  10. Doo::loadClass('itemmeasurenum');
  11. Doo::loadClass('itemfile');
  12. Doo::loadClass('attachment');
  13. Doo::loadHelper('DooPager');
  14. Doo::loadClass('sign');
  15. Doo::loadModelAt('aconfig', 'admin');
  16. Doo::loadClass('change');
  17. /* * proDetail
  18. * MainController
  19. * Feel free to delete the methods and replace them with your own code.
  20. *
  21. * @author darkredz
  22. */
  23. class ProjectController extends DooController
  24. {
  25. private $data, $sign, $auth, $attfile, $profile, $change, $project, $contractact, $actmeasure, $measureauditact, $numofperact, $statusArray = array('uncheck' => '<span class = "colGray">未审批</span>', 'checking' => '<span class = "colOrange">审批中</span>', 'checked' => '<span class = "colGreen">审批通过</span>', 'checkno' => '<span class = "colRed">审批不通过</span>'), $aconfig, $itemmeasurenum, $itemfle, $att;
  26. public function beforeRun($resource, $action)
  27. {
  28. if ($this->auth->getUid()) {
  29. $uGroups = $this->profile->getProWithUid($this->auth->getUid());
  30. $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action);
  31. if (!$falg)
  32. return Doo::acl()->defaultFailedRoute;
  33. } else {
  34. return Doo::acl()->defaultFailedRoute;
  35. }
  36. }
  37. public function __construct()
  38. {
  39. $this->auth = new Auth();
  40. $this->attfile = new attFile();
  41. $this->profile = new Profile();
  42. $this->project = new Project();
  43. $this->contractact = new Contractact();
  44. $this->actmeasure = new actMeasure();
  45. $this->numofperact = new NumofperAct();
  46. $this->measureauditact = new MeasureauditAct();
  47. $this->itemmeasurenum = new ItemMeasureNumpofper();
  48. $this->aconfig = new AConfig();
  49. $this->itemfle = new ItemFile();
  50. $this->att = new attachment();
  51. $this->sign = new Signn();
  52. $this->change = new Changes();
  53. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  54. $this->data['currChannle'] = 'p';
  55. $this->data['user'] = $this->profile->getProWithUid($this->auth->getUid());
  56. $mpidArray = $this->measureauditact->getAuditProject2($this->auth->getUid());
  57. if (isset($mpidArray[0]['pid'])) {
  58. $this->data['numofchecking'] = 0;
  59. foreach ($mpidArray as $key => $value) {
  60. // 审批操作按照时间排序多标段
  61. $this->data['numofchecking'] += $this->measureauditact->getCountMyChecking($value['pid'], $this->auth->getUid());
  62. }
  63. }
  64. if (!isset($this->data['numofchecking']) || $this->data['numofchecking'] == 0) {
  65. $this->data['numofchecking'] = null;
  66. }
  67. $this->data['signSwitch'] = $this->aconfig->getOne(array('select' => 'signswitch', 'asArray' => TRUE))['signswitch'];
  68. //获取需要您签署的数目
  69. if($this->data['signSwitch'] > 0)
  70. $this->data['needSignNum'] = $this->sign->getNeedSignNumbyUid($this->auth->getUid()) != 0 ? $this->sign->getNeedSignNumbyUid($this->auth->getUid()) : '';
  71. //获取桌面版本
  72. $this->getsoftware();
  73. //草图入口
  74. $this->data['imediateSwitch'] = $this->aconfig->getOne(array('select' => 'imediateswitch', 'asArray' => TRUE))['imediateswitch'];
  75. //获取需要你审批的变更令数目
  76. $this->data['needChangeNum'] = $this->change->getNeedChangeNumbyUid($this->auth->getUid()) != 0 ? $this->change->getNeedChangeNumbyUid($this->auth->getUid()) : '';
  77. }
  78. function getsoftware(){
  79. $StrJson = ($this->aconfig->getOne(array('select' => 'upgradeinfo', 'asArray' => TRUE))['upgradeinfo']);
  80. $upgradeinfo = json_decode($StrJson, true);
  81. if ($upgradeinfo) {
  82. $this->data['version'] = $upgradeinfo['version'];
  83. $this->data['download'] = $upgradeinfo['download'];
  84. }
  85. }
  86. /**
  87. *
  88. * @return type
  89. */
  90. public function index()
  91. {
  92. if (isset($_POST['pname']) && $_POST['pname']) {
  93. $this->project->insertProject($this->auth->getUid(), $_POST['pname']);
  94. return Doo::conf()->APP_URL . 'project/index';
  95. }
  96. if (isset($_POST['target_pname']) && $_POST['target_pname'] && isset($_POST['ppid']) && $_POST['ppid']) {
  97. $this->project->updateProName($_POST['ppid'], $_POST['target_pname']);
  98. return Doo::conf()->APP_URL . 'project/index';
  99. }
  100. if (isset($_POST['proid']) && is_numeric($_POST['proid']) && isset($_POST['delpro'])) {
  101. if($this->actmeasure->getMearsureCount($_POST['proid']) == 0){
  102. $this->project->del($_POST['proid']);
  103. //空的标段类型,未上报的审批人列表也要删
  104. $stArr = $this->contractact->getRowByPid($_POST['proid']);
  105. if(!empty($stArr)){
  106. foreach($stArr as $k => $v){
  107. $cont = new Contractact();
  108. $cont->del($v['stid']);
  109. }
  110. }
  111. $this->measureauditact->delAuditUserPyPid($_POST['proid']);
  112. }
  113. return Doo::conf()->APP_URL . 'project/index';
  114. }
  115. $this->data['pros'] = $this->project->getAll($this->auth->getUid());
  116. if (isset($this->data['pros'][0]['pid'])) {
  117. foreach ($this->data['pros'] as $key => $value) {
  118. $this->data['pros'][$key]['index'] = $key%8+1;
  119. $this->data['pros'][$key]['numMeasure'] = $this->actmeasure->getMearsureCount($value['pid']);
  120. $this->data['pros'][$key]['contracttotal'] = $this->actmeasure->getTotalWithPid($value['pid']);
  121. $this->data['pros'][$key]['changTotal'] = $this->numofperact->getChangTotal($value['pid']);
  122. // $this->data['pros'][$key]['contracttotal'] += $this->data['pros'][$key]['changTotal'];
  123. $this->data['pros'][$key]['currdone'] = $this->numofperact->getCurrDoneNow($value['pid']);
  124. if ($this->data['pros'][$key]['contracttotal']) {
  125. $this->data['pros'][$key]['pcurrdone'] = round(($this->data['pros'][$key]['currdone'] / $this->data['pros'][$key]['contracttotal']) * 100) . '%';
  126. } else {
  127. $this->data['pros'][$key]['pcurrdone'] = '0%';
  128. }
  129. $this->data['pros'][$key]['bcontracttotal'] = number_format($this->data['pros'][$key]['contracttotal'], 2, '.', ',');
  130. $this->data['pros'][$key]['bchangTotal'] = number_format($this->data['pros'][$key]['changTotal'], 2, '.', ',');
  131. }
  132. } else {
  133. $this->data['pros'] = [];
  134. }
  135. $this->render('w-project', $this->data, TRUE);
  136. }
  137. public function proOverview()
  138. {
  139. $conArray = $this->contractact->getRowByPid($this->params['pid']);
  140. $this->data['projectDate'] = '';
  141. $this->data['conArray'][] = array();
  142. $this->getFav();
  143. // $this->data['measureArray'] = $this->actmeasure->getRowByPids($this->params['pid']);
  144. // foreach ($this->data['measureArray'] as $key => $value) {
  145. // $this->data['measureArray'][$key]['stopNow'] = $this->numofperact->getStopNow($value['pmid'])['sntotal'];
  146. // $this->data['measureArray'][$key]['pstopnow'] = round(($this->data['measureArray'][$key]['stopNow'] / $value['contracttotal']) * 100);
  147. // }
  148. $this->data['pid'] = $this->params['pid'];
  149. $this->data['conArray'] = $conArray;
  150. $contracttotal = 0;
  151. // 不同标段和值
  152. // $list = $this->numofperact->getStopNowStMonth($v['stid']); //print_r($list);
  153. // if (empty($list))
  154. // $startMonth = date("Y-m");
  155. // else
  156. // $startMonth = $list[0]['month'];
  157. // //$list=Array ( 0 => Array ( 'sntotal' => 20000 ,'month' => '2014-09' ),1 => Array ( 'sntotal' => 40000, 'month' => '2016-10' ) );
  158. // $d = 0;
  159. // $mDList = $mList = array();
  160. // $toMD = date("Y-m");
  161. // foreach ($list as $value) {
  162. // $flag = true;
  163. // do {
  164. // $MD = date("Y-m", strtotime($startMonth . " " . $d . " month")); //echo $MD."/".$value['month']."<br/>";
  165. // array_push($mDList, "'" . $MD . "'");
  166. // array_push($mList, $MD);
  167. //
  168. // if ($MD == $toMD)//if(strtotime($MD)>=strtotime($toMD))
  169. // $flag = false;
  170. // if ($d > 0 && ($MD == $value['month'] || $toMD == $value['month']))
  171. // $flag = false;
  172. // $d++;
  173. //// if ($d==10)
  174. //// $flag=false;
  175. // } while ($flag);
  176. // }
  177. // $this->data['projectDate'] = implode(',', $mDList);
  178. //
  179. // $dataList = array();
  180. // $sntotalTA = 0;
  181. // foreach ($mList as $va) {
  182. // $falg = true;
  183. // foreach ($list as $value) {
  184. // if ($va == $value['month']) {
  185. // $sntotalTA+=$value['sntotal'];
  186. // $PER = round($sntotalTA / $contracttotal, 3) * 100;
  187. // array_push($dataList, $PER);
  188. // $falg = false;
  189. // break;
  190. // }
  191. // }
  192. // if ($falg)
  193. // array_push($dataList, 0);
  194. // }
  195. // $this->data['conArray'][$k]['monthStopnow'] = $dataList;
  196. //
  197. // $list = $this->numofperact->getCurrDoneSMontht($v['stid']);
  198. // $dataList = array();
  199. // $currdoneTA = 0;
  200. // foreach ($mList as $va) {
  201. // $falg = true;
  202. // foreach ($list as $value) {
  203. // if ($va == $value['month']) {
  204. // $currdoneTA+=$value['currdone'];
  205. // $PER = round($currdoneTA / $contracttotal, 3) * 100;
  206. // array_push($dataList, $PER);
  207. // $falg = false;
  208. // break;
  209. // }
  210. // }
  211. // if ($falg)
  212. // array_push($dataList, 0);
  213. // }
  214. // $this->data['conArray'][$k]['monthCurrdone'] = $dataList;
  215. //
  216. $totalstid = 0;
  217. $monthArray = [];
  218. foreach ($this->data['conArray'] as $k => $v) {
  219. $this->data['conArray'][$k]['pstopnow'] = $this->data['conArray'][$k]['pscurrdone'] = 0;
  220. $retval = $this->actmeasure->getAllbyStidSum($v['stid']);
  221. $contracttotal += $retval[0]['contracttotal'];
  222. $totalstid += $this->actmeasure->getTotal($v['stid'])['total'];
  223. $total = $this->actmeasure->getTotal($v['stid'])['total'];
  224. if ($total) {
  225. $this->data['conArray'][$k]['total'] = round($total, 2);
  226. } else {
  227. $this->data['conArray'][$k]['total'] = 0;
  228. }
  229. $sntotal = $this->numofperact->getCountTotalSTID2($v['stid'])['totalplus'];
  230. if ($sntotal) {
  231. $this->data['conArray'][$k]['stopnow'] = round($sntotal, 2);
  232. } else {
  233. $this->data['conArray'][$k]['stopnow'] = 0;
  234. }
  235. $this->data['conArray'][$k]['currdone'] = $this->numofperact->getCurrDoneSt($v['stid'])['currdone'];
  236. if ($this->data['conArray'][$k]['total'] > 0) {
  237. $this->data['conArray'][$k]['pstopnow'] = round(($this->data['conArray'][$k]['stopnow'] / $this->data['conArray'][$k]['total']) * 100);
  238. $this->data['conArray'][$k]['pscurrdone'] = round(($this->data['conArray'][$k]['currdone'] / $this->data['conArray'][$k]['total']) * 100);
  239. }
  240. // 分组出年月 每个月份的独立相加 累计完成总量
  241. $month = $this->numofperact->getCurrTotalStMonthNoCheckno($v['stid']);
  242. foreach ($month as $key => $value) {
  243. $allmonth[] = $value;
  244. if (!in_array($value['month'], $monthArray))
  245. $monthArray[] = $value['month'];
  246. }
  247. // 分组出年月 每个月份的独立相加 本月完成总量
  248. $month1 = $this->numofperact->getCurrDoneStMonthNoCheckno($v['stid']);
  249. foreach ($month1 as $key => $value) {
  250. $allmonth1[] = $value;
  251. }
  252. }
  253. // 中文表述年月
  254. $total = $total1 = array();
  255. $startyear = $cnymArray = array();
  256. foreach ($monthArray as $kk => $vv) {
  257. $ymarray = explode('-', $vv);
  258. if (!in_array($ymarray[0], $startyear))
  259. $startyear[] = $ymarray[0];
  260. // $cnym = '\'' . $ymarray[1] . '月' . '\'';
  261. // if ($kk == 0)
  262. // $cnym = '\'' . $ymarray[0] . '年' . $ymarray[1] . '月' . '\'';
  263. // $cnymArray[] = $cnym;
  264. }
  265. $thismonth = 0;
  266. foreach($startyear as $sk => $sv){
  267. for($i = 1; $i <= 12; $i++){
  268. $j = $i < 10 ? '0'.$i : $i;
  269. $month = $sv.'-'.$j;
  270. $thismonth1 = 0;
  271. foreach ($allmonth1 as $k1 => $v1) {
  272. if ($v1['month'] == $month)
  273. $thismonth1 += $v1['currdone'];
  274. }
  275. $total1[] = $thismonth1 != 0 ? $thismonth1 : 0;
  276. foreach ($allmonth as $keyk => $valuev) {
  277. if ($valuev['month'] == $month)
  278. $thismonth += $valuev['currtotal'];
  279. }
  280. $total[] = ($thismonth != 0 && $thismonth1 != 0) ? $thismonth : 0;
  281. $cnymArray[] = $i == 1 ? '\'' .$sv.'年'.$i.'月'. '\'' : '\'' .$i.'月'. '\'';
  282. }
  283. }
  284. foreach ($total as $value2) {
  285. $total3[] = round(($value2 / $totalstid) * 100);
  286. }
  287. foreach ($total1 as $value11) {
  288. $total4[] = round(($value11 / $totalstid) * 100);
  289. }
  290. $this->data['projectDate'] = implode(',', $cnymArray);
  291. $this->data['t1'] = implode(',', $total3);
  292. $this->data['t2'] = implode(',', $total4);
  293. $this->render('w-project-detail', $this->data, TRUE);
  294. }
  295. public function proSection()
  296. {
  297. if (isset($_POST['stid']) && isset($_POST['proname'])) {
  298. $this->contractact->updateStName($_POST['stid'], $_POST['proname']);
  299. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  300. }
  301. if (isset($_POST['delstid']) && is_numeric($_POST['delstid']) && isset($_POST['delform'])) {
  302. if($this->actmeasure->getCountMeasure($_POST['delstid']) == 0){
  303. $this->contractact->del($_POST['delstid']);
  304. }
  305. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  306. }
  307. $this->getFav();
  308. $contractArray = $this->contractact->getRowByPid($this->params['pid']); // 获取合同段
  309. $htmlstr = NULL;
  310. foreach ($contractArray as $k => $v) {// 获取所有合同段
  311. $retval = $this->actmeasure->getAllbyStid($v['stid']); // 获取标段
  312. $bdhtmlstr = NULL;
  313. $bdhtmlstr = '<thead>
  314. <tr><th class="taC taCble header" width="225">标段名</th><th class="taC" width="140">计量期数</th><th width="115" class="taC">总价</th><th class="taC" width="">截止上期完成/本期完成/未完成</th></tr></thead>
  315. <tbody>';
  316. $biaoduantotalmoney = 0;
  317. $currTotal = 0;
  318. $progress = $otherprogress = '0%';
  319. $currTotal = $this->numofperact->getCountTotalSTID2($v['stid']);
  320. foreach ($retval as $key => $value) {
  321. $displayPercentSnTotalProgress = '0%';
  322. $displayPercentCurrTotalProgress = '0%';
  323. $displayPercentLessTotalProgress = '0%';
  324. $snTotalProgress = $currTotalProgress = $lessTotalProgress = '0%';
  325. $nTotalProgress = $ncurrTotalProgress = $nlessTotalProgress = number_format(0, 2, '.', ',');
  326. $numCount = $this->numofperact->getCountTotalnum2($value['pmid']); // 获取标段已有期数
  327. if (isset($numCount['numpname'])) {
  328. $lastStatusArray = $this->numofperact->getMaxStatusTimes($value['pmid'], $numCount['numpname']);
  329. } else {
  330. $lastStatusArray['currstatus'] = 'uncheck';
  331. $numCount['numpname'] = 0;
  332. }
  333. $totalplus = $this->numofperact->getCountTotalplus($value['pmid']);
  334. $snTotal = $this->numofperact->getStopNowTotal($value['pmid']); //根据标段ID获取最新一期(包括不通过)
  335. $currcomTotal = $this->numofperact->getCurrdoneNew($value['pmid']); //截止目前
  336. $numStatusArray = $this->numofperact->getLastStatus2($this->params['pid'], $value['pmid']);
  337. if ($numCount > 0) {
  338. $nTotalProgress = number_format($snTotal['sntotal'], 2, '.', ',');
  339. $ncurrTotalProgress = number_format($currcomTotal['currtotal'], 2, '.', ',');
  340. $nlessTotalProgress = number_format($value['contracttotal'] - $snTotal['sntotal'] - $currcomTotal['currtotal'], 2, '.', ',');
  341. if (isset($value['contracttotal']) && ($value['contracttotal'] > 0)) {
  342. $snTotalProgress = round(($snTotal['sntotal'] / $value['contracttotal']) * 100);
  343. $currTotalProgress = round(($currcomTotal['currtotal'] / $value['contracttotal']) * 100);
  344. // $lessTotalProgress = round((($value['contracttotal'] - ($currcomTotal['currtotal'] + $snTotal['sntotal'])) / $value['contracttotal']) * 100);
  345. $lessTotalProgress = 100 - $snTotalProgress - $currTotalProgress;
  346. $displayPercentSnTotalProgress = $snTotalProgress . '%';
  347. $displayPercentCurrTotalProgress = $currTotalProgress . '%';
  348. $displayPercentLessTotalProgress = $lessTotalProgress . '%';
  349. }
  350. }
  351. $biaoduantotalmoney += $value['contracttotal'];
  352. $totalmoney = number_format($value['contracttotal'], 2, '.', ',');
  353. if (isset($numStatusArray['currstatus'])) {
  354. $statusStr = '(' . $this->statusArray[$lastStatusArray['currstatus']] . ')';
  355. } else {
  356. $statusStr = '';
  357. }
  358. $displayPercentSnTotalProgresswidth = floatval($displayPercentSnTotalProgress) >= 100 ? '100%' : $displayPercentSnTotalProgress;
  359. $displayPercentCurrTotalProgresswidth = floatval($displayPercentCurrTotalProgress) >= 100 ? '100%' : $displayPercentCurrTotalProgress;
  360. $displayPercentLessTotalProgresswidth = floatval($displayPercentLessTotalProgress) >= 100 ? '100%' : $displayPercentLessTotalProgress;
  361. $bdhtmlstr .= '
  362. <tr>
  363. <td><a href="/project/' . $this->params['pid'] . '/section/' . $value['pmid'] . '/detail">' . $value['pmname'] . '</a></td>
  364. <td class="">第 ' . $numCount['numpname'] . ' 期' . $statusStr . '</td>
  365. <td class="taR">¥' . $totalmoney . '</td>
  366. <td>
  367. <div class="progress">
  368. <div class="progress-bar progress-bar-success" style="width: ' . $displayPercentSnTotalProgresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="截止上期完成:¥' . $nTotalProgress . '">' . $displayPercentSnTotalProgress . '</div>
  369. <div class="progress-bar" style="width:' . $displayPercentCurrTotalProgresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="本期完成:¥' . $ncurrTotalProgress . '">' . $displayPercentCurrTotalProgress . '</div>
  370. <div class="progress-bar progress-bar-gary" style="width:' . $displayPercentLessTotalProgresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $nlessTotalProgress . '">' . $displayPercentLessTotalProgress . '</div>
  371. </div>
  372. </td>
  373. </tr>';
  374. }
  375. $nprogress = $notherprogress = NULL;
  376. // $currTotal = $this->numofperact->getCurrdoneSTID($v['stid']);
  377. if ($biaoduantotalmoney > 0) {
  378. $nprogress = number_format($currTotal['totalplus'], 2, '.', ',');
  379. $notherprogress = number_format($biaoduantotalmoney - $currTotal['totalplus'], 2, '.', ',');
  380. $progress = round(($currTotal['totalplus'] / $biaoduantotalmoney) * 100) . '%'; // 累计完成计量 所有标段合计
  381. $otherprogress = round((($biaoduantotalmoney - $currTotal['totalplus']) / $biaoduantotalmoney) * 100) . '%';
  382. $biaoduantotalmoney = number_format($biaoduantotalmoney, 2, '.', ',');
  383. }
  384. $delstidhtml = $this->actmeasure->getCountMeasure($v['stid']) == 0 ? '<a id="idst_' . $v['stid'] . '" stid="' . $v['stid'] . '" stname="' . $v['stname'] . '" href="#del-confirm-2" data-toggle="modal" title="删除类型">
  385. <span data-icon="U" aria-hidden="true" class="colRed" data-placement="bottom" data-toggle="tooltip" data-original-title="删除类型" style="font-size:18px"></span></a>' : '';
  386. $progresswidth = floatval($progress) >= 100 ? '100%' : $progress;
  387. $otherprogresswidth = floatval($otherprogress) >= 100 ? '100%' : $otherprogress; $htmlstr .= '<div class="project">
  388. <div class="proSection">
  389. <table class="table">
  390. <thead>
  391. <tr>
  392. <td width="150"><span aria-hidden="true" data-icon="u"></span> ' . $v['stname'] . '<a id="idt_' . $v['stid'] . '" href="#secoption" data-toggle="modal" title="编辑/查看KEY" stid="' . $v['stid'] . '" proname="' . $v['stname'] . '" key="' . $v['stkey'] . '"><span data-icon="S" aria-hidden="true" class="closePanel" data-placement="bottom" data-toggle="tooltip" data-original-title="查看KEY" style="font-size:18px"></span></a>' .$delstidhtml. '</td>
  393. <td width="90">总价:</td><td width="165">¥<b style="font-size:16px">' . $biaoduantotalmoney . '</b></td>
  394. <td width="60">完成进度:</td><td><div class="progress">
  395. <div class="progress-bar progress-bar-success" style="width:' . $progresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="累计完成:¥' . $nprogress . '">' . $progress . '</div>
  396. <div class="progress-bar progress-bar-danger" style="width:' . $otherprogresswidth . ';" data-placement="bottom" data-toggle="tooltip" data-original-title="未完成:¥' . $notherprogress . '">' . $otherprogress . '</div>
  397. </div></td>
  398. </tr>
  399. </thead>
  400. </table>
  401. <table class="table table-striped table-hover tablelist">
  402. ' . $bdhtmlstr . '
  403. </tbody>
  404. </table>
  405. </div>
  406. </div>';
  407. }
  408. $this->data['htmlstr'] = $htmlstr;
  409. if (isset($_POST['secname']) && $_POST['secname']) {
  410. $this->contractact->insertContract($this->params['pid'], $this->auth->getUid(), $_POST['secname']);
  411. return Doo::conf()->APP_URL . 'project/' . $this->params['pid'] . '/section';
  412. }
  413. $this->data['pid'] = $this->params['pid'];
  414. $this->render('w-project-section', $this->data, TRUE);
  415. }
  416. function proSectionFiles()
  417. {
  418. if (isset($_POST['optype']) && ($_POST['optype'] == 'replace') && ($_POST['imnid'])) {
  419. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  420. if ($imnidArray['iaid'] > 0) {
  421. $fileArray = $this->upItemFile('file')[0];
  422. if (isset($fileArray['filepath'])) {
  423. $itemArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  424. if (isset($itemArray)) {
  425. if ($itemArray['oldiaid'] > 0) {
  426. $oldiaid = $itemArray['oldiaid'];
  427. } else {
  428. $oldiaid = $imnidArray['iaid'];
  429. }
  430. $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);
  431. $iaid = $this->itemfle->insertItemFileRecord($postArray);
  432. if ($iaid > 1) {
  433. $this->itemmeasurenum->updateIAID($imnidArray['iaid'], $iaid);
  434. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  435. die();
  436. }
  437. }
  438. }
  439. }
  440. }
  441. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  442. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  443. if ($imnidArray['iaid'] > 0) {
  444. $this->itemmeasurenum->updateDeltag($_POST['imnid'], $this->auth->getUid());
  445. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  446. die();
  447. }
  448. }
  449. if (isset($_POST['filename']) && isset($_POST['filedesc']) && isset($_POST['upimnid'])) {
  450. $filename = $_POST['filename'];
  451. $filedesc = $_POST['filedesc'];
  452. $imnidArray = $this->itemmeasurenum->getRowData($_POST['upimnid']);
  453. if ($imnidArray['iaid'] > 0) {
  454. if (isset($filedesc))
  455. $this->itemmeasurenum->updateItemFields($_POST['upimnid'], $filedesc, 0);
  456. if (isset($filename))
  457. $this->itemfle->updateItemFields($imnidArray['iaid'], $filename, 0);
  458. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  459. die();
  460. }
  461. }
  462. // 面包屑导航项目
  463. // $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  464. // $this->data['pmid'] = $this->params['pmid'];
  465. // $allproArray = $this->project->getAll();
  466. // foreach ($allproArray as $kk => $vv) {
  467. // if ($vv['pid'] == $this->params['pid']) {
  468. // $this->data['currproArray'] = $vv;
  469. // } else {
  470. // $this->data['allproArray'][] = $vv;
  471. // }
  472. // }
  473. $this->getFav();
  474. // 面包屑导航合同
  475. $conArray = $this->contractact->getAll();
  476. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  477. if (isset($measureArray['stid'])) {
  478. foreach ($conArray as $kkk => $vvv) {
  479. if ($vvv['stid'] == $measureArray['stid']) {
  480. $this->data['currconArray'] = $vvv;
  481. } else {
  482. if ($vvv['pid'] == $this->params['pid'])
  483. $this->data['allconArray'][] = $vvv;
  484. }
  485. }
  486. } else {
  487. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  488. }
  489. // 面包屑导航标段
  490. $this->data['curractmeasureArray'] = NULL;
  491. $this->data['allactmeasureArray'] = [];
  492. $actmeasureArray = $this->actmeasure->getAll();
  493. foreach ($actmeasureArray as $kkkk => $vvvv) {
  494. if ($vvvv['stid'] == $measureArray['stid']) {
  495. if (($vvvv['pmid'] == $this->params['pmid'])) {
  496. $this->data['curractmeasureArray'] = $vvvv;
  497. } else {
  498. $this->data['allactmeasureArray'][] = $vvvv;
  499. }
  500. }
  501. }
  502. // 选取查询
  503. $groupArray = $this->numofperact->getGroupByLastOne2($this->params['pmid']);
  504. $this->data['groupArray'] = $groupArray;
  505. $owneridArray = $this->itemfle->getGroupOwnerid($this->params['pmid']);
  506. foreach ($owneridArray as $k => $v) {
  507. $this->data['owneridArray'][$k]['name'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  508. $this->data['owneridArray'][$k]['iaid'] = $v['iaid'];
  509. $this->data['owneridArray'][$k]['ownerid'] = $v['ownerid'];
  510. }
  511. // 分页
  512. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid'], 0, $this->params['numpname'], $this->params['userid']);
  513. if ($totalArchive) {
  514. if ($this->params['numpname'] && $this->params['userid']) {
  515. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  516. } elseif ($this->params['numpname']) {
  517. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/num/' . $this->params['numpname'] . '/page', $totalArchive, 20, 100);
  518. } elseif ($this->params['userid']) {
  519. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/user/' . $this->params['userid'] . '/page', $totalArchive, 20, 100);
  520. } else {
  521. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/page', $totalArchive, 20, 100);
  522. }
  523. $pager->setCss('', 'disabled', 'active');
  524. if (isset($this->params['pindex']))
  525. $pager->paginate(intval($this->params['pindex']));
  526. else
  527. $pager->paginate(1);
  528. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNum($this->params['pmid'], $pager->limit, $this->params['numpname'], $this->params['userid']);
  529. }
  530. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  531. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  532. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  533. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  534. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  535. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  536. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  537. }
  538. $this->data['pid'] = $this->params['pid'];
  539. $this->data['pmid'] = $this->params['pmid'];
  540. $this->data['mpid'] = $this->params['mpid'];
  541. $this->data['userid'] = $this->params['userid'];
  542. $this->data['num'] = $this->params['numpname'];
  543. $this->data['pager'] = $pager->output;
  544. $this->render('w-project-section-files', $this->data, TRUE);
  545. }
  546. function proSectionFilesRecover()
  547. {
  548. if (isset($_POST['optype']) && ($_POST['optype'] == 'reconvery') && isset($_POST['imnid'])) {
  549. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  550. if ($imnidArray['iaid'] > 0) {
  551. $this->itemmeasurenum->recoveryDel($_POST['imnid']);
  552. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  553. die();
  554. }
  555. }
  556. if (isset($_POST['optype']) && ($_POST['optype'] == 'del') && isset($_POST['imnid'])) {
  557. $imnidArray = $this->itemmeasurenum->getRowData($_POST['imnid']);
  558. if ($imnidArray['iaid'] > 0) {
  559. $iaidArray = $this->itemfle->getItemFile($imnidArray['iaid']);
  560. if ($iaidArray['ownerid'] == $this->auth->getUid()) {
  561. $this->itemfle->delItem($imnidArray['iaid']);
  562. $this->itemmeasurenum->delItemIAID($imnidArray['iaid']);
  563. echo json_encode(array('status' => 1), JSON_UNESCAPED_UNICODE);
  564. die();
  565. } else {
  566. echo json_encode(array('status' => 2), JSON_UNESCAPED_UNICODE);
  567. die();
  568. }
  569. }
  570. }
  571. // 面包屑导航项目
  572. // $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  573. // $this->data['pmid'] = $this->params['pmid'];
  574. // $allproArray = $this->project->getAll();
  575. // foreach ($allproArray as $kk => $vv) {
  576. // if ($vv['pid'] == $this->params['pid']) {
  577. // $this->data['currproArray'] = $vv;
  578. // } else {
  579. // $this->data['allproArray'][] = $vv;
  580. // }
  581. // }
  582. $this->getFav();
  583. // 面包屑导航合同
  584. $conArray = $this->contractact->getAll();
  585. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  586. if (isset($measureArray['stid'])) {
  587. foreach ($conArray as $kkk => $vvv) {
  588. if ($vvv['stid'] == $measureArray['stid']) {
  589. $this->data['currconArray'] = $vvv;
  590. } else {
  591. if ($vvv['pid'] == $this->params['pid'])
  592. $this->data['allconArray'][] = $vvv;
  593. }
  594. }
  595. } else {
  596. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  597. }
  598. // 面包屑导航标段
  599. $this->data['curractmeasureArray'] = NULL;
  600. $this->data['allactmeasureArray'] = [];
  601. $actmeasureArray = $this->actmeasure->getAll();
  602. foreach ($actmeasureArray as $kkkk => $vvvv) {
  603. if ($vvvv['stid'] == $measureArray['stid']) {
  604. if (($vvvv['pmid'] == $this->params['pmid'])) {
  605. $this->data['curractmeasureArray'] = $vvvv;
  606. } else {
  607. $this->data['allactmeasureArray'][] = $vvvv;
  608. }
  609. }
  610. }
  611. $totalArchive = $this->itemmeasurenum->getCount($this->params['pmid']);
  612. if ($totalArchive) {
  613. $pager = new DooPager(Doo::conf()->APP_URL . 'project/' . $this->params['pmid'] . '/section/' . $this->params['pmid'] . '/files/recover/page', $totalArchive, 20, 100);
  614. $pager->setCss('', 'disabled', 'active');
  615. if (isset($this->params['pindex']))
  616. $pager->paginate(intval($this->params['pindex']));
  617. else
  618. $pager->paginate(1);
  619. $this->data['itemMeasureArray'] = $this->itemmeasurenum->getItemMeasureNumDel($pager->limit, $this->params['pmid']);
  620. }
  621. foreach ($this->data['itemMeasureArray'] as $k => $v) {
  622. $fileArray = $this->itemfle->getItemFile($v['iaid']);
  623. $this->data['itemMeasureArray'][$k]['realname'] = $this->profile->getProWithUid($v['ownerid'])['name'];
  624. $this->data['itemMeasureArray'][$k]['delname'] = $this->profile->getProWithUid($v['deluid'])['name'];
  625. $this->data['itemMeasureArray'][$k]['pmname'] = $this->actmeasure->getRowByPmid($v['pmid'])['pmname'];
  626. $this->data['itemMeasureArray'][$k]['filename'] = $fileArray['filename'];
  627. $this->data['itemMeasureArray'][$k]['fileext'] = $fileArray['fileext'];
  628. $this->data['itemMeasureArray'][$k]['tips'] = $v['tips'];
  629. $this->data['itemMeasureArray'][$k]['filepath'] = $fileArray['filepath'];
  630. }
  631. $this->data['pid'] = $this->params['pid'];
  632. $this->data['pmid'] = $this->params['pmid'];
  633. $this->data['mpid'] = $this->params['mpid'];
  634. $this->data['pager'] = $pager->output;
  635. $this->render('w-project-section-files-recover', $this->data, TRUE);
  636. }
  637. /**
  638. * @return actMeasure
  639. */
  640. public function proSectionGetFiles()
  641. {
  642. $attaArray = $this->itemfle->getItemFile($this->params['iaid']);
  643. $this->file_down($attaArray['filepath'], $attaArray['filesize'], $attaArray['filename'] . '.' . $attaArray['fileext']);
  644. return;
  645. }
  646. function getItemFileHistory()
  647. {
  648. if ($this->params['iaid']) {
  649. $iaidArray = $this->itemfle->getItemFile($this->params['iaid']);
  650. if ($iaidArray['oldiaid'] > 0) {
  651. $oldiaidArray = $this->itemfle->getFileHistory($iaidArray['oldiaid']);
  652. $htmlstr = '';
  653. foreach ($oldiaidArray as $k => $v) {
  654. $countInt = $k + 1;
  655. $formatDate = date('Y-m-d H:i:s', $v['intime']);
  656. $profileArray = $this->profile->getProWithUid($v['ownerid']);
  657. $htmlstr .= '<div class="media"><div class="pull-left"><h4>#' . $countInt . '</h4></div><div class="media-body"><h5>' . $profileArray['name'] . '&nbsp;上传于 ' . $formatDate . '</h5><a href="/' . $v['filepath'] . '" target="_blank">' . $v['filename'] . '</a></div></div>';
  658. }
  659. echo json_encode(array('html' => $htmlstr), JSON_UNESCAPED_UNICODE);
  660. die();
  661. }
  662. }
  663. }
  664. Function fNumber($number)
  665. {
  666. if ($number == '')
  667. Return "-";
  668. $nlen = strlen($number);
  669. while ($nlen > 3) {
  670. $fNumber = "," . substr($number, $nlen - 3, 3);
  671. $number = substr($number, 0, -3);
  672. $nlen = strlen($number);
  673. }
  674. if ($nlen <= 3) {
  675. $fNumber = $number . $fNumber;
  676. }
  677. Return $fNumber;
  678. }
  679. private function getFav()
  680. {
  681. $proArray = $this->project->getAll($this->auth->getUid());
  682. $this->data['othrPro'] = [];
  683. foreach ($proArray as $key => $value) {
  684. if ($value['pid'] == $this->params['pid']) {
  685. $this->data['currProName'] = $value['pname'];
  686. $this->data['currProID'] = $value['pid'];
  687. } else {
  688. $this->data['othrPro'][] = $proArray[$key];
  689. }
  690. }
  691. }
  692. public function proSectionMeasure()
  693. {
  694. //此处未做更改,JSON文件已经固定名称
  695. $jsonpath = pathinfo($this->attfile->getMaxRow()['filepath']);
  696. if (isset($jsonpath['dirname'])) {
  697. $extPathdir = Doo::conf()->SITE_PATH . $jsonpath['dirname'] . '/' . $jsonpath['filename'];
  698. if ($handle = opendir($extPathdir)) {
  699. while (false !== ($file = readdir($handle))) {
  700. $filename = NULL;
  701. $filename = pathinfo($file);
  702. if ($filename['extension'] == 'json')
  703. $proArray = json_decode(file_get_contents($extPathdir . '/' . $file), TRUE, JSON_UNESCAPED_UNICODE);
  704. }
  705. closedir($handle);
  706. }
  707. $this->data['proArray'] = $proArray['Bills'];
  708. } else {
  709. $this->data['proArray'] = [];
  710. }
  711. $this->data['mpid'] = $this->params['mpid'];
  712. $this->data['pid'] = $this->params['pid'];
  713. $this->render('w-project-section-measure', $this->data, TRUE);
  714. }
  715. public function substr_replace_cn($string, $repalce = '*', $start = 0, $len = 0)
  716. {
  717. $count = mb_strlen($string, 'UTF-8'); //此处传入编码,建议使用utf-8。此处编码要与下面mb_substr()所使用的一致
  718. if (!$count) {
  719. return $string;
  720. }
  721. if ($len == 0) {
  722. $end = $count; //传入0则替换到最后
  723. } else {
  724. $end = $start + $len; //传入指定长度则为开始长度+指定长度
  725. }
  726. $i = 0;
  727. $returnString = '';
  728. while ($i < $count) { //循环该字符串
  729. $tmpString = mb_substr($string, $i, 1, 'UTF-8'); // 与mb_strlen编码一致
  730. if ($start <= $i && $i < $end) {
  731. $returnString .= $repalce;
  732. } else {
  733. $returnString .= $tmpString;
  734. }
  735. $i++;
  736. }
  737. return $returnString;
  738. }
  739. function unicode_encode($name)
  740. {//to Unicode
  741. $name = iconv('UTF-8', 'UCS-2', $name);
  742. $len = strlen($name);
  743. $str = '';
  744. for ($i = 0; $i < $len - 1; $i = $i + 2) {
  745. $c = $name[$i];
  746. $c2 = $name[$i + 1];
  747. if (ord($c) > 0) {// 两个字节的字
  748. $str .= '\\' . base_convert(ord($c), 10, 16) . base_convert(ord($c2), 10, 16);
  749. } else {
  750. $str .= $c2;
  751. }
  752. }
  753. $str = strtoupper($str);
  754. return $str;
  755. }
  756. function unicode_decode($name)
  757. {//Unicode to
  758. $pattern = '/([\w]+)|(\\\u([\w]{4}))/i';
  759. preg_match_all($pattern, $name, $matches);
  760. if (!empty($matches)) {
  761. $name = '';
  762. for ($j = 0; $j < count($matches[0]); $j++) {
  763. $str = $matches[0][$j];
  764. if (strpos($str, '\\u') === 0) {
  765. $code = base_convert(substr($str, 2, 2), 16, 10);
  766. $code2 = base_convert(substr($str, 4), 16, 10);
  767. $c = chr($code) . chr($code2);
  768. $c = iconv('UCS-2', 'UTF-8', $c);
  769. $name .= $c;
  770. } else {
  771. $name .= $str;
  772. }
  773. }
  774. }
  775. return $name;
  776. }
  777. public function proDetail()
  778. {
  779. // 面包屑导航项目
  780. // $this->data['currproArray'] = $this->data['allproArray'] = NULL;
  781. // $this->data['pmid'] = $this->params['pmid'];
  782. // $allproArray = $this->project->getAll();
  783. // foreach ($allproArray as $kk => $vv) {
  784. // if ($vv['pid'] == $this->params['pid']) {
  785. // $this->data['currproArray'] = $vv;
  786. // } else {
  787. // $this->data['allproArray'][] = $vv;
  788. // }
  789. // }
  790. $this->getFav();
  791. // 面包屑导航合同
  792. $conArray = $this->contractact->getAll();
  793. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  794. if (isset($measureArray['stid'])) {
  795. foreach ($conArray as $kkk => $vvv) {
  796. if ($vvv['stid'] == $measureArray['stid']) {
  797. $this->data['currconArray'] = $vvv;
  798. } else {
  799. if ($vvv['pid'] == $this->params['pid'])
  800. $this->data['allconArray'][] = $vvv;
  801. }
  802. }
  803. } else {
  804. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  805. }
  806. // 面包屑导航标段
  807. $this->data['curractmeasureArray'] = NULL;
  808. $this->data['allactmeasureArray'] = [];
  809. $actmeasureArray = $this->actmeasure->getAll();
  810. foreach ($actmeasureArray as $kkkk => $vvvv) {
  811. if ($vvvv['stid'] == $measureArray['stid']) {
  812. if (($vvvv['pmid'] == $this->params['pmid'])) {
  813. $this->data['curractmeasureArray'] = $vvvv;
  814. } else {
  815. $this->data['allactmeasureArray'][] = $vvvv;
  816. }
  817. }
  818. }
  819. // 图表
  820. $this->data['MeasureArray'] = $this->numofperact->getGroupByLastOne($this->params['pmid']);
  821. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  822. foreach ($this->data['MeasureArray'] as $key => $value) {
  823. if ($measureArray['contracttotal'] > $value['currdone'] && $value['currdone'] > 0) {
  824. $this->data['MeasureArray'][$key]['lessTotal'] = round(($value['currdone'] / $measureArray['contracttotal']) * 100);
  825. } else {
  826. $this->data['MeasureArray'][$key]['lessTotal'] = 0;
  827. }
  828. }
  829. $this->data['pmid'] = $this->params['pmid'];
  830. $this->data['pid'] = $this->params['pid'];
  831. $this->render('w-project-section-detail', $this->data, TRUE);
  832. }
  833. public function welcome()
  834. {
  835. // if (!$this->auth->isLoggedIn())
  836. // return Doo::conf()->APP_URL;
  837. if ($this->profile->getProWithUid($this->auth->getUid())['userid'])
  838. return Doo::conf()->APP_URL . 'project/list';
  839. if (isset($_POST['welform'])) {
  840. $profileUserArray = $_POST;
  841. $profileUserArray['userid'] = $this->auth->getUid();
  842. $this->profile->insertProfile($profileUserArray); // 无自增字段返回0
  843. return Doo::conf()->APP_URL . 'project/list';
  844. }
  845. $this->render('welcome', $this->data);
  846. }
  847. // ajax提取密码名称
  848. public function getAjaxSection()
  849. {
  850. if (!$this->isAjax())
  851. return;
  852. echo json_encode($_POST);
  853. }
  854. function upItemFile($fildname, $param = 'doc, docx, xls, xlsx, png, zip')
  855. {
  856. $this->att->setUploadDir();
  857. return $this->att->uploadMut($fildname, $param);
  858. }
  859. /**
  860. * 文件下载
  861. * @param $filepath 文件路径
  862. * @param $filename 文件名称
  863. */
  864. function file_down($filepath, $filesize, $filename = '')
  865. {
  866. if (!$filename)
  867. $filename = basename($filepath);
  868. if ($this->is_ie())
  869. $filename = rawurlencode($filename);
  870. $filetype = $this->fileext($filename);
  871. // $filesize = sprintf("%u", filesize($filepath));
  872. if (ob_get_length() !== false)
  873. @ob_end_clean();
  874. header('Pragma: public');
  875. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  876. header('Cache-Control: no-store, no-cache, must-revalidate');
  877. header('Cache-Control: pre-check=0, post-check=0, max-age=0');
  878. header('Content-Transfer-Encoding: binary');
  879. header('Content-Encoding: none');
  880. header('Content-type: ' . $filetype);
  881. header('Content-Disposition: attachment; filename="' . $filename . '"');
  882. header('Content-length: ' . $filesize);
  883. @readfile($filepath);
  884. exit;
  885. }
  886. /**
  887. * IE浏览器判断
  888. */
  889. function is_ie()
  890. {
  891. $useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
  892. if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false))
  893. return false;
  894. if (strpos($useragent, 'msie ') !== false)
  895. return true;
  896. return false;
  897. }
  898. /**
  899. * 取得文件扩展
  900. *
  901. * @param $filename 文件名
  902. * @return 扩展名
  903. */
  904. function fileext($filename)
  905. {
  906. return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
  907. }
  908. /*
  909. *
  910. * 中间计量表草图列表
  911. */
  912. public function proSectionInterMediate(){
  913. //草图功能开关控制
  914. if($this->data['imediateSwitch'] == 0){
  915. exit('中间计量表草图添加功能未启用...');
  916. }
  917. // 面包屑导航项目
  918. $this->getFav();
  919. // 面包屑导航合同
  920. $conArray = $this->contractact->getAll();
  921. $measureArray = $this->actmeasure->getRowByPmid($this->params['pmid']);
  922. if (isset($measureArray['stid'])) {
  923. foreach ($conArray as $kkk => $vvv) {
  924. if ($vvv['stid'] == $measureArray['stid']) {
  925. $this->data['currconArray'] = $vvv;
  926. } else {
  927. if ($vvv['pid'] == $this->params['pid'])
  928. $this->data['allconArray'][] = $vvv;
  929. }
  930. }
  931. } else {
  932. $this->data['currconArray'] = $this->data['allconArray'] = NULL;
  933. }
  934. // 面包屑导航标段
  935. // 面包屑导航标段
  936. $this->data['curractmeasureArray'] = NULL;
  937. $this->data['allactmeasureArray'] = [];
  938. $actmeasureArray = $this->actmeasure->getAll();
  939. foreach ($actmeasureArray as $kkkk => $vvvv) {
  940. if ($vvvv['stid'] == $measureArray['stid']) {
  941. if (($vvvv['pmid'] == $this->params['pmid'])) {
  942. $this->data['curractmeasureArray'] = $vvvv;
  943. } else {
  944. $this->data['allactmeasureArray'][] = $vvvv;
  945. }
  946. }
  947. }
  948. Doo::loadHelper('DooPager');
  949. $pagestr = '';
  950. $sqlstr = ' 1';
  951. // $this->data['project'] = '';
  952. // $this->data['tender'] = '';
  953. $this->data['phaseno'] = '';
  954. $this->data['nosign'] = '';
  955. //获取项目信息
  956. $searchsql = 'isinter=3';
  957. // $itemlist = $this->sign->getSignGroupByProject($searchsql);
  958. // if(!empty($itemlist)){
  959. // foreach($itemlist as $ik => $iv){
  960. // $itemmsg = $this->project->getRowByPid($iv['project']);
  961. // $itemlist[$ik]['pname'] = $itemmsg['pname'];
  962. // }
  963. // }
  964. if(isset($this->params['pid']) && is_numeric($this->params['pid'])){
  965. $pagestr .= '/'.$this->params['pid'];
  966. $sqlstr .= ' and project='.$this->params['pid'];
  967. //获取标段信息
  968. // $tenderlist = $this->sign->getSignGroupByTender($this->params['pid'],$searchsql);
  969. // if(!empty($tenderlist)){
  970. // foreach($tenderlist as $tk => $tv){
  971. // $tendermsg = $this->actmeasure->getRowByPmid($tv['tender']);
  972. // $tenderlist[$tk]['pmname'] = $tendermsg['pmname'];
  973. // }
  974. // }
  975. if(isset($this->params['pmid']) && is_numeric($this->params['pmid'])){
  976. $pagestr .= '/section/'.$this->params['pmid'];
  977. $sqlstr .= ' and tender='.$this->params['pmid'];
  978. //获取期数信息
  979. $phasenolist = $this->sign->getSignGroupByPhaseno($this->params['pmid'],$searchsql);
  980. if(!empty($phasenolist)){
  981. foreach($phasenolist as $pk => $pv){
  982. $phasenolist[$pk]['numpname'] = $pv['phaseno'];
  983. }
  984. }
  985. if(isset($this->params['mpid']) && is_numeric($this->params['mpid'])){
  986. $this->data['phaseno'] = $this->params['mpid'];
  987. $pagestr .= '/phaseno/'.$this->params['mpid'];
  988. $sqlstr .= ' and phaseno='.$this->params['mpid'];
  989. }
  990. }
  991. }
  992. $totalArchive = $this->sign->getSignNum($sqlstr.' and '.$searchsql);
  993. $pager = new DooPager(Doo::conf()->APP_URL . 'project'.$pagestr.'/intermediate/page', $totalArchive, 10, 100);
  994. $pager->setCss('', 'disabled', 'active');
  995. if (isset($this->params['pindex']))
  996. $pager->paginate(intval($this->params['pindex']));
  997. else
  998. $pager->paginate(1);
  999. if ($pager->limit != ' -10,10')
  1000. $list = $this->sign->getSignList($sqlstr.' and '.$searchsql,$pager->limit);
  1001. if(isset($list) && !empty($list)){
  1002. foreach($list as $k => $v){
  1003. //获取项目名,标段名,标段期数
  1004. $project = $this->project->getRowByPid($v['project']);
  1005. $tender = $this->actmeasure->getRowByPmid($v['tender']);
  1006. // $phaseno = $this->numofperact->getCurrStatus($v['phaseno']);
  1007. $list[$k]['project'] = $project['pname'];
  1008. $list[$k]['tender'] = $tender['pmname'];
  1009. // $list[$k]['phaseno'] = $phaseno['numpname'];
  1010. $list[$k]['ownname'] = $this->auth->getName($v['ownuid']);
  1011. $list[$k]['auditname'] = $this->auth->getName($v['audituid']);
  1012. }
  1013. }
  1014. $this->data['list'] = isset($list) ? $list : '';
  1015. // $this->data['itemlist'] = $itemlist;
  1016. // $this->data['tenderlist'] = isset($tenderlist) ? $tenderlist : '';
  1017. $this->data['phasenolist'] = isset($phasenolist) ? $phasenolist : '';
  1018. $this->data['pager'] = $pager->output;
  1019. $this->data['pid'] = $this->params['pid'];
  1020. $this->data['pmid'] = $this->params['pmid'];
  1021. $this->render('w-project-section-intermediate', $this->data, TRUE);
  1022. }
  1023. /**
  1024. *
  1025. * 中间计量表视图
  1026. */
  1027. public function signView()
  1028. {
  1029. //草图功能开关控制
  1030. if($this->data['imediateSwitch'] == 0){
  1031. exit('中间计量表草图添加功能未启用...');die;
  1032. }
  1033. if(!isset($this->params['sid']) || !is_numeric($this->params['sid'])){
  1034. exit('没有报表参数');
  1035. }
  1036. //获取报表信息
  1037. $signmsg = $this->sign->getOneSignbysid($this->params['sid']);
  1038. if(empty($signmsg) || $signmsg['isinter'] != 3){
  1039. exit('不存在此中间计量表');
  1040. }
  1041. $backurl = '/project/'.$signmsg['project'].'/section/'.$signmsg['tender'].'/intermediate';
  1042. //获取项目名,标段名,标段期数
  1043. $project = $this->project->getRowByPid($signmsg['project']);
  1044. $tender = $this->actmeasure->getRowByPmid($signmsg['tender']);
  1045. // $phaseno = $this->numofperact->getCurrStatus($signmsg['phaseno']);
  1046. $signmsg['project'] = $project['pname'];
  1047. $signmsg['tender'] = $tender['pmname'];
  1048. // $signmsg['phaseno'] = $phaseno['numpname'];
  1049. //获取签署人列表
  1050. $signauditlist = $this->sign->getSignAuditList($this->params['sid']);
  1051. if(!empty($signauditlist)){
  1052. foreach($signauditlist as $k => $v){
  1053. //获取签署人头像
  1054. $signauditlist[$k]['index'] = $k+1;
  1055. $signauditlist[$k]['avatar'] = $this->auth->getAvatar($v['audituid']);
  1056. }
  1057. }
  1058. //获取报表图片
  1059. $maxwidth = 794; //默认图片最大宽度 a4
  1060. $maxheight = 1123; //默认图片最大高度 a4
  1061. if(!empty($signmsg['widhei'])){
  1062. $widhei = explode('_', $signmsg['widhei']);
  1063. $style = $widhei[0].'mm '.$widhei[1].'mm';
  1064. }else{
  1065. $style = '210mm 297mm';
  1066. }
  1067. $signattlist = $this->sign->getSignAttList($this->params['sid']);
  1068. if(!empty($signattlist)){
  1069. foreach($signattlist as $sak => $sav){
  1070. $signattlist[$sak]['auditatt'] = $this->sign->getSignAuditAttList($sav['said']);
  1071. if($sak == 0){
  1072. $imgmsg = getimagesize(Doo::conf()->APP_URL.$sav['filepath']);
  1073. $maxwidth = $imgmsg[0];
  1074. $maxheight = $imgmsg[1];
  1075. }
  1076. }
  1077. }
  1078. $this->data['signmsg'] = $signmsg;
  1079. $this->data['auditlist'] = $signauditlist;
  1080. $this->data['attlist'] = $signattlist;
  1081. $this->data['backurl'] = $backurl;
  1082. $this->data['maxwidth'] = $maxwidth;
  1083. $this->data['maxheight'] = $maxheight;
  1084. $this->data['style'] = $style;
  1085. $this->render('sign-view-page', $this->data, TRUE);
  1086. }
  1087. }
  1088. ?>