Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
php_frq_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
22e9d44d
authored
Mar 19, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1
parent
57931080
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
app/Http/Controllers/ApiController.php
app/Model/InquiryItemsReportModel.php
app/Http/Controllers/ApiController.php
View file @
22e9d44d
...
...
@@ -128,11 +128,10 @@ class ApiController extends Controller
if
(
$data
[
0
]
>
0
){
Export
(
$data
);
}
$inquiry_id
=
$data
[
2
][
"inquiry_id"
];
}
else
{
$inquiry_id
=
@
$_REQUEST
[
"inquiry_id"
];
}
$InquiryItemsReportModel
->
createSalePdf
(
$inquiry_id
);
$report_ids
=
@
$input
[
"report_ids"
];
$inquiry_id
=
@
$input
[
"inquiry_id"
];
$InquiryItemsReportModel
->
createSalePdf
(
$inquiry_id
,
$report_ids
);
}
//删除询价列表
...
...
@@ -236,4 +235,16 @@ class ApiController extends Controller
Export
((
new
InquiryModel
())
->
inquiryCount
(
$input
));
}
// 检测是否符合生成报价单
public
function
ApiCheckReport
(
$input
,
$id
)
{
Export
((
new
InquiryItemsReportModel
())
->
checkReport
(
$input
));
}
// 检测是否符合生成销售订单
public
function
ApiCheckOrder
(
$input
,
$id
)
{
Export
((
new
InquiryItemsReportModel
())
->
checkOrder
(
$input
));
}
}
app/Model/InquiryItemsReportModel.php
View file @
22e9d44d
...
...
@@ -67,7 +67,7 @@ class InquiryItemsReportModel extends Model
}
//生成报价pdf
public
function
createSalePdf
(
$inquiry_id
=
""
){
public
function
createSalePdf
(
$inquiry_id
=
""
,
$report_ids
=
""
){
if
(
$inquiry_id
==
""
){
return
[
1001
,
"询价单号不得为空!"
];
}
...
...
@@ -82,7 +82,7 @@ class InquiryItemsReportModel extends Model
$data
[
"user"
]
=
[
"name"
=>
$mainArr
[
"user_name"
]];
#询价明细
$itemsArr
=
$this
->
where
(
"inquiry_id"
,
$inquiry_id
)
->
get
()
->
toArray
();
$itemsArr
=
$this
->
where
In
(
"id"
,
explode
(
","
,
$report_ids
)
)
->
get
()
->
toArray
();
$quote_price_count
=
0
;
foreach
(
$itemsArr
as
$k
=>&
$v
){
$v
[
"quote_account"
]
=
$v
[
"price_rmb"
]
>
0
?
$v
[
"price_rmb"
]
*
$v
[
"inquiry_number"
]
:
$v
[
"price_origin"
]
*
$v
[
"inquiry_number"
];
...
...
@@ -139,6 +139,21 @@ class InquiryItemsReportModel extends Model
return
[
0
,
"成功"
];
}
/*
* 判断是否能生成销售单
*/
public
function
checkOrder
(
$input
){
$check
=
$this
->
where
([
"price_origin"
=>
0
,
"price_rmb"
=>
0
])
->
whereIn
(
"id"
,
explode
(
","
,
$input
[
"report_ids"
]))
->
count
();
return
$check
>
0
?
[
1001
,
"没有销售报价的报价单不能生成销售订单"
]
:
[
0
,
"通过"
];
}
/*
* 判断是否能生成报价单
*/
public
function
checkReport
(
$input
){
$itemsIdArr
=
explode
(
","
,
$input
[
"inquiry_items_ids"
]);
$check
=
(
new
QuoteModel
())
->
where
(
"status"
,
3
)
->
whereIn
(
"inquiry_items_id"
,
$itemsIdArr
)
->
count
();
return
$check
!=
count
(
$itemsIdArr
)
?
[
1001
,
"没有销售报价的报价单不能生成销售订单"
]
:
[
0
,
"通过"
];
}
}
\ No newline at end of file
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