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
29fbe4f4
Commit
29fbe4f4
authored
Nov 28, 2020
by
r.kurnia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into rifka
parents
21304aaf
8aed1c07
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
409 additions
and
69 deletions
+409
-69
index.js
src/api/index.js
+2
-1
FixedAssetsMovement.js
src/container/BudgetTahunan/FixedAssetsMovement.js
+10
-3
ProfitLoss.js
src/container/BudgetTahunan/ProfitLoss.js
+12
-12
BalanceSheetMR.js
src/container/MonthlyReport/BalanceSheetMR.js
+242
-11
ProfitLossMR.js
src/container/MonthlyReport/ProfitLossMR.js
+143
-42
No files found.
src/api/index.js
View file @
29fbe4f4
...
...
@@ -278,7 +278,7 @@ const create = (type = "") => {
const
getHierarkiMontlyReportPL
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_pl/get_report_hierarki'
,
body
)
const
createMonthlyReportPL
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_pl/create_monthly_report'
,
body
)
const
checkUploadMonthlyReportPL
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_pl/check_import'
,
body
)
const
uploadMonthlyReportPL
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report_pl/import_monthly_report'
,
body
)
//Template
const
downloadTemplate
=
(
fileName
,
fileType
)
=>
api
.
get
(
`attachment/download_file?fileName=
${
fileName
}
&&fileType=
${
fileType
}
`
)
...
...
@@ -486,6 +486,7 @@ const create = (type = "") => {
getHierarkiMontlyReportFAM
,
checkUploadMonthlyReportTP
,
checkUploadMonthlyReportFAM
,
uploadMonthlyReportPL
,
getMonthlyReport
}
}
...
...
src/container/BudgetTahunan/FixedAssetsMovement.js
View file @
29fbe4f4
...
...
@@ -663,10 +663,17 @@ export default class FixedAssetsMovement extends Component {
const
handleForecast
=
(
tableMeta
,
periode
)
=>
{
let
total
=
0
if
(
String
(
tableMeta
.
rowData
[
5
]).
toLocaleLowerCase
()
==
'gain/ (loss) on fixed assets'
||
String
(
tableMeta
.
rowData
[
5
]).
toLocaleLowerCase
()
==
'ending balance'
||
String
(
tableMeta
.
rowData
[
5
]).
toLocaleLowerCase
()
==
'beginning balance'
)
{
if
(
String
(
tableMeta
.
rowData
[
5
]).
toLocaleLowerCase
()
==
'beginning balance'
)
{
let
indexID
=
dataTable2
.
findIndex
((
val
,
index
)
=>
String
(
val
[
5
]).
toLocaleLowerCase
()
==
'ending balance'
&&
dataTable2
[
index
-
1
][
2
]
==
tableMeta
.
rowData
[
2
])
if
(
indexID
!==
-
1
)
{
total
=
dataTable2
[
indexID
][
18
].
value
}
}
else
{
let
indexID
=
dataTable2
[
tableMeta
.
rowIndex
][
23
].
findIndex
((
val
)
=>
val
.
periode
==
periode
)
if
(
indexID
!==
-
1
)
{
total
=
dataTable2
[
tableMeta
.
rowIndex
][
23
][
indexID
].
value
}
}
}
else
{
total
=
handleValueFormula
(
tableMeta
.
columnIndex
,
tableMeta
)
}
...
...
src/container/BudgetTahunan/ProfitLoss.js
View file @
29fbe4f4
...
...
@@ -104,7 +104,7 @@ export default class ProfitLoss extends Component {
"submission_id"
:
this
.
props
.
submissionID
}
api
.
create
().
getDetailReportMB
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
//
console.log(response);
let
dataTable
=
[]
this
.
setState
({
visibleProfitLoss
:
true
})
if
(
response
.
data
)
{
...
...
@@ -141,10 +141,10 @@ export default class ProfitLoss extends Component {
item
.
order
])
}
if
(
item
.
id
===
20092
)
{
console
.
log
(
item
);
console
.
log
(
dataTable
);
}
//
if (item.id === 20092) {
//
console.log(item);
//
console.log(dataTable);
//
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
...
...
@@ -188,7 +188,7 @@ export default class ProfitLoss extends Component {
}
}
})
console
.
log
(
dataTable
)
//
console.log(dataTable)
this
.
setState
({
dataTable
,
loading
:
false
,
buttonError
:
true
,
editable
:
true
},
()
=>
{
})
}
else
{
...
...
@@ -422,8 +422,8 @@ export default class ProfitLoss extends Component {
profit_loss
:
data
,
status
:
type
}
console
.
log
(
this
.
state
.
dataTable
);
console
.
log
(
JSON
.
stringify
(
body
));
//
console.log(this.state.dataTable);
//
console.log(JSON.stringify(body));
api
.
create
(
'UPLOAD'
).
uploadMasterBudget
(
body
).
then
(
response
=>
{
// console.log(response);
if
(
response
.
data
)
{
...
...
@@ -635,10 +635,10 @@ export default class ProfitLoss extends Component {
}
})
if
(
tableMeta
.
rowData
[
1
]
===
20092
)
{
console
.
log
(
total
);
console
.
log
(
arrayJumlah
);
}
//
if (tableMeta.rowData[1] === 20092) {
//
console.log(total);
//
console.log(arrayJumlah);
//
}
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
Number
(
total
)
// }
...
...
src/container/MonthlyReport/BalanceSheetMR.js
View file @
29fbe4f4
...
...
@@ -9,6 +9,7 @@ import { type } from 'ramda';
import
{
PropagateLoader
}
from
'react-spinners'
;
import
UploadFile
from
"../../library/Upload"
;
import
{
ExcelRenderer
}
from
'react-excel-renderer'
;
import
Constant
from
'../../library/Constant'
;
const
LightTooltip
=
withStyles
((
theme
)
=>
({
tooltip
:
{
...
...
@@ -42,7 +43,8 @@ export default class BalanceSheetMR extends Component {
super
(
props
)
this
.
state
=
{
dataTable
:
[],
loading
:
true
loading
:
true
,
visibleBSMR
:
true
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -183,11 +185,12 @@ export default class BalanceSheetMR extends Component {
isi
.
map
((
i
,
index
)
=>
{
if
(
i
.
length
>
0
)
{
payload
.
push
({
orders
:
i
[
0
]
===
undefined
?
""
:
String
(
i
[
0
]).
trim
(),
item_report_id
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
item_report
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
total_actual_before
:
i
[
2
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
2
]))
===
false
?
"0"
:
String
(
i
[
2
]).
trim
(),
january
:
i
[
3
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
3
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
(),
february
:
i
[
4
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
actual
:
i
[
3
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
2
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
(),
mtd_vs_previous_month
:
i
[
4
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
mtd_vs_mb
:
i
[
5
]
===
undefined
?
"0"
:
reg
.
test
(
String
(
i
[
5
]))
===
false
?
"0"
:
String
(
i
[
5
]).
trim
(),
})
}
})
...
...
@@ -198,12 +201,120 @@ export default class BalanceSheetMR extends Component {
balance_sheet
:
payload
,
months
:
this
.
props
.
month
.
month_id
}
//
console.log(body)
console
.
log
(
body
)
this
.
setState
({
payload
:
body
,
judul
:
resp
.
rows
[
1
][
0
],
judulColumn
:
resp
.
rows
[
2
]
})
}
});
}
checkUpload
()
{
api
.
create
().
checkUploadMonthlyReportBS
(
this
.
state
.
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
,
visibleBSMR
:
false
,
loading
:
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
.
rolling_outlook
===
null
?
""
:
item
.
rolling_outlook
===
""
?
""
:
item
.
rolling_outlook
,
item
.
master_budget
===
""
?
""
:
item
.
master_budget
,
item
.
rolling_budget
===
""
?
""
:
item
.
rolling_budget
,
item
.
actual
===
""
?
""
:
item
.
actual
,
item
.
actual_previous_month
===
null
?
""
:
item
.
actual_previous_month
===
""
?
""
:
item
.
actual_previous_month
,
// item.amount_act_vs_previous_month === "" ? "" : item.amount_act_vs_previous_month,
// item.percent_act_vs_previous_month === "" ? "" : item.percent_act_vs_previous_month,
// item.amount_act_vs_mb === "" ? "" : item.amount_act_vs_mb,
// item.percent_act_vs_mb === "" ? "9.0" : item.percent_act_vs_mb,
// item.amount_act_vs_rb === "" ? "1" : item.amount_act_vs_rb,
// item.percent_act_vs_rb === "" ? "" : item.percent_act_vs_rb,
0
,
0
,
0
,
0
,
0
,
0
,
item
.
mtd_vs_previous_month
===
""
?
""
:
item
.
mtd_vs_previous_month
,
item
.
mtd_vs_mb
===
""
?
""
:
item
.
mtd_vs_mb
,
item
.
mtd_vs_rb
===
""
?
""
:
item
.
mtd_vs_rb
===
null
?
0
:
item
.
mtd_vs_rb
,
item
.
error
]
})
console
.
log
(
dataTable
)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
20
].
length
>
0
)
{
// console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
}
})
// console.log(this.state.buttonError)
})
}
}
})
}
uploadBalanceSheet
(
type
)
{
let
data
=
[]
this
.
state
.
dataTable
.
map
(
i
=>
{
data
.
push
({
item_report_id
:
i
[
1
],
item_report
:
String
(
i
[
5
]).
trim
(),
rolling_outlook
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
6
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
6
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
6
]).
toFixed
(
1
)),
master_budget
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
7
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
7
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)),
rolling_budget
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
8
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
8
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)),
actual
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
9
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
9
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)),
actual_previous_month
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
10
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
10
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
10
]).
toFixed
(
1
)),
amount_act_vs_previous_month
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
11
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
11
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
11
]).
toFixed
(
1
)),
percent_act_vs_previous_month
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
12
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
12
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
12
]).
toFixed
(
1
)),
amount_act_vs_mb
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
13
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
13
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
13
]).
toFixed
(
1
)),
percent_act_vs_mb
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
14
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
14
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
14
]).
toFixed
(
1
)),
amount_act_vs_rb
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
15
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
15
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
15
]).
toFixed
(
1
)),
percent_act_vs_rb
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
16
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
16
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)),
mtd_vs_previous_month
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
17
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
17
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)),
mtd_vs_mb
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
18
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
18
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)),
mtd_vs_rb
:
i
[
0
]
===
5
||
i
[
0
]
===
6
?
String
(
Number
(
i
[
19
].
value
).
toFixed
(
1
))
:
i
[
0
]
===
3
&&
i
[
19
]
===
""
?
"0.0"
:
String
(
Number
(
i
[
19
]).
toFixed
(
1
))
})
})
let
body
=
{
"monthly_report_id"
:
this
.
props
.
submissionID
,
"company_id"
:
this
.
props
.
company
.
company_id
,
"periode"
:
this
.
props
.
periode
,
"report_id"
:
this
.
props
.
report_id
,
"status"
:
type
,
"months"
:
this
.
props
.
month
.
month_id
,
"balance_sheet"
:
data
}
// console.log(data);
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportBS
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
()
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
backToMonthlyReport
(
type
)
{
this
.
setState
({
loading
:
true
})
let
data
=
[]
...
...
@@ -282,10 +393,14 @@ export default class BalanceSheetMR extends Component {
const
handleValue
=
(
data
,
type
)
=>
{
let
total
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
// if (item[2] !== null) {
if
(
data
.
rowData
[
1
]
===
item
[
2
])
{
// console.log(item[data.columnIndex + type])
let
itemVal
=
item
[
data
.
columnIndex
+
type
].
value
!==
undefined
?
Number
(
item
[
data
.
columnIndex
+
type
].
value
)
:
Number
(
item
[
data
.
columnIndex
+
type
])
total
=
item
[
data
.
columnIndex
+
type
]
===
undefined
?
Number
(
total
)
+
0
:
Number
(
total
)
+
itemVal
}
// }
})
let
indexParent
=
dataTable2
.
findIndex
((
val
)
=>
val
[
1
]
===
dataTable2
[
data
.
rowIndex
][
2
])
dataTable2
[
data
.
rowIndex
][
data
.
columnIndex
+
type
]
=
Number
(
total
).
toFixed
(
1
)
...
...
@@ -1052,7 +1167,7 @@ export default class BalanceSheetMR extends Component {
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Monthly
Report
<
/Typography
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
}}
>
{
this
.
state
.
visibleBSMR
?
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Balance
Sheet
<
/Typography
>
<
/div
>
...
...
@@ -1120,7 +1235,7 @@ export default class BalanceSheetMR extends Component {
{
!
this
.
state
.
loading
&&
(
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
this
.
state
.
dataTable
}
data
=
{
dataTable2
}
columns
=
{
columns
}
options
=
{
options
}
/
>
...
...
@@ -1224,7 +1339,123 @@ export default class BalanceSheetMR extends Component {
{
/* : null
} */
}
<
/div
>
<
/Paper> :
<
Paper
style
=
{{
paddingTop
:
10
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
,
margin
:
10
}}
>
Monthly
Report
-
Balance
Sheet
<
/Typography
>
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
{
this
.
props
.
company
.
company_name
}
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
Period
:
{
this
.
props
.
periode
}
(
rev
.{
this
.
props
.
revision
})
<
/Typography
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#4b4b4b'
}}
>
in
IDR
mn
<
/Typography
>
<
/div
>
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
!
this
.
state
.
loading
&&
(
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
MUIDataTable
data
=
{
dataTable2
}
columns
=
{
columns
}
options
=
{
options
}
/
>
<
/MuiThemeProvider
>
)}
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
>
<
div
style
=
{{
backgroundColor
:
'#019ce5'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Back
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
setState
({
loading
:
false
})
// this.handleValidate()
},
100
);
})
}}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
/div
>
<
/button
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
state
.
saveDraft
===
true
?
null
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
uploadBalanceSheet
(
'draft'
)
})
}
>
<
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
as
Draft
<
/Typography
>
<
/div
>
<
/button
>
<
button
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
state
.
buttonError
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
},
()
=>
{
this
.
uploadBalanceSheet
(
'submitted'
)
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
buttonError
===
true
?
'default'
:
'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
&
Complete
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
/Paper
>
}
<
/div
>
{
this
.
state
.
visibleUpload
&&
(
<
div
className
=
"test app-popup-show"
>
...
...
src/container/MonthlyReport/ProfitLossMR.js
View file @
29fbe4f4
...
...
@@ -55,12 +55,46 @@ export default class ProfitLossMR extends Component {
super
(
props
)
this
.
state
=
{
dataTable
:
[],
loading
:
true
loading
:
true
,
valueThreshold
:
0
}
}
componentDidMount
()
{
// this.getItemHierarki()
this
.
getSettingControl
()
}
getSettingControl
()
{
let
body
=
{
group
:
'THRESHOLD_VARIANCE'
,
company_id
:
this
.
props
.
company
.
company_id
,
type
:
'PNL'
}
api
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
setState
({
valueThreshold
:
response
.
data
.
data
[
0
]
?
response
.
data
.
data
[
0
].
value
:
null
},
()
=>
{
this
.
getItemHierarki
()
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
getItemHierarki
()
{
...
...
@@ -104,7 +138,7 @@ export default class ProfitLossMR extends Component {
item
.
profit_loss
.
mtd_vs_previous_month
===
null
?
"0.0"
:
item
.
profit_loss
.
mtd_vs_previous_month
===
""
?
"0.0"
:
item
.
profit_loss
.
mtd_vs_previous_month
,
item
.
profit_loss
.
mtd_vs_mb
===
null
?
"0.0"
:
item
.
profit_loss
.
mtd_vs_mb
===
""
?
"0.0"
:
item
.
profit_loss
.
mtd_vs_mb
,
item
.
profit_loss
.
mtd_vs_rb
===
null
?
"0.0"
:
item
.
profit_loss
.
mtd_vs_rb
===
""
?
"0.0"
:
item
.
profit_loss
.
mtd_vs_rb
,
item
.
order
item
.
order
,
])
}
if
(
item
.
children
!==
null
)
{
...
...
@@ -286,12 +320,12 @@ export default class ProfitLossMR extends Component {
this
.
setState
({
visibleUpload
:
false
,
visibleProfitLoss
:
false
,
loading
:
true
})
let
dataTable
=
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
return
[
item
.
item_report_id
,
item
.
item_report
,
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
paren
t
,
item
.
item_repor
t
,
item
.
notes
,
item
.
rolling_outlook
,
item
.
master_budget
,
...
...
@@ -299,15 +333,22 @@ export default class ProfitLossMR extends Component {
item
.
actual
,
item
.
ytd_actual
,
item
.
actual_previous_month
,
item
.
amount_act_vs_previous_month
,
item
.
percent_act_vs_previous_month
,
item
.
amount_act_vs_mb
,
item
.
percent_act_vs_mb
,
item
.
amount_act_vs_rb
,
item
.
percent_act_vs_rb
,
item
.
mtd_vs_previous_month
,
item
.
mtd_vs_mb
,
item
.
mtd_vs_rb
,
item
.
order
s
,
item
.
order
,
item
.
error
]
})
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
16
].
length
>
0
)
{
if
(
item
[
23
].
length
>
0
)
{
// console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
}
...
...
@@ -324,35 +365,35 @@ export default class ProfitLossMR extends Component {
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
)),
notes
:
i
[
6
],
rolling_outlook
:
String
(
Number
(
i
[
7
]).
toFixed
(
1
)),
master_budget
:
String
(
Number
(
i
[
8
]).
toFixed
(
1
)),
rolling_budget
:
String
(
Number
(
i
[
9
]).
toFixed
(
1
)),
actual
:
String
(
Number
(
i
[
10
]).
toFixed
(
1
)),
ytd_actual
:
String
(
Number
(
i
[
11
]).
toFixed
(
1
)),
actual_previous_month
:
String
(
Number
(
i
[
12
]).
toFixed
(
1
)),
amount_act_vs_previous_month
:
String
(
Number
(
i
[
13
]).
toFixed
(
1
)),
percent_act_vs_previous_month
:
String
(
Number
(
i
[
14
]).
toFixed
(
1
)),
amount_act_vs_mb
:
String
(
Number
(
i
[
15
]).
toFixed
(
1
)),
percent_act_vs_mb
:
String
(
Number
(
i
[
16
]).
toFixed
(
1
)),
amount_act_vs_rb
:
String
(
Number
(
i
[
17
]).
toFixed
(
1
)),
percent_act_vs_rb
:
String
(
Number
(
i
[
18
]).
toFixed
(
1
)),
mtd_vs_previous_month
:
String
(
Number
(
i
[
19
]).
toFixed
(
1
)),
mtd_vs_mb
:
String
(
Number
(
i
[
20
]).
toFixed
(
1
)),
mtd_vs_rb
:
String
(
Number
(
i
[
21
]).
toFixed
(
1
)),
})
})
let
body
=
{
submission_id
:
this
.
props
.
submissionID
,
//
submission_id: this.props.submissionID,
company_id
:
this
.
props
.
company
.
company_id
,
periode
:
this
.
props
.
periode
,
report_id
:
this
.
props
.
report_id
,
months
:
this
.
props
.
month
.
month_id
,
profit_loss
:
data
,
status
:
type
}
// console.log(data);
api
.
create
(
'UPLOAD'
).
uploadM
asterBudget
(
body
).
then
(
response
=>
{
api
.
create
(
'UPLOAD'
).
uploadM
onthlyReportPL
(
body
).
then
(
response
=>
{
// console.log(response);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
...
...
@@ -764,7 +805,7 @@ export default class ProfitLossMR extends Component {
type
=
"text"
placeholder
=
""
disabled
=
{
true
}
value
=
{
tableMeta
.
rowData
[
8
]
}
value
=
{
Number
(
tableMeta
.
rowData
[
8
]).
toFixed
(
1
)
}
/
>
}
/
>
...
...
@@ -1337,6 +1378,26 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
19
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
19
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
false
}
value
=
{
Number
(
tableMeta
.
rowData
[
19
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
@@ -1372,6 +1433,26 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
20
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
20
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
false
}
value
=
{
Number
(
tableMeta
.
rowData
[
20
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
@@ -1407,6 +1488,26 @@ export default class ProfitLossMR extends Component {
{
tableMeta
.
rowData
[
0
]
===
4
||
tableMeta
.
rowData
[
0
]
===
1
?
null
:
Number
(
tableMeta
.
rowData
[
21
]).
toFixed
(
1
)
<
Number
(
this
.
state
.
valueThreshold
).
toFixed
(
1
)
?
<
div
style
=
{{
flex
:
1
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
tableMeta
.
rowData
[
21
]}
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'right'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
disabled
=
{
false
}
value
=
{
Number
(
tableMeta
.
rowData
[
21
]).
toFixed
(
1
)}
onBlur
=
{(
event
)
=>
{
handleChange
(
event
.
target
.
value
,
tableMeta
)
}}
/
>
}
/
>
<
/div>
:
tableMeta
.
rowData
[
0
]
===
2
?
<
span
style
=
{{
fontSize
:
12
,
textAlign
:
'right'
}}
>
<
NumberFormat
...
...
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