Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
1ccc6fa5
Commit
1ccc6fa5
authored
Nov 12, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new Formula
parent
f908095a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
334 additions
and
51 deletions
+334
-51
TaxPlanning.js
src/container/BudgetTahunan/TaxPlanning.js
+334
-51
No files found.
src/container/BudgetTahunan/TaxPlanning.js
View file @
1ccc6fa5
...
...
@@ -114,7 +114,7 @@ export default class TaxPlanning extends Component {
"submission_id"
:
this
.
props
.
submissionID
}
api
.
create
().
getDetailReportMB
(
payload
).
then
(
response
=>
{
//
console.log(response);
console
.
log
(
response
);
let
dataTable
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
.
status
==
'success'
)
{
...
...
@@ -770,6 +770,166 @@ export default class TaxPlanning extends Component {
let
dataFormula
=
[]
let
id
=
0
let
double
=
false
const
handleNewFormula
=
(
tableMeta
,
dex
,
newFormula
)
=>
{
let
splitFormula
=
String
(
newFormula
).
split
(
'@'
)
let
baru
=
[]
let
anjay
=
[]
splitFormula
.
map
((
item
)
=>
{
let
re
=
/^
[
a-zA-Z0-9_
]
+$/
;
let
items
=
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
)
if
(
item
!==
""
)
{
if
(
!
re
.
test
(
items
))
{
baru
.
push
(
String
(
item
).
substr
(
0
,
Number
(
String
(
item
).
length
)
-
1
))
baru
.
push
(
String
(
item
).
substr
(
Number
(
String
(
item
).
length
)
-
1
,
1
))
}
else
{
baru
.
push
(
String
(
item
))
}
}
})
baru
.
map
((
item
,
index
)
=>
{
if
(
item
==
'-'
||
item
==
'+'
||
item
==
'/'
||
item
==
'*'
||
item
==
'('
||
item
==
')'
)
{
anjay
.
push
(
item
)
}
else
{
if
(
String
(
item
).
includes
(
'#'
))
{
let
splitform
=
String
(
item
).
split
(
'#'
)
if
(
splitform
[
1
]
==
'TP1'
||
splitform
[
1
]
==
'TP2'
||
splitform
[
1
]
==
'TP3'
)
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
24
]
==
splitform
[
0
])
if
(
indexID
!==
-
1
)
{
let
data
=
dataTable2
[
indexID
][
19
].
tbf
.
value
console
.
log
(
dataTable2
[
indexID
][
19
].
tbf
.
value
);
// let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// let valuezz = data.value == undefined ? data : data.value
anjay
.
push
(
data
==
""
?
0
:
data
)
}
}
// else {
// if (forecast !== undefined) {
// forecast.map((item, index) => {
// if (periode == item.periode) {
// totalShldBeNil += Number(item.value)
// }
// })
// anjay.push(totalShldBeNil)
// } else if (String(item).includes('[M-1]')) {
// let tst = String(item).replace('[M-1]', '')
// let data = tableMeta.columnIndex == 9 ? 20 : tableMeta.columnIndex - 1
// let dataSub = dex == 1 ? tableMeta.rowData[data].tbc : dex == 2 ? tableMeta.rowData[data].fcp : tableMeta.rowData[data].tbf
// let period = data == 20 ? Number(this.props.periode) - 1 : this.props.periode
// let indexID = dataSub.formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
// if (indexID !== -1) {
// let valuezz = tableMeta.rowData[data].formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
// } else {
// let data = dex == 1 ? value.tbc : dex == 2 ? value.fcp : value.tbf
// // console.log(data);
// let indexID = data.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
// if (indexID !== -1) {
// let valuezz = data.formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
// }
// }
}
else
{
let
indexID
=
dataTable2
.
findIndex
((
val
)
=>
val
[
24
]
==
item
)
if
(
indexID
!==
-
1
)
{
if
(
dataTable2
[
indexID
][
24
]
==
tableMeta
.
rowData
[
24
])
{
anjay
.
push
(
0
)
}
else
{
let
data
=
dataTable2
[
indexID
][
tableMeta
.
columnIndex
]
// let data = dex == 1 ? dataTable2[indexID][tableMeta.columnIndex].tbc : dex == 2 ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// let valuezz = data == undefined ? data : data.value
anjay
.
push
(
data
==
""
?
0
:
data
)
}
}
}
}
})
console
.
log
(
anjay
);
let
total
=
0
let
total2
=
0
let
opt
=
""
let
opt2
=
""
let
prio
=
false
let
simpen2
=
""
anjay
.
map
((
item
,
index
)
=>
{
if
(
item
==
"+"
)
{
if
(
prio
)
{
opt2
=
"tambah"
}
else
{
opt
=
"tambah"
}
}
else
if
(
item
==
"-"
)
{
if
(
prio
)
{
opt2
=
"kurang"
}
else
{
opt
=
"kurang"
}
}
else
if
(
item
==
"*"
)
{
if
(
prio
)
{
opt2
=
"kali"
}
else
{
opt
=
"kali"
}
}
else
if
(
item
==
"/"
)
{
if
(
prio
)
{
opt2
=
"bagi"
}
else
{
opt
=
"bagi"
}
}
else
if
(
item
==
"("
)
{
prio
=
true
simpen2
=
"active"
}
else
if
(
item
==
")"
)
{
prio
=
false
}
else
{
if
(
prio
)
{
if
(
opt2
==
"tambah"
)
{
total2
=
Number
(
total2
)
+
Number
(
item
)
}
else
if
(
opt2
==
"kurang"
)
{
total2
=
Number
(
total2
)
-
Number
(
item
)
}
else
if
(
opt2
==
"kali"
)
{
total2
=
Number
(
total2
)
*
Number
(
item
)
}
else
if
(
opt2
==
"bagi"
)
{
total2
=
Number
(
total2
)
/
Number
(
item
)
==
NaN
?
0
:
Number
(
total2
)
/
Number
(
item
)
}
else
{
total2
+=
Number
(
item
)
}
}
else
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
item
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
item
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
item
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
item
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
item
)
}
else
{
total
+=
Number
(
item
)
}
}
}
})
if
(
simpen2
==
"active"
)
{
if
(
opt
==
"tambah"
)
{
total
=
Number
(
total
)
+
Number
(
total2
)
}
else
if
(
opt
==
"kurang"
)
{
total
=
Number
(
total
)
-
Number
(
total2
)
}
else
if
(
opt
==
"kali"
)
{
total
=
Number
(
total
)
*
Number
(
total2
)
}
else
if
(
opt
==
"bagi"
)
{
total
=
Number
(
total
)
/
Number
(
total2
)
==
NaN
?
0
:
Number
(
total
)
/
Number
(
total2
)
}
}
total
=
R
.
equals
(
total
,
NaN
)
?
"0.0"
:
total
return
total
}
const
handleValueFormula
=
(
value
,
tableMeta
,
dex
,
xntd
,
forecast
,
periode
)
=>
{
// console.log(xntd)
let
form
=
dex
===
1
?
tableMeta
.
rowData
[
6
].
tbc
:
dex
===
2
?
tableMeta
.
rowData
[
6
].
fcp
:
tableMeta
.
rowData
[
6
].
tbf
...
...
@@ -790,6 +950,8 @@ export default class TaxPlanning extends Component {
}
})
// console.log(baru);
// if (forecast !== undefined) {
// console.log(splitFormula)
// }
...
...
@@ -1045,6 +1207,8 @@ export default class TaxPlanning extends Component {
}
else
if
(
indexChilds
==
2
)
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
].
tbf
=
Number
(
val
)
}
else
if
(
indexChilds
==
3
){
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
val
)
}
}
}
...
...
@@ -5781,12 +5945,131 @@ export default class TaxPlanning extends Component {
),
setCellProps
:
()
=>
({
style2
}),
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
// console.log(tableMeta.rowData);
return
(
<
div
>
<
div
className
=
"grid grid-3x content-center"
>
{
/* <div className="col-1"> */
}
<
div
style
=
{{
textAlign
:
'right'
}}
>
{
tableMeta
.
rowData
[
3
]
===
3
?
{
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'TAX LOSS CARRY FORWARD'
||
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'ADJUSTMENT'
||
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'INC TAX ART 22'
||
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'INC TAX ART 23'
||
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'INC TAX ART 24'
||
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'INC TAX ART 25'
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
"input"
disabled
=
{
this
.
props
.
isApprover
==
true
?
true
:
((
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
false
:
true
)}
value
=
{
Number
(
value
).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
handleChange
(
event
.
target
.
value
,
tableMeta
,
3
)
// console.log(dataTable2)
}}
/
>
}
/
>
<
/div>
:
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'INCOME BEFORE TAX (NPBT)'
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
"input"
disabled
=
{
this
.
props
.
isApprover
==
true
?
true
:
((
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
false
:
true
)}
value
=
{
Number
(
handleNewFormula
(
tableMeta
,
3
,
"@11-@13-@35+@53+@60"
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
:
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'TAXABLE INCOME'
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
"input"
disabled
=
{
this
.
props
.
isApprover
==
true
?
true
:
((
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
false
:
true
)}
value
=
{
Number
(
handleNewFormula
(
tableMeta
,
3
,
"@77-@81"
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
:
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'CORPORATE INCOME TAX'
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
"input"
disabled
=
{
this
.
props
.
isApprover
==
true
?
true
:
((
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
false
:
true
)}
value
=
{
Number
(
handleNewFormula
(
tableMeta
,
3
,
"@83-@87#TP2"
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
:
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'CORPORATE INCOME TAX AFTER ADJUSTMENT'
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
"input"
disabled
=
{
this
.
props
.
isApprover
==
true
?
true
:
((
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
false
:
true
)}
value
=
{
Number
(
handleNewFormula
(
tableMeta
,
3
,
"@87-@88"
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
:
String
(
tableMeta
.
rowData
[
8
]).
toUpperCase
()
===
'UNDER PAYMENT /(OVER PAYMENT ) INCOME TAX ART. 29'
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
value
}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
"input"
disabled
=
{
this
.
props
.
isApprover
==
true
?
true
:
((
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
)
?
false
:
true
)}
value
=
{
Number
(
handleNewFormula
(
tableMeta
,
3
,
"@87-@88"
)).
toFixed
(
1
)}
/
>
}
/
>
<
/div
>
:
tableMeta
.
rowData
[
3
]
===
3
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
...
...
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