Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
e7a61202
Commit
e7a61202
authored
Apr 21, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
72b216f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
xgg-saas-platform/app/base/controller/impl/saas/invoiceCtl.js
+22
-4
No files found.
xgg-saas-platform/app/base/controller/impl/saas/invoiceCtl.js
View file @
e7a61202
...
...
@@ -8,6 +8,7 @@ class InvoiceCtl extends CtlBase {
constructor
()
{
super
();
this
.
saasinvoiceSve
=
system
.
getObject
(
"service.saas.saasinvoiceSve"
);
this
.
merchantSve
=
system
.
getObject
(
"service.saas.merchantSve"
);
this
.
orderSve
=
system
.
getObject
(
"service.saas.orderSve"
);
this
.
tradeSve
=
system
.
getObject
(
"service.trade.tradeSve"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
...
...
@@ -113,6 +114,14 @@ class InvoiceCtl extends CtlBase {
if
(
!
items
||
items
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"该发票缺少交易信息,请联系平台查看原因"
);
}
let
tmp
=
items
[
0
];
let
signinfo
=
await
this
.
merchantSve
.
signInfo
({
id
:
tmp
.
saas_merchant_id
});
if
(
!
signinfo
||
!
signinfo
.
data
)
{
return
system
.
getResult
(
null
,
"商户签约信息不存在,请先做签约配置"
);
}
let
invoice_service_rate
=
signinfo
.
data
.
invoice_service_rate
||
0
;
let
bmMap
=
{};
let
creditCodes
=
[];
for
(
let
item
of
items
)
{
...
...
@@ -135,6 +144,7 @@ class InvoiceCtl extends CtlBase {
for
(
let
item
of
itemList
)
{
amount
=
amount
+
Number
(
item
.
amt
||
0
);
}
let
service_tax
=
parseFloat
((
Number
(
amount
)
*
Number
(
invoice_service_rate
)
/
100
).
toFixed
(
2
));
calcParams
.
push
({
"credit_code"
:
creditCode
,
"invoiced_time"
:
moment
().
format
(
"YYYY-MM-DD hh:mm:ss"
),
...
...
@@ -151,7 +161,7 @@ class InvoiceCtl extends CtlBase {
"invoice_amount"
:
system
.
y2f
(
amount
),
"personal_invoice_tax"
:
0
,
"additional_tax"
:
0
,
"service_tax"
:
0
,
"service_tax"
:
system
.
y2f
(
service_tax
)
,
"value_added_tax"
:
0
,
"unit"
:
""
,
"quantity"
:
""
,
...
...
@@ -197,11 +207,11 @@ class InvoiceCtl extends CtlBase {
additional_tax_total
=
additional_tax_total
+
Number
(
invoiceCalc
.
additional_tax
);
personal_invoice_tax_total
=
personal_invoice_tax_total
+
Number
(
invoiceCalc
.
personal_invoice_tax
);
value_added_tax_total
=
value_added_tax_total
+
Number
(
invoiceCalc
.
value_added_tax
);
service_tax_total
=
service_tax_total
+
Number
(
invoiceCalc
.
service_amount
);
service_tax_total
=
service_tax_total
+
Number
(
system
.
f2y
(
invoice
.
service_tax
));
invoice
.
personal_invoice_tax
=
system
.
toFloat
(
Number
(
invoiceCalc
.
personal_invoice_tax
));
invoice
.
additional_tax
=
system
.
toFloat
(
Number
(
invoiceCalc
.
additional_tax
));
invoice
.
service_tax
=
system
.
toFloat
(
Number
(
invoiceCalc
.
service_amount
));
invoice
.
value_added_tax
=
system
.
toFloat
(
Number
(
invoiceCalc
.
value_added_tax
));
}
...
...
@@ -285,8 +295,16 @@ class InvoiceCtl extends CtlBase {
mail_addr
:
this
.
trim
(
params
.
mail_addr
),
mail_mobile
:
this
.
trim
(
params
.
mail_mobile
),
mail_to
:
this
.
trim
(
params
.
mail_to
),
};
personal_invoice_tax
:
invoice
.
personal_invoice_tax
||
0
,
additional_tax
:
invoice
.
additional_tax
||
0
,
service_tax
:
invoice
.
service_tax
||
0
,
value_added_tax
:
invoice
.
value_added_tax
||
0
,
unit
:
this
.
trim
(
invoice
.
unit
),
quantity
:
this
.
trim
(
invoice
.
quantity
),
price
:
this
.
trim
(
invoice
.
price
),
remark
:
this
.
trim
(
invoice
.
remark
),
};
applyList
.
push
(
data
);
}
let
rs
=
await
this
.
saasinvoiceSve
.
applyBulkSave
({
...
...
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