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
095edb3e
Commit
095edb3e
authored
Jun 21, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
财务增加异常处理
parent
63747218
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
30 deletions
+60
-30
Finance.php
application/index/controller/Finance.php
+60
-30
No files found.
application/index/controller/Finance.php
View file @
095edb3e
...
...
@@ -13,7 +13,6 @@ use app\api_broker\service\OrderLogService;
use
app\index\extend\Basic
;
use
app\index\untils\ExportExcelUntil
;
use
app\model\AAgents
;
use
app\model\AStore
;
use
app\model\OBargainLogModel
;
use
app\model\OBargainModel
;
use
app\model\ORealIncome
;
...
...
@@ -22,7 +21,7 @@ use app\model\OFinancialAudit;
use
app\model\OPartialCommission
;
use
app\model\OPayLogModel
;
use
app\model\ORefundModel
;
use
think\Exception
;
use
think\
exception\PDO
Exception
;
class
Finance
extends
Basic
{
...
...
@@ -140,9 +139,14 @@ class Finance extends Basic
}
$bargain
=
new
OBargainModel
();
$data
[
'data'
][
'list'
]
=
$bargain
->
getBargainList
(
$pageNo
,
$pageSize
,
$order
,
$fields
,
$where
,
$audit_level
);
$data
[
'data'
][
'total'
]
=
$bargain
->
getBargainTotal
(
$where
,
$audit_level
);
$data
[
'data'
][
'step'
]
=
$check_status
;
try
{
$data
[
'data'
][
'list'
]
=
$bargain
->
getBargainList
(
$pageNo
,
$pageSize
,
$order
,
$fields
,
$where
,
$audit_level
);
$data
[
'data'
][
'total'
]
=
$bargain
->
getBargainTotal
(
$where
,
$audit_level
);
$data
[
'data'
][
'step'
]
=
$check_status
;
}
catch
(
\PDOException
$e
)
{
return
$this
->
response
(
101
,
'内部错误,获取列表失败!请联系运营。'
);
}
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
...
...
@@ -171,7 +175,12 @@ class Finance extends Basic
$params
[
'audit_id'
]
=
$this
->
userId
;
$params
[
'audit_level'
]
=
$this
->
params
[
'check_status'
];
$params
[
'remark'
]
=
$this
->
params
[
'remark'
];
$status
=
$bargain
->
addCheckBargain
(
$this
->
params
[
'id'
],
$params
,
$this
->
params
[
'source'
],
$this
->
params
[
'status'
]);
try
{
$status
=
$bargain
->
addCheckBargain
(
$this
->
params
[
'id'
],
$params
,
$this
->
params
[
'source'
],
$this
->
params
[
'status'
]);
}
catch
(
PDOException
$e
)
{
return
$this
->
response
(
101
,
'内部错误,审核失败!请联系运营。'
);
}
if
(
empty
(
$status
))
{
$data
[
'code'
]
=
101
;
...
...
@@ -299,15 +308,20 @@ class Finance extends Basic
}
}
if
(
$i
>
0
)
{
$m_real
->
addRealIncome
(
$update_real_arr
);
}
if
(
$j
>
0
)
{
$m_real
->
addRealIncome
(
$add_real_arr
);
try
{
if
(
$i
>
0
)
{
$m_real
->
addRealIncome
(
$update_real_arr
);
}
if
(
$j
>
0
)
{
$m_real
->
addRealIncome
(
$add_real_arr
);
}
$content
=
'[应收总佣金:'
.
$update_data
[
'commission'
]
.
']'
.
implode
(
' '
,
$log_data
);
$this
->
editRecordLog
((
int
)
$this
->
params
[
"id"
],
$content
,
1
,
''
,
$update_data
[
'is_open'
]);
}
catch
(
\PDOException
$e
)
{
return
$this
->
response
(
101
,
'内部错误,修改成交报告失败!请联系运营。'
);
}
$content
=
'[应收总佣金:'
.
$update_data
[
'commission'
]
.
']'
.
implode
(
' '
,
$log_data
);
$this
->
editRecordLog
((
int
)
$this
->
params
[
"id"
],
$content
,
1
,
''
,
$update_data
[
'is_open'
]);
}
else
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Modify the failure.'
;
...
...
@@ -334,8 +348,13 @@ class Finance extends Basic
$data
[
'msg'
]
=
'提交信息错误!'
;
}
else
{
$bargain
=
new
OBargainModel
();
$data
[
'data'
]
=
$bargain
->
addBargainCommission
(
$this
->
params
[
'id'
],
$this
->
userId
,
$this
->
params
[
'agent_id'
],
$this
->
params
[
'role'
],
$this
->
params
[
'scale_fee'
],
$this
->
params
[
'scale'
],
1
);
try
{
$data
[
'data'
]
=
$bargain
->
addBargainCommission
(
$this
->
params
[
'id'
],
$this
->
userId
,
$this
->
params
[
'agent_id'
],
$this
->
params
[
'role'
],
$this
->
params
[
'scale_fee'
],
$this
->
params
[
'scale'
],
1
);
}
catch
(
\PDOException
$e
)
{
return
$this
->
response
(
101
,
'内部错误,新增分佣提成失败!请联系运营。'
);
}
if
(
$data
[
'data'
]
==
0
)
{
$data
[
'code'
]
=
101
;
...
...
@@ -601,8 +620,13 @@ class Finance extends Basic
$field
=
'a.id,b.id as bargain_id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id'
;
$m_commission
=
new
OPartialCommission
();
$data
[
'data'
][
'list'
]
=
$m_commission
->
getCommissionBargainList
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$field
,
$where
);
$data
[
'data'
][
'total'
]
=
$m_commission
->
getCommissionBargainListTotal
(
$where
);
try
{
$data
[
'data'
][
'list'
]
=
$m_commission
->
getCommissionBargainList
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$field
,
$where
);
$data
[
'data'
][
'total'
]
=
$m_commission
->
getCommissionBargainListTotal
(
$where
);
}
catch
(
\PDOException
$e
)
{
return
$this
->
response
(
101
,
'内部错误,获取分佣提成明细列表失败!请联系运营。'
);
}
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
}
...
...
@@ -651,13 +675,16 @@ class Finance extends Basic
$field
=
'a.id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,cash,service_charge,charity_fund,real_fee'
;
$m_commission
=
new
OPartialCommission
();
$data
=
$m_commission
->
getCommissionBargainColumn
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$field
,
$where
);
try
{
$data
=
$m_commission
->
getCommissionBargainColumn
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$field
,
$where
);
}
catch
(
\PDOException
$e
)
{
return
'<script>alert("导出分佣提成明细列表失败");window.close();</script>'
;
}
$export
=
new
ExportExcelUntil
();
$title
=
[
'收佣日期'
,
'所属部门/门店'
,
'业务员'
,
'应分佣金(元)'
,
'实分佣金(元)'
,
'手续费(元)'
,
'慈善基金(元)'
,
'现金奖(元)'
,
'实收佣金(元)'
];
$export
->
exportTable
(
'分佣提成明细'
,
$data
,
8
,
'分佣提成明细表'
,
$title
);
return
;
return
''
;
}
/**
...
...
@@ -686,7 +713,7 @@ class Finance extends Basic
$m_partial
=
new
OPartialCommission
();
$data
=
$this
->
params
[
"commission_date"
];
$add_arr
=
$update_arr
=
[];
$add_arr
=
$update_arr
=
$log_data
=
[];
$i
=
$j
=
0
;
foreach
(
$data
as
$item
)
{
if
(
!
isset
(
$item
[
'practical_fee'
])
||
!
isset
(
$item
[
'cash'
])
||
!
isset
(
$item
[
'service_charge'
])
||
...
...
@@ -840,7 +867,7 @@ class Finance extends Basic
if
(
$this
->
params
[
'id'
]
&&
$this
->
params
[
'id'
]
>
0
)
{
//编辑
$father_id
=
$this
->
params
[
'id'
];
}
else
{
$father_id
=
$m_fee
->
id
;
$father_id
=
isset
(
$m_fee
->
id
)
?
$m_fee
->
id
:
0
;
}
$data
=
$m_fee
->
addTaxes
(
$tax
,
$bargain_id
,
$this
->
userId
,
$father_id
,
$this
->
params
[
'total_fee'
],
$operation_date
);
...
...
@@ -896,7 +923,7 @@ class Finance extends Basic
}
else
{
return
$this
->
response
(
"200"
,
"request null"
);
}
}
catch
(
Exception
$e
)
{
}
catch
(
\
Exception
$e
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$e
);
}
}
...
...
@@ -928,7 +955,7 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getTall
l
AgeList
()
public
function
getTallAgeList
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'tax'
);
...
...
@@ -998,7 +1025,7 @@ class Finance extends Basic
$data
[
'code'
]
=
200
;
$data
[
'msg'
]
=
""
;
$whereOr
=
$data
[
'data'
]
=
[];
$whereOr
=
$data
[
'data'
]
=
$excel_data
=
[];
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
15
:
$this
->
params
[
'pageSize'
];
...
...
@@ -1071,6 +1098,7 @@ class Finance extends Basic
$fields
=
'f.income_time,a.create_time,a.id,a.agent_id,sum(b.fee) as fee,sum(c.practical_fee) as practical_fee,sum(c.cash) as cash,'
;
$fields
.=
'sum(b.fee) as fee,sum(c.real_fee) as real_fee,'
;
$fields
.=
'd.name,d.phone'
;
$data
[
'data'
][
'list'
]
=
$m_bargain
->
getCommissionTotalList
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields
,
$where
,
$whereOr
);
foreach
(
$data
[
'data'
][
'list'
]
as
$k
=>
$v
)
{
...
...
@@ -1121,7 +1149,6 @@ class Finance extends Basic
$export
=
new
ExportExcelUntil
();
$title
=
[
'收佣日期/开票日期'
,
'成交日期/开票日期'
,
'所属部门/门店'
,
'业务员'
,
'应分佣金(元)'
,
'手续费(元)'
,
'现金奖(元)'
,
'慈善基金(元)'
,
'实收佣金(元)'
,
'税费(元)'
,
'最终实收(元)'
];
$export
->
exportTable
(
'分佣提成汇总表'
,
$excel_data
,
11
,
'分佣提成汇总表'
,
$title
);
return
;
}
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
...
...
@@ -1131,6 +1158,9 @@ class Finance extends Basic
* 回到一级审核
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
toReportListOne
()
{
...
...
@@ -1265,13 +1295,13 @@ class Finance extends Basic
public
function
editRecordLog
(
int
$bargain_id
,
string
$step_content
=
''
,
int
$type
=
1
,
string
$house_number
=
''
,
int
$is_open
=
0
)
{
$m_bargain
=
new
OBargainModel
();
$house_number
=
$m_bargain
->
getCheckBargain
(
'a.house_number,c.internal_address'
,
(
int
)
$bargain_id
);
$step_content
.=
"[
{
$house_number
[
'internal_address'
]
}
]"
;
$house_number
_table
=
$m_bargain
->
getCheckBargain
(
'a.house_number,c.internal_address'
,
(
int
)
$bargain_id
);
$step_content
.=
"[
{
$house_number
_table
[
'internal_address'
]
}
]"
;
if
(
empty
(
$house_number
))
{
$house_number
=
$house_number
[
'house_number'
];
$house_number
=
$house_number
_table
[
'house_number'
];
}
$insert_data
=
[];
if
(
is_array
(
$step_content
))
{
foreach
(
$step_content
as
$k
=>
$v
)
{
...
...
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