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
770cebc5
Commit
770cebc5
authored
May 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增开票修改
parent
351dcb52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
16 deletions
+63
-16
Finance.php
application/index/controller/Finance.php
+34
-11
OBargainModel.php
application/model/OBargainModel.php
+18
-0
OTaxes.php
application/model/OTaxes.php
+11
-5
No files found.
application/index/controller/Finance.php
View file @
770cebc5
...
...
@@ -598,9 +598,7 @@ class Finance extends Basic
}
$m_bargain
=
new
OBargainModel
();
$where
[
'status'
]
=
[
'in'
,
'10,11'
];
//10已提交 11审核成功
$where
[
'id'
]
=
$this
->
params
[
'bargain_id'
];
$bargain_data
=
$m_bargain
->
getBargainDetail
(
'id,agent_id,role'
,
$where
);
$bargain_data
=
$m_bargain
->
getCheckBargain
(
'id,agent_id,role'
,
$this
->
params
[
'bargain_id'
]);
//排除成交报告其它状态
if
(
empty
(
$bargain_data
[
'id'
]))
{
...
...
@@ -628,7 +626,7 @@ class Finance extends Basic
return
$this
->
response
(
101
,
'查询开票税费参数错误!'
);
}
$m_fee
=
new
OTaxes
();
$field
=
'a.id,a.total_fee,a.operation_date'
;
$field
=
'a.id,a.total_fee,a.operation_date
,a.bargain_id
'
;
$data
=
$m_fee
->
getBargainFeeDetail
(
$this
->
params
[
'bargain_id'
],
$field
);
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
}
...
...
@@ -652,18 +650,43 @@ class Finance extends Basic
return
$this
->
response
(
101
,
'开票日期为空'
);
}
$tax
=
$this
->
params
[
'tax'
];
if
(
empty
(
$tax
[
0
][
'agent_id'
]))
{
return
$this
->
response
(
101
,
'分佣方为空'
);
}
if
(
empty
(
$tax
[
0
][
'role'
]))
{
return
$this
->
response
(
101
,
'分佣方角色为空'
);
}
$m_bargain
=
new
OBargainModel
();
$bargain_data
=
$m_bargain
->
getCheckBargain
(
'id'
,
$this
->
params
[
'bargain_id'
]);
//排除成交报告其它状态
if
(
empty
(
$bargain_data
[
'id'
]))
{
return
$this
->
response
(
101
,
'成交报告数据异常!'
);
}
$bargain_id
=
$this
->
params
[
'bargain_id'
];
$operation_date
=
$this
->
params
[
'operation_date'
];
$m_fee
=
new
OTaxes
();
$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
;
$m_fee
->
editData
(
$insert_data
,
$this
->
params
[
'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
;
//开票日期
$m_fee
=
new
OTaxes
();
$m_fee
->
editData
(
$insert_data
,
$this
->
params
[
'id'
]);
//开票新增和编辑
$father_id
=
$m_fee
->
id
;
$m_agent
=
new
AAgents
();
foreach
(
$tax
as
$k
=>
$v
)
{
$tax
[
$k
][
'agent_name'
]
=
$m_agent
->
getAgentsById
(
$v
[
'agent_id'
],
'name'
);
}
$data
=
$m_fee
->
addTaxes
(
$tax
,
$bargain_id
,
$this
->
userId
,
$father_id
,
$this
->
params
[
'total_fee'
],
$operation_date
);
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
}
...
...
application/model/OBargainModel.php
View file @
770cebc5
...
...
@@ -736,4 +736,21 @@ class OBargainModel extends Model
return
$agent_arr
;
}
/**
* 获取正常成交报告
*
* @param $field
* @param $id
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getCheckBargain
(
string
$field
,
int
$id
)
{
return
$this
->
field
(
$field
)
->
where
(
'status'
,
'in'
,
'10,11'
)
->
where
(
'id'
,
$id
)
->
find
();
}
}
\ No newline at end of file
application/model/OTaxes.php
View file @
770cebc5
...
...
@@ -56,6 +56,7 @@ class OTaxes extends BaseModel
* @throws \Exception
*/
public
function
addTaxes
(
$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'
];
...
...
@@ -65,6 +66,10 @@ class OTaxes extends BaseModel
$insert_data
[
$k
][
'father_id'
]
=
$father_id
;
$insert_data
[
$k
][
'total_fee'
]
=
$total_fee
;
$insert_data
[
$k
][
'operation_date'
]
=
$operation_date
;
$insert_data
[
$k
][
'agent_id'
]
=
$v
[
'agent_id'
];
$insert_data
[
$k
][
'agent_name'
]
=
$v
[
'agent_name'
];
$insert_data
[
$k
][
'role'
]
=
$v
[
'role'
];
$insert_data
[
$k
][
'scale'
]
=
$v
[
'scale'
];
}
return
$this
->
saveAll
(
$insert_data
);
...
...
@@ -91,12 +96,13 @@ class OTaxes extends BaseModel
$result
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
;
if
(
isset
(
$v
[
'id'
]))
{
$result
[
$k
][
'fee_list'
]
=
$this
->
field
(
'a.id as feed_id,a.fee,
c.phone,c.name,b.role,b
.scale'
)
if
(
isset
(
$v
[
'id'
])
&&
$v
[
'bargain_id'
]
)
{
$result
[
$k
][
'fee_list'
]
=
$this
->
field
(
'a.id as feed_id,a.fee,
b.phone,b.name,a.role,a
.scale'
)
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'a_agents c'
,
'b.agent_id = c.id'
,
'left'
)
->
where
(
'a.father_id'
,
$v
[
'id'
])
->
select
();
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
where
(
'a.father_id'
,
$v
[
'id'
])
->
where
(
'a.bargain_id'
,
$v
[
'bargain_id'
])
->
select
();
}
}
...
...
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