Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
bab5a408
Commit
bab5a408
authored
May 23, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实收和税费
parent
83a62b66
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
42 deletions
+86
-42
Finance.php
application/index/controller/Finance.php
+23
-21
OBargainModel.php
application/model/OBargainModel.php
+5
-6
ORealIncome.php
application/model/ORealIncome.php
+51
-0
OTaxes.php
application/model/OTaxes.php
+7
-15
No files found.
application/index/controller/Finance.php
View file @
bab5a408
...
...
@@ -15,7 +15,8 @@ use app\index\untils\ExportExcelUntil;
use
app\model\AAgents
;
use
app\model\AStore
;
use
app\model\OBargainModel
;
use
app\model\OFee
;
use
app\model\ORealIncome
;
use
app\model\OTaxes
;
use
app\model\OFinancialAudit
;
use
app\model\OPartialCommission
;
use
app\model\OPayLogModel
;
...
...
@@ -206,8 +207,6 @@ class Finance extends Basic
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Id is null.'
;
}
else
{
$m_bargain
=
new
OBargainModel
();
$m_fee
=
new
OFee
();
$update_data
=
[];
//实收佣金
...
...
@@ -234,11 +233,14 @@ class Finance extends Basic
$update_data
[
'trade_type'
]
=
$this
->
params
[
'trade_type'
];
}
$m_bargain
=
new
OBargainModel
();
$m_real
=
new
ORealIncome
();
$data
[
'data'
]
=
$m_bargain
->
updateBargainById
(
$this
->
params
[
'id'
],
$update_data
);
if
(
$data
[
'data'
]
==
1
)
{
//新增实收佣金 array 5
$m_
fee
->
addFee
(
$this
->
params
[
'practical_fee'
],
$this
->
params
[
'id'
],
0
,
$this
->
userId
);
$m_
real
->
addRealIncome
(
$this
->
params
[
'practical_fee'
],
$this
->
params
[
'id'
]
,
$this
->
userId
);
}
else
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Modify the failure.'
;
...
...
@@ -494,15 +496,15 @@ class Finance extends Basic
$where
[
'a.confirm_status'
]
=
1
;
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.confirm_date'
]
=
[
'>= time'
,
$this
->
params
[
'create_time'
]];
$where
[
'a.confirm_date'
]
=
[
'>= time'
,
$this
->
params
[
'create_time'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.confirm_date'
]
=
[
'<= time'
,
$this
->
params
[
'create_time'
]];
$where
[
'a.confirm_date'
]
=
[
'<= time'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.confirm_date'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
.
' 00:00:00'
,
$this
->
params
[
'create_time'
]]];
$where
[
'a.confirm_date'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
.
' 00:00:00'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'internal_address'
]))
{
...
...
@@ -543,15 +545,15 @@ class Finance extends Basic
$where
[
'a.confirm_status'
]
=
1
;
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.confirm_date'
]
=
[
'>= time'
,
$this
->
params
[
'create_time'
]];
$where
[
'a.confirm_date'
]
=
[
'>= time'
,
$this
->
params
[
'create_time'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.confirm_date'
]
=
[
'<= time'
,
$this
->
params
[
'create_time'
]];
$where
[
'a.confirm_date'
]
=
[
'<= time'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.confirm_date'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
,
$this
->
params
[
'create_time'
]
]];
$where
[
'a.confirm_date'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
.
' 00:00:00'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'internal_address'
]))
{
...
...
@@ -609,7 +611,7 @@ class Finance extends Basic
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
return
$this
->
response
(
101
,
'查询开票税费参数错误!'
);
}
$m_fee
=
new
O
Fee
();
$m_fee
=
new
O
Taxes
();
$field
=
'a.id,a.total_fee,a.operation_date'
;
$data
=
$m_fee
->
getBargainFeeDetail
(
$this
->
params
[
'bargain_id'
],
1
,
$field
);
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
...
...
@@ -637,17 +639,16 @@ class Finance extends Basic
$bargain_id
=
$this
->
params
[
'bargain_id'
];
$operation_date
=
$this
->
params
[
'operation_date'
];
$m_fee
=
new
O
Fee
();
$m_fee
=
new
O
Taxes
();
$tax
=
$this
->
params
[
'tax'
];
$insert_data
[
'bargain_id'
]
=
$bargain_id
;
$insert_data
[
'total_fee'
]
=
$this
->
params
[
'total_fee'
];
$insert_data
[
'father_id'
]
=
0
;
$insert_data
[
'operation_id'
]
=
$this
->
userId
;
$insert_data
[
'operation_date'
]
=
$operation_date
;
$insert_data
[
'type'
]
=
1
;
$m_fee
->
editData
(
$insert_data
,
$this
->
params
[
'id'
]);
$father_id
=
$m_fee
->
id
;
$data
=
$m_fee
->
add
Fee
(
$tax
,
$bargain_id
,
1
,
$this
->
userId
,
$father_id
,
$this
->
params
[
'total_fee'
],
$operation_date
);
$data
=
$m_fee
->
add
Taxes
(
$tax
,
$bargain_id
,
$this
->
userId
,
$father_id
,
$this
->
params
[
'total_fee'
],
$operation_date
);
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
}
...
...
@@ -679,7 +680,7 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getTallAgeList
()
{
public
function
getTall
l
AgeList
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'tax'
);
}
...
...
@@ -724,9 +725,9 @@ class Finance extends Basic
$where
[
'b.house_number'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'house_number'
]
.
'%'
];
}
$m_fee
=
new
O
Fee
();
$data
[
'data'
][
'list'
]
=
$m_fee
->
get
Fee
List
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields
,
$where
);
$data
[
'data'
][
'total'
]
=
$m_fee
->
get
Fee
ListTotal
(
$where
);
$m_fee
=
new
O
Taxes
();
$data
[
'data'
][
'list'
]
=
$m_fee
->
get
Taxes
List
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields
,
$where
);
$data
[
'data'
][
'total'
]
=
$m_fee
->
get
Taxes
ListTotal
(
$where
);
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
...
...
@@ -756,7 +757,9 @@ class Finance extends Basic
$fields
.=
'd.name,d.phone'
;
$where
[
'c.is_del'
]
=
0
;
//订单状态
$where
[
'a.status'
]
=
[
'in'
,
10
,
11
];
//10已提交 11审核成功
$where
[
'a.status'
]
=
[
'in'
,
'10,11'
];
//10已提交 11审核成功
$where
[
'b.father_id'
]
=
[
'<>'
,
0
];
//去除税费总佣金
$where
[
'c.confirm_status'
]
=
1
;
//确认分佣
/**收佣日期 start**/
if
(
!
empty
(
$this
->
params
[
'commission_start_date'
])
&&
empty
(
$this
->
params
[
'commission_end_date'
]))
{
...
...
@@ -772,7 +775,6 @@ class Finance extends Basic
}
/**收佣日期 end**/
/**提交成交报告日期 start**/
if
(
!
empty
(
$this
->
params
[
'deal_start_date'
])
&&
empty
(
$this
->
params
[
'deal_end_date'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'deal_start_date'
]]
.
' 00:00:00'
;
...
...
@@ -801,7 +803,7 @@ class Finance extends Basic
}
if
(
isset
(
$where_fee
[
'operation_date'
]))
{
$m_fee
=
new
O
Fee
();
$m_fee
=
new
O
Taxes
();
$where_fee
[
'type'
]
=
1
;
$bargain_id
=
$m_fee
->
getFeeListColumn
(
'bargain_id'
,
$where_fee
);
if
(
!
empty
(
$bargain_id
))
{
...
...
application/model/OBargainModel.php
View file @
bab5a408
...
...
@@ -365,8 +365,8 @@ class OBargainModel extends Model
->
find
();
if
(
isset
(
$data
[
'id'
]))
{
$m_fee
=
new
O
Fe
e
();
$data
[
'practical_fee'
]
=
$m_fee
->
getBargain
Fee
(
$data
[
'id'
]);
//获取实收佣金
$m_fee
=
new
O
RealIncom
e
();
$data
[
'practical_fee'
]
=
$m_fee
->
getBargain
Taxes
(
$data
[
'id'
]);
//获取实收佣金
}
return
$data
;
...
...
@@ -391,7 +391,6 @@ class OBargainModel extends Model
$field
=
"count(1) as num,DATE(create_time) as day"
;
}
if
(
isset
(
$params
[
"agent_id"
])){
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
...
...
@@ -618,7 +617,7 @@ class OBargainModel extends Model
public
function
getCommissionTotalList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
,
$whereOr
)
{
$data
=
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_
fee
b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_
taxes
b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_partial_commission c'
,
'a.id = c.bargain_id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
where
(
$params
)
...
...
@@ -630,7 +629,7 @@ class OBargainModel extends Model
->
select
();
$m_agent
=
new
AAgents
();
$m_fee
=
new
O
Fee
();
$m_fee
=
new
O
Taxes
();
foreach
(
$data
as
$k
=>
$v
)
{
if
(
isset
(
$v
[
'agent_id'
]))
{
$district_store
=
$m_agent
->
getStoreDistrict
(
'store_name,district_name'
,
[
'a.id'
=>
$v
[
'agent_id'
]]);
...
...
@@ -654,7 +653,7 @@ class OBargainModel extends Model
*/
public
function
getCommissionTotalListTotal
(
$params
,
$whereOr
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'o_
fee
b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_
taxes
b'
,
'a.id = b.bargain_id'
,
'left'
)
->
join
(
'o_partial_commission c'
,
'a.id = c.bargain_id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
where
(
$params
)
...
...
application/model/ORealIncome.php
0 → 100644
View file @
bab5a408
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/5/23
* Time: 17:46
*/
namespace
app\model
;
class
ORealIncome
extends
BaseModel
{
/**
* 增加实收佣金
*
* @param $data
* @param $bargain_id
* @param $agent_id
* @return array|false
* @throws \Exception
*/
public
function
addRealIncome
(
$data
,
$bargain_id
,
$agent_id
)
{
$insert_data
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$insert_data
[
$k
][
'id'
]
=
$v
[
'fee_id'
];
$insert_data
[
$k
][
'bargain_id'
]
=
$bargain_id
;
$insert_data
[
$k
][
'operation_id'
]
=
$agent_id
;
$insert_data
[
$k
][
'money'
]
=
$v
[
'fee'
];
$insert_data
[
$k
][
'income_time'
]
=
$v
[
'operation_date'
];
}
return
$this
->
saveAll
(
$insert_data
);
}
/**
* @param int $bargain_id
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getBargainTaxes
(
int
$bargain_id
,
$field
=
'id as fee_id,money,income_time'
)
{
return
$this
->
field
(
$field
)
->
where
(
'bargain_id'
,
$bargain_id
)
->
select
();
}
}
\ No newline at end of file
application/model/O
Fee
.php
→
application/model/O
Taxes
.php
View file @
bab5a408
...
...
@@ -9,10 +9,10 @@
namespace
app\model
;
class
O
Fee
extends
BaseModel
class
O
Taxes
extends
BaseModel
{
/**
*
根据成交报告-实收佣金 或
税费开票 查询
* 税费开票 查询
*
* @param int $bargain_id
* @param int $type
...
...
@@ -22,15 +22,14 @@ class OFee extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getBargain
Fee
(
int
$bargain_id
,
$type
=
0
,
string
$field
=
'id as fee_id,fee,operation_date'
)
{
public
function
getBargain
Taxes
(
int
$bargain_id
,
$field
=
'id as fee_id,fee,operation_date'
)
{
return
$this
->
field
(
$field
)
->
where
(
'bargain_id'
,
$bargain_id
)
->
where
(
'type'
,
$type
)
->
select
();
}
/**
*
根据成交报告-实收佣金 或
税费开票 查询数量
* 税费开票 查询数量
*
* @param int $bargain_id
* @param int $type
...
...
@@ -55,23 +54,16 @@ class OFee extends BaseModel
* @return array|false
* @throws \Exception
*/
public
function
add
Fee
(
$data
,
$bargain_id
,
$type
=
0
,
int
$agent_id
,
$father_id
=
0
,
$total_fee
=
0
,
$operation_date
=
''
)
{
public
function
add
Taxes
(
$data
,
$bargain_id
,
int
$agent_id
,
$father_id
=
0
,
$total_fee
=
0
,
$operation_date
=
''
)
{
$insert_data
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$insert_data
[
$k
][
'id'
]
=
$v
[
'fee_id'
];
$insert_data
[
$k
][
'bargain_id'
]
=
$bargain_id
;
$insert_data
[
$k
][
'fee'
]
=
$v
[
'fee'
];
$insert_data
[
$k
][
'operation_id'
]
=
$agent_id
;
$insert_data
[
$k
][
'type'
]
=
$type
;
if
(
$type
!=
0
)
{
//开票税费处理
$insert_data
[
$k
][
'father_id'
]
=
$father_id
;
$insert_data
[
$k
][
'total_fee'
]
=
$total_fee
;
$insert_data
[
$k
][
'operation_date'
]
=
$operation_date
;
}
else
{
$insert_data
[
$k
][
'operation_date'
]
=
$v
[
'operation_date'
];
}
}
return
$this
->
saveAll
(
$insert_data
);
...
...
@@ -125,7 +117,7 @@ class OFee extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
get
Fee
List
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
)
{
public
function
get
Taxes
List
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
)
{
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o_order c'
,
'b.order_id = c.id'
,
'left'
)
...
...
@@ -153,7 +145,7 @@ class OFee extends BaseModel
* @param $params
* @return int|string
*/
public
function
get
Fee
ListTotal
(
$params
)
{
public
function
get
Taxes
ListTotal
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o_order c'
,
'b.order_id = c.id'
,
'left'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment