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
7aff6a13
authored
Mar 27, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
merge
parents
96d6a0e3
f6b88b57
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
43 deletions
app/Http/Controllers/ApiController.php
app/Model/InquiryItemsModel.php
app/Model/InquiryItemsReportModel.php
app/Model/InquiryModel.php
app/Model/QuoteModel.php
config/cache.php
resources/views/pdf/sale.blade.php
app/Http/Controllers/ApiController.php
View file @
7aff6a13
...
...
@@ -121,7 +121,7 @@ class ApiController extends Controller
Export
((
new
InquiryModel
())
->
editInquiry
(
$input
));
}
//生成报价/销售 询价单
private
function
ApiAddInquiryReport
(
$input
,
$id
){
private
function
ApiAddInquiryReport
(
$input
,
$id
){
$InquiryItemsReportModel
=
new
InquiryItemsReportModel
();
if
(
@
$_REQUEST
[
"debug"
]
!=
100
){
$data
=
$InquiryItemsReportModel
->
addOffer
(
$input
);
...
...
app/Model/InquiryItemsModel.php
View file @
7aff6a13
...
...
@@ -356,6 +356,7 @@ class InquiryItemsModel extends Model
$con
->
beginTransaction
();
$assignInsert
=
[];
#指定领取人
$c
=
0
;
#重复
foreach
(
$goodsData
[
1
]
as
$k
=>&
$b
){
$insertArr
=
[
...
...
@@ -377,7 +378,13 @@ class InquiryItemsModel extends Model
#判断是否已经存在此品牌+型号
$check
=
$this
->
where
([
"inquiry_id"
=>
$inquiry_id
,
"goods_name"
=>
$b
[
"goods_name"
],
"brand_name"
=>
$b
[
"brand_name"
]])
->
count
();
if
(
$check
>
0
){
throw
new
Exception
(
"型号:"
.
$b
[
"goods_name"
]
.
" 品牌:"
.
$b
[
"brand_name"
]
.
"不得重复上传"
);
$c
++
;
continue
;
#throw new Exception("型号:".$b["goods_name"]." 品牌:".$b["brand_name"]."不得重复上传");
}
if
(
count
(
$goodsData
[
1
])
==
$c
){
throw
new
Exception
(
"所有数据都存在重复!"
);
}
...
...
@@ -470,8 +477,9 @@ class InquiryItemsModel extends Model
$b2
[
"inquiry_id"
]
=
$inquiry_id
;
$hang
=
$a2
+
2
;
#对应excel第几行
$lie
=
0
;
foreach
(
$b2
as
$key
=>
$val
)
{
$lie
=
$
key
+
1
;
$lie
=
$
lie
+
1
;
$str_msg
=
'第'
.
$hang
.
'行'
.
$lie
.
'列:'
;
if
(
in_array
(
$key
,
$filer_need
)
&&
empty
(
$val
))
{
$err
[]
=
$str_msg
.
'数据不得为空'
;
...
...
app/Model/InquiryItemsReportModel.php
View file @
7aff6a13
...
...
@@ -112,18 +112,20 @@ class InquiryItemsReportModel extends Model
}
/*
* 选中或者确定报价
* 选中或者确定
报价
*/
public
function
OpQuote
(
$data
){
$inquiry_items_id
=
$data
[
"inquiry_items_id"
];
#询价明细id
$quote_id
=
$data
[
"quote_id"
];
#报价id
$status
=
$data
[
"status"
];
#状态: 2 选中 3 确定
$delivery_time
=
$data
[
"delivery_time"
];
#货期
$price
=
@
$data
[
"price"
]
?
$data
[
"price"
]
:
0
;
#销售报价
if
(
$inquiry_items_id
<=
0
)
return
[
1001
,
"询价明细ID不得为空"
];
if
(
$quote_id
<=
0
)
return
[
1001
,
"报价ID不得为空"
];
$price
=
@
$data
[
"price"
]
?
$data
[
"price"
]
:
0
;
#销售报价
$QuoteModel
=
new
QuoteModel
();
$InquiryItemsModel
=
new
InquiryItemsModel
();
$quoteItem
=
$QuoteModel
->
where
(
"id"
,
$quote_id
)
->
first
()
->
toArray
();
$currency
=
$quoteItem
[
"currency"
];
#报价币种
...
...
@@ -131,6 +133,19 @@ class InquiryItemsReportModel extends Model
$mainCurrency
=
$inquiry
[
"currency"
];
#询价主单币种
$rate
=
(
new
CommonModel
())
->
getRate
(
"美元"
);
#获取美元汇率
$itemInfo
=
$InquiryItemsModel
->
select
(
"status"
)
->
where
(
"id"
,
$inquiry_items_id
)
->
first
()
->
toArray
();
#询价明细
if
(
$status
==
1
){
#撤销
$InquiryItemsModel
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
1
]);
#更新报价待报价
#更新关联除了当前询价单 此询价明细的报价单状态
$QuoteModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
1
]);
#重启其他所有状态为 已报价
return
[
0
,
"撤销成功"
];
}
if
(
$status
==
2
&&
$itemInfo
[
"status"
]
==
5
){
#选中之前判断有没有确定的报价
return
[
1007
,
"请先撤销已确认的报价"
];
}
$price_rmb
=
$price_origin
=
""
;
if
(
$mainCurrency
==
1
){
#询价币种人民币
$price_rmb
=
$currency
!=
$mainCurrency
?
round
(
$price
*
$rate
,
6
)
:
$price
;
...
...
@@ -149,18 +164,21 @@ class InquiryItemsReportModel extends Model
"class_id2_name"
=>
$quoteItem
[
"class_id2_name"
],
"price_rmb"
=>
$price_rmb
,
"price_origin"
=>
$price_origin
,
"price_profile"
=>
$price
,
"inquiry_number"
=>
$quoteItem
[
"quote_number"
],
"delivery_time"
=>
$
quoteItem
[
"delivery_time"
]
,
"delivery_time"
=>
$
delivery_time
,
"batch"
=>
$quoteItem
[
"batch"
],
"create_time"
=>
time
()
,
];
#更新报价报表
(
new
InquiryItemsReportModel
())
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
(
$temp
);
#更新报价单
(
new
QuoteModel
())
->
where
(
"id"
,
$data
[
"quote_id"
])
->
update
([
"status"
=>
$data
[
"status"
]]);
#更新报价选中
#更新当前报价单状态
$QuoteModel
->
where
(
"id"
,
$data
[
"quote_id"
])
->
update
([
"status"
=>
$status
]);
#更新报价选中
#更新关联除了当前询价单 此询价明细的报价单状态
$QuoteModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
whereNotIn
(
"id"
,[
$quote_id
])
->
update
([
"status"
=>
1
]);
#重启其他所有状态为 已报价
#更新询价明细表状态
(
new
InquiryItemsModel
())
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
$
data
[
"status"
]
==
2
?
3
:
5
]);
(
new
InquiryItemsModel
())
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
$
status
==
2
?
3
:
5
]);
return
[
0
,
"成功"
];
}
...
...
app/Model/InquiryModel.php
View file @
7aff6a13
...
...
@@ -135,7 +135,7 @@ class InquiryModel extends Model
$currency_sign
=
$v
[
'currency'
]
==
1
?
'¥'
:
'$'
;
$v
[
'target_price'
]
=
$currency_sign
.
$v
[
'target_price'
];
// 客户目标报价
$v
[
'target_price'
]
=
$currency_sign
.
$v
[
'target_price'
]
.
"
\t
"
;
// 客户目标报价
#查询所有报价
$v
[
'quote_price'
]
=
"--"
;
...
...
app/Model/QuoteModel.php
View file @
7aff6a13
...
...
@@ -42,8 +42,8 @@ class QuoteModel extends Model
->
paginate
(
@
$input
[
'limit'
]
?
$input
[
"limit"
]
:
10
,
[
'*'
],
'p'
,
@
$input
[
'p'
]
?
$input
[
"p"
]
:
1
)
->
toArray
();
if
(
!
$list
)
return
[
20001
,
'没有数据'
];
foreach
(
$list
[
'data'
]
as
$k
=>&
$v
){
$v
[
"price_origin"
]
=
"$"
.
$v
[
"price_origin"
]
;
$v
[
"price_rmb"
]
=
"¥"
.
$v
[
"price_rmb"
]
;
$v
[
"price_origin"
]
=
$v
[
"currency"
]
==
2
?
"$"
.
$v
[
"price_origin"
]
:
""
;
$v
[
"price_rmb"
]
=
$v
[
"currency"
]
==
1
?
"¥"
.
$v
[
"price_rmb"
]
:
""
;
$v
[
'status'
]
=
QuoteMap
::
$status
[
$v
[
"status"
]];
if
(
$v
[
"create_name"
]
==
"digikey"
){
$v
[
"create_name"
]
=
"digikey(包装:"
.
$v
[
"raw_goods_packing"
]
.
")"
;
...
...
@@ -710,37 +710,28 @@ class QuoteModel extends Model
->
count
();
}
//询价:
选中 撤销 确认 -》
报价
//询价:
撤销
报价
public
function
updateStatus
(
$input
)
{
$id
=
$input
[
'id'
];
$
quote_
id
=
$input
[
'id'
];
$status
=
$input
[
'status'
];
if
(
!
$id
)
return
[
-
1
,
'参数缺失'
];
if
(
!
$
quote_
id
)
return
[
-
1
,
'参数缺失'
];
try
{
$QuoteModel
=
new
QuoteModel
();
$InquiryItemsModel
=
new
InquiryItemsModel
();
$rqpConn
=
DB
::
connection
(
'rfq'
);
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
$status
,
'update_time'
=>
time
()]);
$quote_info
=
$this
->
find
(
$id
);
$info
=
$QuoteModel
->
select
(
"inquiry_items_id"
)
->
where
(
"id"
,
$quote_id
)
->
first
()
->
toArray
();
$inquiry_items_id
=
$info
[
"inquiry_items_id"
];
#更新询价明细表状态
$inquiry_items_id
=
$quote_info
[
"inquiry_items_id"
];
$sql
=
"select status from lie_quote where inquiry_items_id=
$inquiry_items_id
and status in (1,2,3) and id not in (
$id
)"
;
$has
=
$rqpConn
->
select
(
$sql
);
$check
=
1
;
if
(
$has
){
$check
=
0
;
}
if
(
$check
){
(
new
InquiryItemsModel
())
->
where
(
"id"
,
$quote_info
[
"inquiry_items_id"
])
->
update
([
"status"
=>
$status
]);
}
$InquiryItemsModel
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
2
,
'update_time'
=>
time
()]);
#更新报价待报价
#更新
$QuoteModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
1
,
'update_time'
=>
time
()]);
#重启其他所有状态为 已报价
$data
=
[];
$data
[
'types'
]
=
1
;
$data
[
'relation_id'
]
=
$id
;
$data
[
'relation_sn'
]
=
$quote_info
[
'quote_sn'
];
$data
[
'content'
]
=
'询价操作报价:'
.
QuoteMap
::
$status
[
$status
];
$data
[
'relation_id'
]
=
$inquiry_items_id
;
$data
[
'content'
]
=
'撤销报价:'
.
QuoteMap
::
$status
[
$status
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$input
[
"user_name"
];
...
...
config/cache.php
View file @
7aff6a13
...
...
@@ -13,7 +13,7 @@ return [
|
*/
'default'
=>
env
(
'CACHE_DRIVER'
,
'file'
)
,
'default'
=>
"none"
,
/*
|--------------------------------------------------------------------------
...
...
@@ -27,7 +27,9 @@ return [
*/
'stores'
=>
[
'none'
=>
[
'driver'
=>
'null'
,
],
'apc'
=>
[
'driver'
=>
'apc'
,
],
...
...
resources/views/pdf/sale.blade.php
View file @
7aff6a13
...
...
@@ -7,12 +7,12 @@
<style
type=
"text/css"
media=
"screen"
>
*
{
font-family
:
"simsun"
;
font-weight
:
normal
;
margin
:
0px
;
padding
:
0px
;
}
/*.pdf-box{margin:0 auto;font-size: 14px;color:#333;width:900px;padding:50px;}*/
.pdf-box
{
margin
:
0
auto
;
font-size
:
14px
;
color
:
#333
;
width
:
900px
;
padding
:
5
0px
;
box-sizing
:
border-box
;}
.pdf-box
{
margin
:
0
auto
;
font-size
:
14px
;
color
:
#333
;
padding
:
1
0px
;
box-sizing
:
border-box
;}
.header
{
text-align
:
center
;
font-size
:
28px
;
color
:
#000
;
position
:
relative
;}
.header
img
{
width
:
120px
;
position
:
absolute
;
left
:
60px
;
top
:
10px
;}
.bjdx
{
background
:
#ccffff
;
font-size
:
28px
;
color
:
#0000DA
;
text-align
:
center
;}
table
{
width
:
100%
;
border-collapse
:
collapse
;}
table
,
th
,
td
{
border
:
1px
solid
#000
;}
table
{
width
:
100%
;
border-collapse
:
collapse
;
table-layout
:
fixed
;
}
table
,
th
,
td
{
border
:
1px
solid
#000
;
}
table
td
{
padding
:
10px
;}
table
td
b
,
.table-tips
b
,
.footer
b
{
font-weight
:
bold
;}
.table-tips
{
font-weight
:
bold
;
padding
:
20px
0
;
font-weight
:
normal
;}
...
...
@@ -20,6 +20,11 @@
.footer
.pr30
{
position
:
relative
;
left
:
80px
;}
.footer
.pr60
{
position
:
relative
;
left
:
107px
;}
.footer
img
{
position
:
absolute
;
left
:
731px
;
top
:
40px
;}
.table2
td
{
height
:
auto
;
overflow
:
hidden
;
white-space
:
normal
;
word-break
:
break-all
;}
</style>
</head>
<body>
...
...
@@ -60,9 +65,9 @@
<div
class=
"table2"
>
<table>
<tr>
<td>
客户型号 Cust PartNo
</td>
<td>
原厂型号 Mfr PartNo
</td>
<td>
品牌 Mfr Name
</td>
<td
width=
"18%"
>
客户型号 Cust PartNo
</td>
<td
width=
"18%"
>
原厂型号 Mfr PartNo
</td>
<td
width=
"18%"
>
品牌 Mfr Name
</td>
<td>
报价(RMB含税)Quoted Price (RMB with 13%VAT,freight fee to factory and import fee )
</td>
<td>
报价(美金)QuotedPrice In USD
</td>
<td>
数量 Quantity
</td>
...
...
@@ -74,7 +79,7 @@
@if(!empty($itemsArr)
&&
is_array($itemsArr))
@foreach($itemsArr as $k=>$v)
<tr>
<td>
{{ @$v["goods_name"] }}
</td>
<td
>
{{ @$v["goods_name"] }}
</td>
<td>
{{ @$v["goods_name_pro"] }}
</td>
<td>
{{ @$v["brand_name"] }}
</td>
<td>
{{ @$v["price_rmb"] }}
</td>
...
...
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