This commit is contained in:
lin fan
2024-11-25 23:37:46 +08:00
parent bb56705f63
commit 7b1c748e7c
3 changed files with 158 additions and 1 deletions
+113
View File
@@ -0,0 +1,113 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Report extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model("biz/biz_model");
$this->load->model('receiver/receiver_score_log_model');
$this->load->model('receiver/receiver_score_day_model');
$this->load->model('app/licheb/app_licheb_users_model');
}
//首页信息
public function index()
{
//return $this->lists();
return $this->show_view('receiver/report/lists', true);
}
//数据列表
public function lists()
{
}
//展示单条数据
public function get()
{
}
//添加单条数据
public function add()
{
}
//编辑单条数据
public function edit(){
}
//删除单条数据
public function del(){
}
//批量操作(默认修改状态)
public function batch(){
}
//导出数据列表
public function export()
{
$day = $this->input->get('day');
!$day && $day = date('Y-m-d', strtotime('yesterday'));
$indexs = [
'biz_name' => '车卖场',
'work_per' => '今日开工率',
'word_num' => '本月平均开工数',
'cust_new' => '今日新增线索数',
'cust_month' => '本月线索总数',
'cust_visit' => '今日新增跟进数',
'cust_visit_month' => '本月跟进客户数',
'order_new' => '今日订单新增数',
'order_month' => '本月订单总数',
"order_finish" => "本月订单信息完整数",
"cust_delay" => "今日线索逾期数",
"cust_delay_month" => "本月线索逾期数",
"order_wrong" => "今日订单未达T+1",
"order_wrong_month" => "本月订单未达T+1",
"order_early" => "今日开票早与订单时间数",
"cust_push" => "今日未及时分配数",
"cust_push_month" => "本月未及时分配总数",
"cust_defeat" => "今日战败申请未处理数",
"cust_defeat_month" => "本月战败申请未处理数",
'score' => '今日运营分',
'score_month' => '本月运营分',
'score_rank' => '运营排行'
];
$where = array(
'status' => 1,
'type' => 0,
'province_id' => 350000
);
$bizs = $this->biz_model->select($where, '', 0, 0, 'id, biz_name');
if($bizs){
foreach ($bizs as $v){
//开工率
$sales = $this->app_licheb_users_model->count(array('group_id in (1,2)' => null, 'biz_id' => $v['id'], 'status' => 1));
$work = $this->receiver_score_log_model->count(array('day' => $day, 'biz_id' => $v['id'], 'type' => 0, 'sub_type' => 1), 'uid');
$data[] = array(
'biz_name' => $v['biz_name'],
'work_per' => $work,
);
}
}
print_r($data);
exit;
$fileName = '车卖场日报';
array_unshift($data, $indexs);
$this->load->library('excel');
$this->excel->out_csv($data, $indexs, $fileName . "_" . date('YmdHis'));
}
}
+44
View File
@@ -0,0 +1,44 @@
<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs" style="font-size:15px;margin-bottom: 20px;">
</div>
<div class="coms-table-wrap mt10">
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false" action="/receiver/report">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl" style="margin-bottom: 0px;">
<label class="am-para-label w100">日期:</label>
<div class="am-form-group fl">
<div class="am-para-inline w100">
<input id="id-day" name="day" type="text" value="<?= $params['day'] ?>"
placeholder="选择日期" autocomplete="off"/>
</div>
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
</div>
</div>
<div class="am-form-group fl ml10">
<button type="button" onclick="export_out()" class="am-btn am-btn-success am-btn-sm w100">导出
</button>
</div>
</div>
</div>
</form>
</div>
<script>
require(['laydate', 'autocomplete'], function (laydate) {
laydate.render({
elem: '#id-day'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', nowDate = new Date();
var date = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
$('#id-day').val(date);
});
});
function export_out () {
var href = $.menu.parseUri(window.location.href);
var day = $('#id-day').val();
href = href.replace("report?", "report/export?day=" + day+ "&");
window.location.href = href;
}
</script>
+1 -1
View File
@@ -555,7 +555,7 @@ abstract class Wxapp extends HD_Controller
$scoreLogModel = new receiver_score_log_model();
$day = date('Y-m-d');
$scoreLogModel->add_score($this->session['uid'], $this->get_biz_id(), $day, Receiver_score_config_model::TYPE_BASE,
Receiver_score_config_model::TYPE_BASE_KG, '基础分', 1);
Receiver_score_config_model::TYPE_BASE_KG, '开工', 1);
}
return true;
}