worksummary.html.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <style>
  2. .priWidth{width:30px !important; padding: 8px !important;}
  3. <?php if($app->getClientLang() == 'zh-cn' || $app->getClientLang() == 'zh-tw'):?>
  4. .userWidth{width:70px !important;}
  5. .dateWidth{width:80px !important; padding: 8px !important;}
  6. .delayWidth{width:80px !important;}
  7. .estWidth{width:65px !important; padding: 8px !important}
  8. .taskConsumedWidth{width:85px !important;}
  9. .taskTotalWidth{width:65px !important; padding: 8px !important;}
  10. .projectConsumedWidth{width:80px !important; padding: 8px !important;}
  11. .userConsumedWidth{width:80px !important; padding: 8px !important;}
  12. <?php else:?>
  13. .userWidth{width:80px !important;}
  14. .dateWidth{width:110px !important; padding: 8px !important;}
  15. .delayWidth{width:80px !important;}
  16. .estWidth{width:80px !important; padding: 8px !important;}
  17. .taskConsumedWidth{width:110px !important;}
  18. .taskTotalWidth{width:80px !important; padding: 8px !important;}
  19. .projectConsumedWidth{width:120px !important; padding: 8px !important;}
  20. .userConsumedWidth{width:110px !important; padding: 8px !important;}
  21. <?php endif;?>
  22. </style>
  23. <div class='flex bg-canvas p-2 gap-3' id='conditions'>
  24. <div class='input-group w-1/4'>
  25. <span class='input-group-addon'><?php echo $lang->pivot->dept;?></span>
  26. <?php echo html::select('dept', $depts, $dept, "class='form-control chosen' onchange='changeParams()'");?>
  27. </div>
  28. <div class='input-group w-1/2'>
  29. <span class='input-group-addon'><?php echo $lang->pivot->taskFinishedDate;?></span>
  30. <div id='beginPicker' zui-create zui-create-datepicker="{defaultValue: '<?php echo $begin;?>', onChange: (e) => changeParams()}" ></div>
  31. <span class='input-group-addon'><?php echo $lang->pivot->to;?></span>
  32. <div id='endPicker' zui-create zui-create-datepicker="{defaultValue: '<?php echo $end;?>', onChange: (e) => changeParams()}"></div>
  33. </div>
  34. </div>
  35. <?php if(empty($userTasks)):?>
  36. <div class="cell bg-canvas">
  37. <div class="dtable-empty-tip">
  38. <p><span class="text-muted"><?php echo $lang->error->noData;?></span></p>
  39. </div>
  40. </div>
  41. <?php else:?>
  42. <?php global $config;?>
  43. <div class='cell'>
  44. <div class='panel rounded ring-0 bg-canvas'>
  45. <div class="panel-heading">
  46. <div class="panel-title"><?php echo $title;?></div>
  47. </div>
  48. <div class='panel-body pt-0'>
  49. <div class='table-responsive' data-ride='table'>
  50. <table class='table table-condensed table-striped table-bordered table-fixed' id="worksummary">
  51. <thead>
  52. <tr class='colhead text-center bg-canvas'>
  53. <th class="userWidth border"><?php echo $lang->task->finishedByAB;?></th>
  54. <?php if($config->systemMode == 'ALM'):?>
  55. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-20';?>"><?php echo $lang->task->project;?></th>
  56. <?php endif;?>
  57. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-20';?>"><?php echo $lang->task->execution;?></th>
  58. <th class="border w-12"><?php echo $lang->task->id;?></th>
  59. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-20';?>"><?php echo $lang->task->name;?></th>
  60. <th class="border priWidth"><?php echo $lang->priAB;?></th>
  61. <th class="border dateWidth"><?php echo $lang->task->estStarted;?></th>
  62. <th class="border dateWidth"><?php echo $lang->task->realStarted;?></th>
  63. <th class="border dateWidth"><?php echo $lang->task->deadline;?></th>
  64. <th class="border dateWidth"><?php echo $lang->task->finishedDate;?></th>
  65. <th class="border delayWidth"><?php echo $lang->pivot->delay . '(' . $lang->pivot->day . ')';?></th>
  66. <th class="border estWidth"><?php echo $lang->task->estimate;?></th>
  67. <th class="border <?php echo common::checkNotCN() ? 'w-28' : 'w-24';?>"><?php echo $lang->pivot->taskConsumed;?></th>
  68. <th class="border taskTotalWidth"><?php echo $lang->pivot->taskTotal;?></th>
  69. <th class="border projectConsumedWidth"><?php echo $lang->pivot->executionConsumed;?></th>
  70. <th class="border userConsumedWidth"><?php echo $lang->pivot->userConsumed;?></th>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <?php $color = false;?>
  75. <?php $i = 0;?>
  76. <?php foreach($userTasks as $user => $projectTaskGroup):?>
  77. <?php
  78. if(!isset($users[$user])) continue;
  79. $taskTotal = $totalConsumed = 0;
  80. $executionConsumed = array();
  81. foreach($projectTaskGroup as $executionTasks)
  82. {
  83. foreach($executionTasks as $tasks)
  84. {
  85. $taskTotal += count($tasks);
  86. foreach($tasks as $task)
  87. {
  88. if($task->isParent) continue;
  89. if(!isset($executionConsumed[$task->execution])) $executionConsumed[$task->execution] = 0;
  90. $executionConsumed[$task->execution] += $task->consumed;
  91. $totalConsumed += $task->consumed;
  92. }
  93. }
  94. }
  95. ?>
  96. <tr class="text-center">
  97. <td class="border w-user" rowspan="<?php echo $taskTotal;?>"><?php echo zget($users, $user);?></td>
  98. <?php $j = 0;?>
  99. <?php foreach($projectTaskGroup as $projectID => $executionTasks):?>
  100. <?php
  101. $projectTaskTotal = count($executionTasks, 1) - count($executionTasks);
  102. if($j != 0) echo "<tr class='text-center'>";
  103. $projectName = zget($projects, $projectID, '');
  104. ?>
  105. <?php if($config->systemMode == 'ALM'):?>
  106. <td class='border text-left' rowspan="<?php echo $projectTaskTotal;?>" title='<?php echo $projectName?>'><?php echo $projectName;?></td>
  107. <?php endif;?>
  108. <?php $g = 0;?>
  109. <?php foreach($executionTasks as $executionID => $tasks):?>
  110. <?php
  111. $executionTaskTotal = count($tasks);
  112. if($g != 0) echo "<tr class='text-center'>";
  113. $executionName = zget($executions, $executionID, '');
  114. ?>
  115. <td class='border text-left' rowspan="<?php echo $executionTaskTotal;?>" title='<?php echo $executionName?>'><?php echo $executionName;?></td>
  116. <?php $k = 0;?>
  117. <?php foreach($tasks as $task):?>
  118. <?php if($k != 0) echo "<tr class='text-center'>"?>
  119. <td class='border'><?php echo $task->id;?></td>
  120. <td class="border text-left" title="<?php echo $task->name;?>">
  121. <?php
  122. if($task->parent > 0) echo "[{$lang->task->childrenAB}] ";
  123. if($task->multiple) echo "[{$lang->task->multipleAB}] ";
  124. echo $task->name;
  125. ?>
  126. </td>
  127. <td class='border priWidth'><span class='<?php echo 'pri' . $task->pri?>'><?php echo $task->pri;?></span></td>
  128. <td class='border dateWidth'><?php echo $task->estStarted;?></td>
  129. <td class='border dateWidth'><?php echo substr($task->realStarted, 0, 10);?></td>
  130. <td class='border dateWidth'><?php echo $task->deadline;?></td>
  131. <td class='border dateWidth'><?php echo substr($task->finishedDate, 0, 10);?></td>
  132. <td class="border dateWidth">
  133. <?php
  134. if(!helper::isZeroDate($task->deadline))
  135. {
  136. $finishedDate = strtotime(substr($task->finishedDate, 0, 10));
  137. $deadline = strtotime($task->deadline);
  138. $days = round(($finishedDate - $deadline) / 3600 / 24);
  139. if($days > 0) echo $days;
  140. }
  141. ?>
  142. </td>
  143. <td class="border"><?php echo $task->estimate;?></td>
  144. <td class="border"><?php echo $task->consumed;?></td>
  145. <?php if($k == 0):?>
  146. <td class="border" rowspan="<?php echo $executionTaskTotal;?>"><?php echo $executionTaskTotal;?></td>
  147. <td class="border" rowspan="<?php echo $executionTaskTotal;?>"><?php echo zget($executionConsumed, $executionID, '');?></td>
  148. <?php endif;?>
  149. <?php if($j == 0):?>
  150. <td class="border" rowspan="<?php echo $taskTotal;?>"><?php echo $totalConsumed;?></td>
  151. <?php endif;?>
  152. </tr>
  153. <?php $i++; $j++; $k++; $g++;?>
  154. <?php endforeach;?>
  155. <?php endforeach;?>
  156. <?php endforeach;?>
  157. <?php endforeach;?>
  158. </tbody>
  159. </table>
  160. </div>
  161. </div>
  162. <div class='pull-right p-2 no-morph' id='pagerWorkSummary' zui-create zui-create-pager="window.pagerWorkSummaryOptions"></div>
  163. </div>
  164. </div>
  165. <?php endif;?>
  166. <script>
  167. function changeParams()
  168. {
  169. const beginPick = $('#beginPicker').zui();
  170. const endPick = $('#endPicker').zui();
  171. var dept = $('#conditions').find('#dept').val();
  172. var begin = beginPick.$.value;
  173. var end = endPick.$.value;
  174. if(begin.indexOf('-') != -1)
  175. {
  176. var beginarray = begin.split("-");
  177. var begin = '';
  178. for(i=0 ; i < beginarray.length ; i++)
  179. {
  180. begin = begin + beginarray[i];
  181. }
  182. }
  183. if(end.indexOf('-') != -1)
  184. {
  185. var endarray = end.split("-");
  186. var end = '';
  187. for(i=0 ; i < endarray.length ; i++)
  188. {
  189. end = end + endarray[i];
  190. }
  191. }
  192. var params = window.btoa('begin=' + begin + '&end=' + end + '&dept=' + dept);
  193. var link = $.createLink('pivot', 'preview', 'dimension=' + <?php echo $dimensionID;?> + '&group=' + <?php echo $groupID;?> + '&method=worksummary&params=' + params);
  194. window.location.href = link;
  195. }
  196. function getLink(info)
  197. {
  198. const beginPick = $('#beginPicker').zui();
  199. const endPick = $('#endPicker').zui();
  200. var dept = $('#conditions').find('#dept').val();
  201. var begin = beginPick.$.value;
  202. var end = endPick.$.value;
  203. if(begin.indexOf('-') != -1)
  204. {
  205. var beginarray = begin.split("-");
  206. var begin = '';
  207. for(i=0 ; i < beginarray.length ; i++)
  208. {
  209. begin = begin + beginarray[i];
  210. }
  211. }
  212. if(end.indexOf('-') != -1)
  213. {
  214. var endarray = end.split("-");
  215. var end = '';
  216. for(i=0 ; i < endarray.length ; i++)
  217. {
  218. end = end + endarray[i];
  219. }
  220. }
  221. var params = window.btoa('begin=' + begin + '&end=' + end + '&dept=' + dept + '&recTotal=' + info.recTotal + '&recPerPage=' + info.recPerPage + '&pageID=' + info.page);
  222. return $.createLink('pivot', 'preview', 'dimension=' + <?php echo $dimensionID?> + '&group=' + <?php echo $groupID;?> + '&method=worksummary&params=' + params);
  223. }
  224. window.pagerWorkSummaryOptions = {
  225. items: [
  226. {type: 'info', text: '<?php echo str_replace('<strong>{recTotal}</strong>', $pager->recTotal, $lang->pager->totalCount);?>'},
  227. {type: 'size-menu', text: '<?php echo str_replace('<strong>{recPerPage}</strong>', $pager->recPerPage , $lang->pager->pageSize);?>', dropdown: {placement: 'top'}},
  228. {type: 'link', page: 'first', icon: 'icon-first-page', hint: '<?php echo $lang->pager->firstPage;?>'},
  229. {type: 'link', page: 'prev', icon: 'icon-angle-left', hint: '<?php echo $lang->pager->previousPage;?>'},
  230. {type: 'info', text: '<?php echo $pager->pageID;?>/<?php echo $pager->pageTotal;?>'},
  231. {type: 'link', page: 'next', icon: 'icon-angle-right', hint: '<?php echo $lang->pager->nextPage;?>'},
  232. {type: 'link', page: 'last', icon: 'icon-last-page', hint: '<?php echo $lang->pager->lastPage;?>'},
  233. ],
  234. page: <?php echo $pager->pageID;?>,
  235. recTotal: <?php echo $pager->recTotal;?>,
  236. recPerPage: <?php echo $pager->recPerPage;?>,
  237. linkCreator: (info) => {return getLink(info);}
  238. };
  239. </script>