聚合财务2

master
chenzhi 5 years ago
parent 6d0e7c3a00
commit 51322e3317

@ -130,6 +130,8 @@ class AggregateFinanceSetController extends Controller {
$v['begintime'] = $begintime; $v['begintime'] = $begintime;
$v['endtime'] = $endtime; $v['endtime'] = $endtime;
$v['create_time'] = time(); $v['create_time'] = time();
$v['admin_name'] = "system";
$v['admin_id'] = 0;
$Aggregate->add($v); $Aggregate->add($v);
} }
} }

@ -17,51 +17,52 @@ class AggregateFinanceStatementController extends ThinkController
"5"=>"已到账" "5"=>"已到账"
]; ];
public function lists() { public function lists() {
$is_export= false;
// $map = []; if (isset($_REQUEST['export']) && $_REQUEST['export']==1){
$is_export = true;
// if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { }
// $map['create_time'] = ['between', [strtotime(I('time_start')), strtotime(I('time_end')) + 86399]];
// } elseif (isset($_REQUEST['time_start'])) { $page = intval(I('get.p', 0));
// $map['create_time'] = ['GT', strtotime(I('time_start'))]; $page = $page ? $page : 1; //默认显示第一页数据
// } elseif (isset($_REQUEST['time_end'])) { $row = intval(I('row', 0));
// $map['create_time'] = ['LT', strtotime(I('time_end')) + 86399]; $row = empty($row) ? 10 : $row;//每页条数
// }
$map = [];
// if ($_REQUEST['verify_status']||$_REQUEST['verify_status']=='0') { if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
// $map['verify_status'] = $_REQUEST['verify_status']; $map["_string"] = "(begintime BETWEEN {$_REQUEST['time_start']} AND {$_REQUEST['time_end']}) OR (endtime BETWEEN {$_REQUEST['time_start']} AND {$_REQUEST['time_end']})";
// } } elseif (isset($_REQUEST['time_start'])) {
$map["_string"] = "(begintime >= {$_REQUEST['time_start']} ) OR (endtime >= {$_REQUEST['time_end']})";
// if ($_REQUEST['statement_type']||$_REQUEST['statement_type']=='0') { } elseif (isset($_REQUEST['time_end'])) {
// if($_REQUEST['statement_type']=='2') { $map["_string"] = "(begintime <= {$_REQUEST['time_start']} ) OR (endtime <= {$_REQUEST['time_end']})";
// $map['second_party_info'] = ['like','%"order_type":1%']; }
// } else { if ($_REQUEST['verify_status']) {
// $map['statement_type'] = $_REQUEST['statement_type']; $map['verify_status'] = $_REQUEST['verify_status'];
// if ($_REQUEST['statement_type']=='1') { }
if ($_REQUEST['channel_id']) {
// $map['second_party_info'] = ['like','%"order_type":0%']; $map['channel_id'] = $_REQUEST['channel_id'];
}
// } if ($_REQUEST['withdraw_type']) {
// } $map['withdraw_type'] = $_REQUEST['withdraw_type'];
// // dump($map['second_party_info']);die(); }
// } $data = M("aggregate_statement","tab_")
// // var_dump($map);die(); ->where($map)
->order("create_time Desc");
// if ($_REQUEST['company_id']) { if($is_export){
// $map['company_name'] = $_REQUEST['company_id']; $data = $data->select();
// // if ($_REQUEST['company_id']=='万盟天下科技') { }else{
// // $map['company_name'] = '海南万盟天下科技有限公司'; $data = $data->page($page,$row)->select();
// // } }
// } foreach($data as $key => $value) {
$data[$key]['verify_status_str'] = $this->verify_status[$value['verify_status']];
// $data = M("statement","tab_") $data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
// ->where($map) $data[$key]['begintime'] = date('Y-m-d H:i:s',$value['begintime']);
// ->order("create_time Desc") $data[$key]['endtime'] = date('Y-m-d H:i:s',$value['endtime']);
// ->select(); }
$count = M("aggregate_statement","tab_")->field("count(id) count,SUM(ratio_money) ratio_money")->where($map)->find();
// // var_dump($data);die(); // // var_dump($data);die();
// foreach ($data as $key => $value) { // foreach ($data as $key => $value) {
// $data[$key]['order'] = json_decode($value['second_party_info'],true)['order_type']; // $data[$key]['order'] = json_decode($value['second_party_info'],true)['order_type'];
// } // }
// $sumData = M("statement","tab_") // $sumData = M("statement","tab_")
// ->field('sum(`statement_money`) as sum_money,statement_type') // ->field('sum(`statement_money`) as sum_money,statement_type')
@ -86,15 +87,16 @@ class AggregateFinanceStatementController extends ThinkController
// $this->assign('sum',$handleSumData); // $this->assign('sum',$handleSumData);
// // dump($sumData);die(); // // dump($sumData);die();
//分页
$parameter['p'] = $page;
$parameter['row'] = $row;
$page = set_pagination($count, $row, $parameter);
if ($page) {
$this->assign('_page', $page);
}
// foreach($data as $key => $value) {
// $data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
// $data[$key]['statement_begin_time'] = date('Y-m-d H:i:s',$value['statement_begin_time']);
// $data[$key]['statement_end_time'] = date('Y-m-d H:i:s',$value['statement_end_time']+86399);
// }
// $this->meta_title = '结算单管理'; // $this->meta_title = '结算单管理';
// $this->assign('data',$data); $this->assign('data',$data);
$this->assign('channel',$this->getAggChannel()); $this->assign('channel',$this->getAggChannel());
$this->assign('verify_status',$this->verify_status); $this->assign('verify_status',$this->verify_status);
$this->display(); $this->display();

@ -121,13 +121,14 @@
<thead> <thead>
<tr> <tr>
<th><input class="check-all" type="checkbox"></th> <th><input class="check-all" type="checkbox"></th>
<th>对账单类型</th>
<th>生成时间</th>
<th>对账公司</th> <th>对账公司</th>
<th>结算方式</th>
<th>对账日期</th> <th>对账日期</th>
<th>对账金额</th> <th>对账金额</th>
<th>状态</th> <th>状态</th>
<th>操作人</th> <th>操作人</th>
<th>生成时间</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
@ -144,13 +145,13 @@
<tr> <tr>
<td ><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]" > <td ><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]" >
</td> </td>
<td><if condition="$data['statement_type'] eq 0">上游对账单<elseif condition="$data['statement_type'] eq 1 and $data['order'] eq 0"/>下游对账单<elseif condition="$data['statement_type'] eq 1 and $data['order'] eq 1"/>下游补点对账单<elseif condition="$data['statement_type'] eq 2"/>下游个人结算单</if></td> <td>{$data.channel_name}</td>
<td><if condition="$data['withdraw_type'] eq 0">周结<elseif condition="$data['withdraw_type'] eq 1"/>月结<elseif condition="$data['withdraw_type'] eq 2 "/>补点</if></td>
<td>{$data.begintime}-{$data.endtime}</td>
<td>{$data.ratio_money}</td>
<td>{$data.verify_status_str}</td>
<td>{$data.admin_name}</td>
<td>{$data.create_time}</td> <td>{$data.create_time}</td>
<td>{$data.company_name}</td>
<td>{$data.statement_begin_time}-{$data.statement_end_time}</td>
<td>{$data.statement_money}</td>
<td><if condition="$data['verify_status'] eq 0">未审核<elseif condition="$data['verify_status'] eq 1"/>审核通过<elseif condition="$data['verify_status'] eq 2"/>审核拒绝</if></td>
<td><if condition="$data['is_confirm'] eq 0">未确认<elseif condition="$data['is_confirm'] eq 1"/>确认</if></td>
<td> <td>
<a class="confirm statement_view" data-id="{$data.id}" data-type="{$data.statement_type}">查看</a> <a class="confirm statement_view" data-id="{$data.id}" data-type="{$data.statement_type}">查看</a>
<if condition="$data['is_confirm'] eq 0"> <if condition="$data['is_confirm'] eq 0">
@ -158,6 +159,7 @@
</if> </if>
<a class="confirm statement_del" data-type="{$data.statement_type}" data-id="{$data.id}">撤销</a> <a class="confirm statement_del" data-type="{$data.statement_type}" data-id="{$data.id}">撤销</a>
</td> </td>
</tr> </tr>
</volist> </volist>
<tr><td>合计</td><td colspan="10">公司对账金额合计:{$sum[1]}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp对账金额合计{$sum[0]+$sum[2]}</td></tr> <tr><td>合计</td><td colspan="10">公司对账金额合计:{$sum[1]}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cp对账金额合计{$sum[0]+$sum[2]}</td></tr>
@ -173,15 +175,6 @@
</if> </if>
{$_page|default=''} {$_page|default=''}
</div> </div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Promote/lists/type/{:I('type',1)}">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block> </block>
<block name="script"> <block name="script">

@ -1636,6 +1636,8 @@ CREATE TABLE `tab_aggregate_statement` (
`first_party_info` longtext DEFAULT NULL COMMENT '甲方相关信息json', `first_party_info` longtext DEFAULT NULL COMMENT '甲方相关信息json',
`second_party_info` longtext DEFAULT NULL COMMENT '乙方相关信息json', `second_party_info` longtext DEFAULT NULL COMMENT '乙方相关信息json',
`statement_info` longtext NOT NULL COMMENT '订单相关信息json', `statement_info` longtext NOT NULL COMMENT '订单相关信息json',
`admin_name` varchar(60) NOT NULL COMMENT '操作人名称',
`admin_id`int(11) DEFAULT '0' COMMENT '操作人id',
`verify_status` tinyint(2) DEFAULT '0' COMMENT '审核状态 -1审核拒绝 0:系统生成结算单 1:申请开票 2:审核同意 3:已开票 4:上传收款凭证 5已到账', `verify_status` tinyint(2) DEFAULT '0' COMMENT '审核状态 -1审核拒绝 0:系统生成结算单 1:申请开票 2:审核同意 3:已开票 4:上传收款凭证 5已到账',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `withdraw_type` (`withdraw_type`) USING BTREE, KEY `withdraw_type` (`withdraw_type`) USING BTREE,

Loading…
Cancel
Save