Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
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
02219f5c
authored
May 07, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
供应商打印字段问题
parent
009a09b6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
112 additions
and
12 deletions
app/Http/Services/DataService.php
app/Http/Services/SupplierService.php
app/Http/routes.php
config/fixed.php
resources/views/web/PrintSupplier.blade.php
storage/exports/supplier_level.xls
app/Http/Services/DataService.php
View file @
02219f5c
...
...
@@ -558,7 +558,7 @@ class DataService
$supplierAttachments
=
SupplierAttachmentModel
::
get
()
->
toArray
();
foreach
(
$supplierAttachments
as
$supplierAttachment
)
{
$supplierId
=
$supplierAttachment
[
'supplier_id'
];
if
(
SupplierAttachmentsModel
::
where
(
'supplier_id'
,
$supplierId
)
->
exists
())
{
if
(
SupplierAttachmentsModel
::
where
(
'supplier_id'
,
$supplierId
)
->
exists
())
{
continue
;
}
$fields
=
[
...
...
@@ -587,7 +587,7 @@ class DataService
'type_name'
=>
array_get
(
config
(
'fixed.FileNameMapping'
),
$item
[
'name'
]),
'field_name'
=>
$item
[
'name'
],
'file_url'
=>
$item
[
'url'
],
'file_name'
=>
array_get
(
$item
,
'file_name'
,
''
),
'file_name'
=>
array_get
(
$item
,
'file_name'
,
''
),
];
}
}
...
...
@@ -597,6 +597,104 @@ class DataService
SupplierAttachmentsModel
::
insert
(
$attachmentData
);
}
}
//转换交易方式和付款方式数据统一到付款方式
public
function
transferPayType
(
$change
=
false
)
{
$suppliersA
=
SupplierChannelModel
::
where
(
'trading_method'
,
'!='
,
0
)
->
where
(
'pay_type'
,
'!='
,
0
)
->
get
()
->
toArray
();
$suppliersB
=
SupplierChannelModel
::
where
(
'trading_method'
,
'!='
,
0
)
->
where
(
'pay_type'
,
0
)
->
get
()
->
toArray
();
$suppliersC
=
SupplierChannelModel
::
where
(
'trading_method'
,
0
)
->
where
(
'pay_type'
,
'!='
,
0
)
->
get
()
->
toArray
();
$handledSupplierIds
=
[];
//如果供应商交易方式与付款方式都有数据,则付款周期从交易方式中映射,映射规则:先款后货映射成预付款;月结映射成账期;
if
(
$suppliersA
)
{
foreach
(
$suppliersA
as
$supplier
)
{
if
(
$supplier
[
'trading_method'
]
==
1
)
{
$payType
=
3
;
}
else
{
$payType
=
1
;
}
$tradeMethod
=
array_get
(
config
(
'fixed.TradingMethod'
),
$supplier
[
'trading_method'
]);
$payTypeName
=
array_get
(
config
(
'fixed.SupplierPayType'
),
$payType
);
dump
(
"供应商编码 ${supplier['supplier_code']} 原来的交易方式为
$tradeMethod
转换成付款周期
$payTypeName
"
);
if
(
$change
)
{
$handledSupplierIds
[]
=
$supplier
[
'supplier_id'
];
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'pay_type'
=>
$payType
,
]);
}
}
}
dump
(
'--------------------------------'
);
//如果供应商交易方式有数据,付款方式无数据,则付款周期从交易方式中映射,映射规则:先款后货映射成预付款;月结映射成账期;
if
(
$suppliersB
)
{
foreach
(
$suppliersB
as
$supplier
)
{
if
(
$supplier
[
'trading_method'
]
==
1
)
{
$payType
=
3
;
}
else
{
$payType
=
1
;
}
$tradeMethod
=
array_get
(
config
(
'fixed.TradingMethod'
),
$supplier
[
'trading_method'
]);
$payTypeName
=
array_get
(
config
(
'fixed.SupplierPayType'
),
$payType
);
dump
(
"供应商编码 ${supplier['supplier_code']} 原来的交易方式为
$tradeMethod
转换成付款周期
$payTypeName
"
);
if
(
$change
)
{
$handledSupplierIds
[]
=
$supplier
[
'supplier_id'
];
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'pay_type'
=>
$payType
,
]);
}
}
}
dump
(
'--------------------------------'
);
//如果供应商交易方式无数据,付款方式有数据,则付款周期从付款方式中映射,映射规则:账期-周期结算映射成账期,账期-定期结算映射成账期,全款映射成预付款,定金映射成预付款;
if
(
$suppliersC
)
{
foreach
(
$suppliersC
as
$supplier
)
{
$payType
=
0
;
if
(
!
trim
(
$supplier
[
'pay_type'
]))
{
continue
;
}
switch
(
trim
(
$supplier
[
'pay_type'
]))
{
case
1
:
$payType
=
1
;
break
;
case
2
:
$payType
=
1
;
break
;
case
3
:
$payType
=
3
;
break
;
case
4
:
$payType
=
3
;
break
;
}
$originPayTypeNameMap
=
[
1
=>
'账期-周期结算'
,
2
=>
'账期-定期结算'
,
3
=>
'全款'
,
4
=>
'定金'
,
];
$originPayTypeName
=
array_get
(
$originPayTypeNameMap
,
$supplier
[
'pay_type'
]);
$payTypeName
=
array_get
(
config
(
'fixed.SupplierPayType'
),
$payType
);
dump
(
"供应商编码 ${supplier['supplier_code']} 原来的付款方式为
$originPayTypeName
转换成付款周期
$payTypeName
"
);
if
(
$change
&&
$payType
)
{
$handledSupplierIds
[]
=
$supplier
[
'supplier_id'
];
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'pay_type'
=>
$payType
,
]);
}
}
}
}
}
app/Http/Services/SupplierService.php
View file @
02219f5c
...
...
@@ -10,6 +10,7 @@ use App\Model\LogModel;
use
App\Model\RedisModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierAttachmentModel
;
use
App\Model\SupplierAttachmentsModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierReceiptModel
;
...
...
@@ -509,9 +510,9 @@ class SupplierService
$contactService
=
new
SupplierContactService
();
$contact
=
$contactService
->
getContactForPrint
(
$supplierId
);
$printData
[
'contact'
]
=
$contact
;
$attachmentModel
=
new
SupplierAttachmentModel
();
$hasAgreement
=
$attachmentModel
->
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'quality_assurance_agreement'
)
?
'已签'
:
'未签'
;
$attachmentModel
=
new
SupplierAttachment
s
Model
();
$hasAgreement
=
$attachmentModel
->
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'field_name'
,
'quality_assurance_agreement'
)
->
exists
(
)
?
'已签'
:
'未签'
;
$printData
[
'has_agreement'
]
=
$hasAgreement
;
$adminUserService
=
new
AdminUserService
();
$user
=
$adminUserService
->
getAdminUserInfo
(
request
()
->
user
->
userId
);
...
...
app/Http/routes.php
View file @
02219f5c
...
...
@@ -52,5 +52,5 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$service
=
new
\App\Http\Services\DataService
();
$service
->
transfer
AttachmentToNewTable
(
);
$service
->
transfer
PayType
(
true
);
});
config/fixed.php
View file @
02219f5c
...
...
@@ -86,6 +86,7 @@ return [
],
'SupplierPayType'
=>
[
//下面的注释指的是老的付款方式
//全款
3
=>
'预付款'
,
//账期-周期结算
...
...
resources/views/web/PrintSupplier.blade.php
View file @
02219f5c
...
...
@@ -113,12 +113,12 @@
style=
"text-align: left;padding-left: 20px"
>
{{$printData['ticket_time'] or ''}}
</td>
</tr>
<tr>
{{--
<td
width=
"20%"
colspan=
"1"
>
账期详情*
</td>
--}}
<td
width=
"20%"
colspan=
"1"
></td>
<td
width=
"20%"
colspan=
"1"
>
账期详情*
</td>
{{--
<td
width=
"20%"
colspan=
"1"
></td>
--}}
<td
width=
"80%"
colspan=
"5"
>
{{$printData['pay_type_name'] or ''}}
</td>
{{-- style="text-align: left;padding-left: 20px">{{$printData['pay_type_name'] or ''}}
</td>
--}}
{{--
<td
width=
"80%"
colspan=
"5"
--
}}
{{
--
style=
"text-align: left;padding-left: 20px"
>
{{$printData['billing_period_detail'] or ''}}
</td>
--}}
<td
width=
"80%"
colspan=
"5"
style=
"text-align: left;padding-left: 20px"
></td>
{{
--
style=
"text-align: left;padding-left: 20px"
></td>
--}}
</tr>
<tr>
<td
width=
"20%"
colspan=
"1"
>
业务负责人
</td>
...
...
@@ -169,7 +169,7 @@
</div>
<div
class=
"layui-col-md3"
>
</div>
<script>
window
.
print
();
//
window.print();
</script>
</div>
...
...
storage/exports/supplier_level.xls
100644 → 100755
View file @
02219f5c
No preview for this file type
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