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
86c7289c
Commit
86c7289c
authored
Apr 10, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
34e85209
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
xgg-admin/app/base/service/impl/invoice/invoiceSve.js
+23
-21
No files found.
xgg-admin/app/base/service/impl/invoice/invoiceSve.js
View file @
86c7289c
...
...
@@ -276,6 +276,9 @@ class InvoiceService extends ServiceBase {
if
(
!
this
.
INVOICE_TYPE
.
includes
(
this
.
trim
(
params
.
invoice_type
))){
return
system
.
getResult
(
null
,
`参数错误,发票类型不存在`
);
}
if
(
!
this
.
trim
(
params
.
invoice_amount
)){
return
system
.
getResult
(
null
,
`参数错误,发票金额非法`
);
}
try
{
//取出个体工商户信息
var
businessRes
=
await
this
.
businessmenSve
.
queryObusinessmenByCreditCode
({
...
...
@@ -288,7 +291,7 @@ class InvoiceService extends ServiceBase {
if
(
!
businessmenBean
.
sign_time
)
{
return
system
.
getResult
(
null
,
`个体户未签约`
);
}
params
.
invoice_amount
=
system
.
y2f
(
this
.
trim
(
params
.
invoice_amount
));
//增值税累计类型 1按月 2按季度 add_value_up_type
//个税累计类型 1按月累计 2按季度累计 tax_up_type
let
accumulatedAmountParams
=
{
...
...
@@ -304,44 +307,43 @@ class InvoiceService extends ServiceBase {
}
let
additional_tax_total
=
invoiceRes
.
data
.
addValueRes
.
additional_tax_total
,
//附加税累计总和
value_added_tax_total
=
invoiceRes
.
data
.
addValueRes
.
value_added_tax_total
,
//增值税累计总和
invoice_amount_total
=
invoiceRes
.
data
.
addValueRes
.
invoice_amount_total
;
//增值税累计价税总和 (计算不对)
invoice_amount_total
=
new
Decimal
(
invoiceRes
.
data
.
addValueRes
.
invoice_amount_total
).
plus
(
params
.
invoice_amount
)
;
//增值税累计价税总和 (计算不对)
let
personal_invoice_tax_total
=
invoiceRes
.
data
.
taxValueRes
.
personal_invoice_tax_total
;
//个税累计总和
personal_invoice_amount_total
=
invoiceRes
.
data
.
taxValueRes
.
personal_invoice_amount_total
;
//个税价税累计总和 (计算不对)
let
personal_invoice_amount_total
=
new
Decimal
(
invoiceRes
.
data
.
taxValueRes
.
personal_invoice_amount_total
).
plus
(
params
.
invoice_amount
)
;
//个税价税累计总和 (计算不对)
//**********************************************************一下是计算个税********************************************************************************************** */
let
apettemp
=
Decimal
(
1
).
plus
(
Decimal
.
div
(
businessmenBean
.
tax_rate
,
100
));
//此参数 在计算附加税和增值税 复用
let
apettemp
=
Decimal
(
1
).
plus
(
Decimal
.
div
(
businessmenBean
.
tax_rate
,
100
))
.
toNumber
()
;
//此参数 在计算附加税和增值税 复用
//累计不含税价(个税)
let
accumulatedPriceExcludingTax
=
Decimal
.
div
(
personal_invoice_amount_total
,
apettemp
);
let
accumulatedPriceExcludingTax
=
Decimal
.
div
(
personal_invoice_amount_total
,
apettemp
)
.
toNumber
()
;
let
aptemp
=
new
Decimal
(
1
).
sub
(
Decimal
.
div
(
businessmenBean
.
cost_rate
,
100
));
let
aptemp
=
new
Decimal
(
1
).
sub
(
Decimal
.
div
(
businessmenBean
.
cost_rate
,
100
))
.
toNumber
()
;
//累计利润
let
accumulatedProfit
=
new
Decimal
(
accumulatedPriceExcludingTax
).
mul
(
aptemp
);
let
accumulatedProfit
=
new
Decimal
(
accumulatedPriceExcludingTax
).
mul
(
aptemp
)
.
toNumber
()
;
//计算梯度的增值税附加税个税 的税率 {rate,qcd,zengzhiRate,fujiaRate}
let
rateRes
=
this
.
findTaxAndQCD
(
accumulatedProfit
,
params
.
invoice_type
,
businessmenBean
);
//个税 = 累计利润*个税税率-速算扣除数-该月/季度 累计缴纳的个税
let
personal_invoice_tax
=
new
Decimal
(
accumulatedProfit
).
mul
(
rateRes
.
rate
).
sub
(
rateRes
.
qcd
).
sub
(
personal_invoice_tax_total
).
toFixed
(
2
);
let
personal_invoice_tax
=
new
Decimal
(
accumulatedProfit
).
mul
(
rateRes
.
rate
).
sub
(
rateRes
.
qcd
).
sub
(
personal_invoice_tax_total
).
toNumber
(
).
toFixed
(
2
);
//***********************************************************一下是计算附加税和增值税******************************************************************************** */
//累计不含税价(个税)
let
accumulatedPriceExcludingTax
=
Decimal
.
div
(
invoice_amount_total
,
apettemp
);
let
accumulatedPriceExcludingTax
1
=
Decimal
.
div
(
invoice_amount_total
,
apettemp
).
toNumber
(
);
//计算梯度的增值税附加税个税 的税率 {rate,qcd,zengzhiRate,fujiaRate}
let
AVRateRes
=
this
.
findTaxAndQCD
(
accumulatedPriceExcludingTax
,
params
.
invoice_type
,
businessmenBean
);
let
AVRateRes
=
this
.
findTaxAndQCD
(
accumulatedPriceExcludingTax
1
,
params
.
invoice_type
,
businessmenBean
);
//增值税税 = 累计不含税价*增值税-该月累计缴纳的增值税
let
value_added_tax
=
new
Decimal
(
invoice_amount_total
).
mul
(
AVRateRes
.
zengzhiRate
).
sub
(
value_added_tax_total
).
toFixed
(
2
);
let
value_added_tax
=
new
Decimal
(
accumulatedPriceExcludingTax1
).
mul
(
AVRateRes
.
zengzhiRate
).
sub
(
value_added_tax_total
).
toNumber
(
).
toFixed
(
2
);
//附加税 =增值税*附加税
let
additional_tax
=
new
Decimal
(
invoice_amount_total
).
mul
(
AVRateRes
.
zengzhiRate
).
toFixed
(
2
);
let
additional_tax
=
new
Decimal
(
value_added_tax
).
mul
(
AVRateRes
.
fujiaRate
).
toNumber
(
).
toFixed
(
2
);
//************************************************************一下是计算服务费************************************* */
let
service_rate
=
new
Decimal
(
businessmenBean
).
div
(
100
);
let
service_amount
=
new
Decimal
(
this
.
trim
(
params
.
invoice_amount
)).
mul
(
businessmenBean
.
service_rate
);
let
service_rate
=
new
Decimal
(
businessmenBean
.
service_rate
).
div
(
100
).
toNumber
(
);
let
service_amount
=
new
Decimal
(
params
.
invoice_amount
).
mul
(
service_rate
).
toNumber
(
);
personal_invoice_tax
=
system
.
f2y
(
personal_invoice_tax
);
value_added_tax
=
system
.
f2y
(
value_added_tax
);
additional_tax
=
system
.
f2y
(
additional_tax
);
...
...
@@ -365,23 +367,23 @@ class InvoiceService extends ServiceBase {
let
tax_ladder
=
null
,
other_ladder
=
null
;
if
(
invoice_type
==
"10"
){
//专业发票
tax_ladder
=
JSON
.
parse
(
businessmenBean
.
common_tax_ladder
);
o
ht
er_ladder
=
JSON
.
parse
(
businessmenBean
.
common_ohter_ladder
);
o
th
er_ladder
=
JSON
.
parse
(
businessmenBean
.
common_ohter_ladder
);
}
else
{
//普通发票
tax_ladder
=
JSON
.
parse
(
businessmenBean
.
special_tax_ladder
);
o
ht
er_ladder
=
JSON
.
parse
(
businessmenBean
.
special_other_ladder
);
o
th
er_ladder
=
JSON
.
parse
(
businessmenBean
.
special_other_ladder
);
}
let
rate
=
0
,
qcd
=
0
,
zengzhiRate
=
0
,
fujiaRate
=
0
;
for
(
let
item
of
tax_ladder
){
//计算个税的税率和速算扣除数
if
(
item
.
minValue
<=
invoice_amount
&&
item
.
maxValue
>=
invoice_amount
){
qcd
=
item
.
quicalDed
||
0
;
rate
=
item
.
rate
||
0
;
rate
=
new
Decimal
(
item
.
rate
).
div
(
100
).
toNumber
()
||
0
;
}
}
for
(
let
temp
of
other_ladder
){
//计算增/附加 税的税率和速算扣除数
if
(
item
.
minValue
<=
invoice_amount
&&
item
.
maxValue
>=
invoice_amount
){
zengzhiRate
=
temp
.
fujiaRate
||
0
;
fujiaRate
=
temp
.
fujiaRate
||
0
;
if
(
temp
.
minValue
<=
invoice_amount
&&
temp
.
maxValue
>=
invoice_amount
){
zengzhiRate
=
new
Decimal
(
temp
.
zengzhiRate
).
div
(
100
).
toNumber
()
||
0
;
fujiaRate
=
new
Decimal
(
temp
.
fujiaRate
).
div
(
100
).
toNumber
()
||
0
;
}
}
return
{
rate
,
qcd
,
zengzhiRate
,
fujiaRate
};
...
...
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