-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathinit_performance.php
119 lines (110 loc) · 3.12 KB
/
init_performance.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* 个人业绩考评
* @author fotomxq <fotomxq.me>
* @version 2
* @package oa
*/
/**
* 页面引用判断
* @since 1
*/
if (isset($init_page) == false) {
die();
}
/**
* 初始化基础变量
* @since 1
*/
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$max = 30;
$sort = 0;
$desc = true;
$post_type = 'performance';
$post_status = 'private';
$post_parent = '';
/**
* 提示消息变量
* @since 1
*/
$message = '';
$message_bool = false;
/**
* 获取列表记录数
* @since 1
*/
$table_list_row = $oapost->view_list_row($post_user, null, null, $post_status, $post_type, $post_parent);
/**
* 计算页码
* @since 1
*/
$page_max = ceil($table_list_row / $max);
if ($page < 1) {
$page = 1;
} else {
if ($page > $page_max) {
$page = $page_max;
}
}
$page_prev = $page - 1;
$page_next = $page + 1;
/**
* 获取列表
* @since 1
*/
$table_list = $oapost->view_list($post_user, null, null, $post_status, $post_type, $page, $max, $sort, $desc, $post_parent);
/**
* 计算业绩
* @since 1
*/
$performance_count = $oapost->sum_fields('performance', $post_user, 'post_url');
$date_mouth_start = date('Y-m') . '-00 00:00:00';
$date_mouth_end = date('Y') . '-' . ((int) date('m') + 1) . '-00 00:00:00';
$performance_mouth_count = $oapost->sum_fields('performance', $post_user, 'post_url', $date_mouth_start, $date_mouth_end);
?>
<!-- 管理表格 -->
<h2>个人业绩考评</h2>
<p>总业绩:<?php echo $performance_count; ?>;本月:<?php echo $performance_mouth_count; ?></p>
<p><a href="#print_page" target="_self" class="btn"><i class="icon-print"></i> 打印该页</a></p>
<table class="table table-hover table-bordered table-striped">
<thead>
<tr>
<th><i class="icon-tag"></i> 任务名称</th>
<th><i class="icon-user"></i> 业绩</th>
<th><i class="icon-asterisk"></i> 操作</th>
</tr>
</thead>
<tbody id="message_list">
<?php if ($table_list) {
foreach ($table_list as $v) { ?>
<tr>
<td><?php echo $v['post_title']; ?></td>
<td><?php echo $v['post_url']; ?></td>
<td>
<div class="btn-group">
<a href="init.php?init=3&view=<?php echo $v['post_parent']; ?>" class="btn"><i class="icon-search"></i> 查询该任务</a>
</div>
</td>
</tr>
<?php } } ?>
</tbody>
</table>
<!-- 页码 -->
<ul class="pager">
<li class="previous<?php if ($page <= 1) { echo ' disabled'; } ?>">
<a href="<?php echo $page_url . '&page=' . $page_prev; ?>">← 上一页</a>
</li>
<li class="next<?php if ($page >= $page_max) { echo ' disabled'; } ?>">
<a href="<?php echo $page_url.'&page='.$page_next; ?>">下一页 →</a>
</li>
</ul>
<!-- Javascript -->
<script>
$(document).ready(function() {
var message = "<?php echo $message; ?>";
var message_bool = "<?php echo $message_bool ? '2' : '1'; ?>";
if (message != "") {
msg(message_bool, message, message);
}
});
</script>