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
4fb1c8bf
Commit
4fb1c8bf
authored
Jul 25, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kodingan sebelum simulasi MB PL & TP
parent
f0b6833a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2122 additions
and
2964 deletions
+2122
-2964
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+0
-253
TaxPlanning.js
src/container/BudgetTahunan/TaxPlanning.js
+2122
-2711
No files found.
src/container/BudgetTahunan/ProfitLoss.js
View file @
4fb1c8bf
...
@@ -66,11 +66,9 @@ export default class ProfitLoss extends Component {
...
@@ -66,11 +66,9 @@ export default class ProfitLoss extends Component {
fromUpload
:
false
,
fromUpload
:
false
,
defaultCurrencyUpload
:
this
.
props
.
defaultCurrency
,
defaultCurrencyUpload
:
this
.
props
.
defaultCurrency
,
visibleAlertSave
:
false
,
visibleAlertSave
:
false
,
visibleButtonUpload
:
false
}
}
this
.
handleValue
=
this
.
handleValue
.
bind
(
this
)
this
.
handleValue
=
this
.
handleValue
.
bind
(
this
)
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandlerSimulasi
=
this
.
fileHandlerSimulasi
.
bind
(
this
);
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -362,56 +360,6 @@ export default class ProfitLoss extends Component {
...
@@ -362,56 +360,6 @@ export default class ProfitLoss extends Component {
});
});
}
}
fileHandlerSimulasi
=
(
event
)
=>
{
let
fileObj
=
event
ExcelRenderer
(
fileObj
,
(
err
,
resp
)
=>
{
// console.log(resp)
if
(
err
)
{
// console.log(err);
}
else
{
let
isi
=
resp
.
rows
.
slice
(
3
)
// console.log(resp.rows[2]);
let
payload
=
[]
let
reg
=
/^
[
-+
]?(?:[
0-9
]
+,
)
*
[
0-9
]
+
(?:\.[
0-9
]
+
)?
$/
;
isi
.
map
((
i
,
index
)
=>
{
if
(
i
.
length
>
0
)
{
payload
.
push
({
item_report_id
:
i
[
0
]
===
undefined
?
""
:
String
(
i
[
0
]).
trim
(),
item_report
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
notes
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
total_actual_before
:
i
[
3
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
3
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
(),
january
:
i
[
4
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
february
:
i
[
5
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
5
]))
===
false
?
"0"
:
String
(
i
[
5
]).
trim
(),
march
:
i
[
6
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
6
]))
===
false
?
"0"
:
String
(
i
[
6
]).
trim
(),
april
:
i
[
7
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
7
]))
===
false
?
"0"
:
String
(
i
[
7
]).
trim
(),
may
:
i
[
8
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
8
]))
===
false
?
"0"
:
String
(
i
[
8
]).
trim
(),
june
:
i
[
9
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
9
]))
===
false
?
"0"
:
String
(
i
[
9
]).
trim
(),
july
:
i
[
10
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
10
]))
===
false
?
"0"
:
String
(
i
[
10
]).
trim
(),
august
:
i
[
11
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
11
]))
===
false
?
"0"
:
String
(
i
[
11
]).
trim
(),
september
:
i
[
12
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
12
]))
===
false
?
"0"
:
String
(
i
[
12
]).
trim
(),
october
:
i
[
13
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
13
]))
===
false
?
"0"
:
String
(
i
[
13
]).
trim
(),
november
:
i
[
14
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
14
]))
===
false
?
"0"
:
String
(
i
[
14
]).
trim
(),
december
:
i
[
15
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
15
]))
===
false
?
"0"
:
String
(
i
[
15
]).
trim
(),
total_current_year
:
i
[
16
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
16
]))
===
false
?
"0"
:
String
(
i
[
16
]).
trim
(),
total_next_year
:
i
[
17
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
17
]))
===
false
?
"0"
:
String
(
i
[
17
]).
trim
(),
total_more_year
:
i
[
18
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
18
]))
===
false
?
"0"
:
String
(
i
[
18
]).
trim
()
})
}
})
let
body
=
{
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
profit_loss
:
payload
,
status
:
'submitted'
}
console
.
log
(
body
)
this
.
setState
({
payload
:
body
,
judul
:
resp
.
rows
[
1
][
0
],
judulColumn
:
resp
.
rows
[
2
]
})
}
});
}
checkUpload
()
{
checkUpload
()
{
let
payload
=
{
let
payload
=
{
...
this
.
state
.
payload
,
...
this
.
state
.
payload
,
...
@@ -476,124 +424,6 @@ export default class ProfitLoss extends Component {
...
@@ -476,124 +424,6 @@ export default class ProfitLoss extends Component {
})
})
}
}
checkUploadSimulasi
()
{
let
payload
=
{
...
this
.
state
.
payload
,
currency_id
:
this
.
state
.
defaultCurrencyUpload
?.
id
}
api
.
create
().
checkUploadMB
(
payload
).
then
(
response
=>
{
// console.log(JSON.stringify(this.state.payload));
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
visibleUpload
:
false
,
visibleProfitLoss
:
false
,
loading
:
true
,
visibleButtonUpload
:
true
})
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
item_report
,
item
.
notes
,
Number
(
item
.
total_actual_before
).
toFixed
(
1
),
Number
(
item
.
january
).
toFixed
(
1
),
Number
(
item
.
february
).
toFixed
(
1
),
Number
(
item
.
march
).
toFixed
(
1
),
Number
(
item
.
april
).
toFixed
(
1
),
Number
(
item
.
may
).
toFixed
(
1
),
Number
(
item
.
june
).
toFixed
(
1
),
Number
(
item
.
july
).
toFixed
(
1
),
Number
(
item
.
august
).
toFixed
(
1
),
Number
(
item
.
september
).
toFixed
(
1
),
Number
(
item
.
october
).
toFixed
(
1
),
Number
(
item
.
november
).
toFixed
(
1
),
Number
(
item
.
december
).
toFixed
(
1
),
Number
(
item
.
total_current_year
).
toFixed
(
1
),
Number
(
item
.
total_next_year
).
toFixed
(
1
),
Number
(
item
.
total_more_year
).
toFixed
(
1
),
item
.
orders
,
item
.
error
]
})
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
,
fromUpload
:
true
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
24
].
length
>
0
)
{
// console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
}
})
// console.log(this.state.buttonError)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
})
}
uploadSimulasi
(
type
)
{
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
item_report_id
:
i
[
1
],
notes
:
String
(
i
[
6
]),
total_actual_before
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)),
january
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)),
february
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)),
march
:
String
(
Number
(
i
[
10
]).
toFixed
(
1
)),
april
:
String
(
Number
(
i
[
11
]).
toFixed
(
1
)),
may
:
String
(
Number
(
i
[
12
]).
toFixed
(
1
)),
june
:
String
(
Number
(
i
[
13
]).
toFixed
(
1
)),
july
:
String
(
Number
(
i
[
14
]).
toFixed
(
1
)),
august
:
String
(
Number
(
i
[
15
]).
toFixed
(
1
)),
september
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)),
october
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)),
november
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)),
december
:
String
(
Number
(
i
[
19
]).
toFixed
(
1
)),
total_current_year
:
String
(
Number
(
i
[
20
]).
toFixed
(
1
)),
total_next_year
:
String
(
Number
(
i
[
21
]).
toFixed
(
1
)),
total_more_year
:
String
(
Number
(
i
[
22
]).
toFixed
(
1
)),
})
})
let
body
=
{
submission_id
:
this
.
props
.
submissionID
,
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
currency_id
:
this
.
state
.
defaultCurrencyUpload
?.
id
,
profit_loss
:
data
,
status
:
type
}
console
.
log
(
body
)
api
.
create
().
uploadSimulasiMB
(
body
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
(
'PL'
,
'simulasiPL'
)
this
.
setState
({
loading
:
false
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Error saving data. Please try again'
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
uploadProfitLoss
(
type
)
{
uploadProfitLoss
(
type
)
{
let
data
=
[]
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
this
.
state
.
dataTable
.
map
(
i
=>
{
...
@@ -3042,22 +2872,6 @@ export default class ProfitLoss extends Component {
...
@@ -3042,22 +2872,6 @@ export default class ProfitLoss extends Component {
<
/div
>
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
a
data
-
tip
=
{
'Upload Simulasi'
}
data
-
for
=
"upload"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
}}
onClick
=
{()
=>
this
.
setState
({
visibleUploadSimulasi
:
true
,
buttonDraft
:
true
})}
>
<
img
src
=
{
Images
.
simulasiUpload
}
style
=
{{
width
:
40
,
height
:
40
,
marginRight
:
3
}}
/
>
<
/button
>
<
/a
>
<
ReactTooltip
border
=
{
true
}
id
=
"upload"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
{
this
.
state
.
dataTable
.
length
==
0
?
null
:
this
.
props
.
isApprover
==
true
?
{
this
.
state
.
dataTable
.
length
==
0
?
null
:
this
.
props
.
isApprover
==
true
?
null
null
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
...
@@ -3135,7 +2949,6 @@ export default class ProfitLoss extends Component {
...
@@ -3135,7 +2949,6 @@ export default class ProfitLoss extends Component {
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */
}
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */
}
<
/div
>
<
/div
>
}
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
@@ -3467,72 +3280,6 @@ export default class ProfitLoss extends Component {
...
@@ -3467,72 +3280,6 @@ export default class ProfitLoss extends Component {
<
/div
>
<
/div
>
)}
)}
{
this
.
state
.
visibleUploadSimulasi
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content background-white border-radius"
style
=
{{
borderRadius
:
8
}}
>
<
div
className
=
"popup-panel grid grid-2x main-color"
style
=
{{
height
:
64
,
borderTopRightRadius
:
8
,
borderTopLeftRadius
:
8
}}
>
<
div
className
=
"col-1"
style
=
{{
maxWidth
:
"inherit"
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
className
=
"popup-title"
>
<
span
style
=
{{
color
:
'#fff'
,
fontSize
:
16
,
fontWeight
:
'bold'
}}
>
Upload
File
Simulasi
<
/span
>
<
/div
>
<
/div
>
<
div
className
=
"col-2 content-right"
style
=
{{
maxWidth
:
"inherit"
,
alignSelf
:
'center'
}}
>
<
button
type
=
"button"
className
=
"btn btn-circle btn-white"
onClick
=
{()
=>
this
.
setState
({
visibleUploadSimulasi
:
false
})}
>
<
img
src
=
{
Images
.
close
}
/
>
<
/button
>
<
/div
>
<
/div
>
<
div
style
=
{{
padding
:
'25px 30px'
}}
>
<
UploadFile
type
=
{
this
.
state
.
uploadStatusSimulasi
}
percentage
=
{
this
.
state
.
percentageSimulasi
}
result
=
{
this
.
state
.
resultSimulasi
}
acceptedFiles
=
{[
"xlsx"
]}
onHandle
=
{(
dt
)
=>
{
this
.
fileHandlerSimulasi
(
dt
)
this
.
setState
({
uploadStatusSimulasi
:
'idle'
,
percentageSimulasi
:
'0'
})
}}
onUpload
=
{()
=>
{
String
(
this
.
state
.
judul
).
includes
(
"MASTER"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"BUDGET"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"PROFIT"
)
&&
String
(
this
.
state
.
judul
).
includes
(
"LOSS"
)
?
this
.
checkUploadSimulasi
()
:
this
.
setState
({
alert
:
true
,
messageAlert
:
"Invalid Template"
,
tipeAlert
:
'warning'
})
}}
/
>
<
/div
>
{
this
.
state
.
visibleButtonUpload
&&
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
margin
:
'0px 32px 16px'
}}
>
<
div
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
setState
({
handleDoubleClick
:
1
,
loading
:
true
},
()
=>
{
this
.
uploadSimulasi
(
'submitted'
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
Data
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
}
{
/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */
}
<
/div
>
<
/div
>
)}
{
this
.
state
.
visibleAlertSave
&&
(
{
this
.
state
.
visibleAlertSave
&&
(
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"test app-popup-show"
>
<
div
className
=
"popup-content border-radius"
style
=
{{
background
:
'#FFF27D'
,
borderRadius
:
10
,
width
:
715
,
height
:
238
}}
>
<
div
className
=
"popup-content border-radius"
style
=
{{
background
:
'#FFF27D'
,
borderRadius
:
10
,
width
:
715
,
height
:
238
}}
>
...
...
src/container/BudgetTahunan/TaxPlanning.js
View file @
4fb1c8bf
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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