Commit 1747715e authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

ROPL

See merge request !1232
parents 774159cd 84e7b513
......@@ -240,8 +240,10 @@ const create = (type = "") => {
const getReportHierarkiPL = (body) => api.post('transaction/db_profit_loss_detail/get_report_hierarki', body)
const getLastestUpdateMROI = (body) => api.post('transaction/operating_indicator/monthly_report/get_latest_update', body)
// Rolling Outlook
const getRollingOutlookID = (body) => api.post('transaction/rolling_outlook/get_rolling_outlook_id', body)
const getRollingOutlookBS = (body) => api.post('transaction/balance_sheet/rolling_outlook/get_report_hierarki', body)
const getRollingOutlookPL = (body) => api.post('transaction/profit_loss/rolling_outlook/get_report_hierarki', body)
//REPORT NEW
......@@ -699,7 +701,8 @@ const create = (type = "") => {
getDetailMasterDataCat,
deleteMasterDataCat,
getListChildDashboardCAT,
getDashboardCATDetail
getDashboardCATDetail,
getRollingOutlookPL
}
}
......
......@@ -1215,7 +1215,13 @@ export default class RollingOutlook extends Component {
{this.state.visiblePL && (
<ProfitLossRO
width={this.props.width}
height={this.props.height}
open={this.props.open}
report_id={this.state.report_id}
company={this.state.company}
revision={this.state.revisionTable}
periode={this.state.periode.periode}
rollingOutlookID={this.state.rollingOutlookID}
onClickClose={() => this.setState({ visiblePL: false, visibleRollingOutlook: true })}
/>
)}
......
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, Paper, TableCell, Typography } from '@material-ui/core'
import MUIDataTable from 'mui-datatables'
import React, { Component } from 'react'
import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles, Snackbar } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
import api from '../../api';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
import Constant from '../../library/Constant';
const LightTooltip = withStyles((theme) => ({
tooltip: {
backgroundColor: theme.palette.common.white,
color: 'rgba(0, 0, 0, 0.87)',
boxShadow: theme.shadows[1],
fontSize: 11,
},
}))(Tooltip);
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());
......@@ -33,19 +52,317 @@ const styleNotesEmpty = {
}
export default class ProfitLossRO extends Component {
constructor(props) {
super(props)
this.state = {
dataTable: [],
loading: true,
get_for: "view",
visiblePLRO: true,
updateBy: '-',
judulColumn: null,
handleTekTekTek: 0,
saveDraft: true,
buttonError: true,
viewOnly: true,
}
// this.handleValue = this.handleValue.bind(this)
// this.fileHandler = this.fileHandler.bind(this);
}
componentDidMount() {
this.getItemHierarki()
// this.handleViewOnly()
}
handleViewOnly() {
let checkApprover = false
let checkLastStatus = false
let checkStatus = false
let checkPrevRev = false
if (this.props.isApprover) {
checkApprover = true
} else {
checkApprover = false
}
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true
} else {
checkLastStatus = false
}
if (this.props.prevRevision) {
checkPrevRev = true
} else {
checkPrevRev = false
}
if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
checkStatus = true
} else {
checkStatus = false
}
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev})
}
handleGetFor(type) {
this.setState({ get_for: type }, () => {
this.getItemHierarki()
})
}
getItemHierarki() {
this.setState({ loading: true, judulColumn: null })
let payload = {
"company_id": this.props.company.company_id,
"get_for": this.state.get_for,
"months": 0,
"periode": this.props.periode,
"report_id": this.props.report_id,
"revision": Number(this.props.revision),
"rolling_outlook_id": this.props.rollingOutlookID
}
api.create().getRollingOutlookPL(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = []
if (response.data) {
if (response.data.status == 'success') {
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.last_year_total === "" ? "0" : item.profit_loss.last_year_total,
item.profit_loss.january === "" ? "0" : item.profit_loss.january,
item.profit_loss.february === "" ? "0" : item.profit_loss.february,
item.profit_loss.march === "" ? "0" : item.profit_loss.march,
item.profit_loss.april === "" ? "0" : item.profit_loss.april,
item.profit_loss.may === "" ? "0" : item.profit_loss.may,
item.profit_loss.june === "" ? "0" : item.profit_loss.june,
item.profit_loss.july === "" ? "0" : item.profit_loss.july,
item.profit_loss.august === "" ? "0" : item.profit_loss.august,
item.profit_loss.september === "" ? "0" : item.profit_loss.september,
item.profit_loss.october === "" ? "0" : item.profit_loss.october,
item.profit_loss.november === "" ? "0" : item.profit_loss.november,
item.profit_loss.december === "" ? "0" : item.profit_loss.december,
item.profit_loss.current_year_total === "" ? "0" : item.profit_loss.current_year_total,
item.profit_loss.actual_formula === "" ? "0" : item.profit_loss.actual_formula,
item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.profit_loss.last_year_total === "" ? "0" : item.profit_loss.last_year_total,
item.profit_loss.january === "" ? "0" : item.profit_loss.january,
item.profit_loss.february === "" ? "0" : item.profit_loss.february,
item.profit_loss.march === "" ? "0" : item.profit_loss.march,
item.profit_loss.april === "" ? "0" : item.profit_loss.april,
item.profit_loss.may === "" ? "0" : item.profit_loss.may,
item.profit_loss.june === "" ? "0" : item.profit_loss.june,
item.profit_loss.july === "" ? "0" : item.profit_loss.july,
item.profit_loss.august === "" ? "0" : item.profit_loss.august,
item.profit_loss.september === "" ? "0" : item.profit_loss.september,
item.profit_loss.october === "" ? "0" : item.profit_loss.october,
item.profit_loss.november === "" ? "0" : item.profit_loss.november,
item.profit_loss.december === "" ? "0" : item.profit_loss.december,
item.profit_loss.current_year_total === "" ? "0" : item.profit_loss.current_year_total,
item.profit_loss.actual_formula === "" ? "0" : item.profit_loss.actual_formula,
item.order,
// item.condition_it_should_be,
// item.condition_if_wrong
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
// console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ dataTable, loading: false, buttonError: true, editable: true })
}
})
}
render() {
let dataTable = [
["Ravenue", "", {a: "1"}, {b: "2"}, {c: "3"}, {d: "4"}, {e: "5"}, {f: "6"}, {g: "7"}, {h: "8"}, {i: "9"}, {j: "10"}, {k: "11"}, {l: "13"}, {m: "14"}, {n: "15"}],
["Total Assets", "", {a: "1"}, {b: "2"}, {c: "3"}, {d: "4"}, {e: "5"}, {f: "6"}, {g: "7"}, {h: "8"}, {i: "9"}, {j: "10"}, {k: "11"}, {l: "13"}, {m: "14"}, {n: "15"}]
]
let dataTable2 = this.state.dataTable
const handleNotes = (value, tableMeta) => {
// console.log(value)
let a = dataTable[tableMeta.rowIndex][tableMeta.columnIndex] = value
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// console.log(dataTable2[tableMeta.rowIndex]);
}
let columns = [{
const handleChange = (value, tableMeta, type) => {
console.log(dataTable2);
let val = String(value).split(",").join("")
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
const handleValue = (value, data) => {
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(String(item[data.columnIndex]).includes('-') ? Number(String(item[data.columnIndex]).substr(1, String(item[data.columnIndex]).length)) * -1 : Number(item[data.columnIndex])))
}
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta, month) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
let tambahan = false
let opet = ""
arrayFormula.map((item, indexs) => {
if (item == 'X') {
tambahan = true
} else if (item == '-' || item == '+' || item == '/' || item == '*') {
arrayJumlah.push(item)
} else {
let index = dataTable2.findIndex((val) => val[23] == item)
if (tambahan) {
if (item == '-' || item == '+' || item == '/' || item == '*') {
opet = item
} else {
arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
tambahan = false
opet = ""
}
} else {
if (index != -1) {
if (item === String(tableMeta.rowData[23])) {
arrayJumlah.push(0)
} else {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
}
}
}
}
// if (indexs % 2 !== 0) {
// operator.push(item)
// }
})
// if (String(tableMeta.rowData[5]) == "Net Trading Profit (TPAT)") {
// console.log(tableMeta.rowData[3])
// console.log(arrayFormula)
// console.log(arrayJumlah)
// }
let array = arrayJumlah
let total = 0
let opt = ""
array.map((item, index) => {
if (item == "+") {
opt = "tambah"
} else if (item == "-") {
opt = "kurang"
} else if (item == "*") {
opt = "kali"
} else if (item == "/") {
opt = "bagi"
} 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 = R.equals((Number(total) / Number(item)), NaN) ? '0' : (R.equals((Number(total) / Number(item)), Infinity) ? '0' : (Number(total) / Number(item) == "-Infinity") ? "0.0" : Number(total) / Number(item))
} else {
total += Number(item)
}
}
})
total = R.equals(total, NaN) ? "0.0" : (R.equals(total, Infinity) ? "0.0" : (total == "-Infinity" ? "0.0" : total))
// 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)
// }
return Number(total)
}
let columns = [
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "",
options: {
display: false
}
},
{
name: "Account",
options: {
customHeadRender: (columnMeta) => (
......@@ -57,7 +374,24 @@ export default class ProfitLossRO extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{val}
{tableMeta.rowData[0] === null ?
tableMeta.rowData[4] == 0 ?
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(val).toUpperCase()}</span>
</LightTooltip> :
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
}
</div>
)
}
......@@ -66,7 +400,7 @@ export default class ProfitLossRO extends Component {
name: "Notes",
options: {
customHeadRender: (columnMeta) => (
dataTable.length > 0 ?
dataTable2.length > 0 ?
<TableCell style={{ ...stylenotes, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> :
......@@ -87,6 +421,7 @@ export default class ProfitLossRO extends Component {
<div style={{ textAlign: 'right' }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
// this.state.get_for == 'view' ? value :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
......@@ -96,8 +431,12 @@ export default class ProfitLossRO extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
// disabled={this.props.isApprover ? 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)}
defaultValue={value}
inputProps={{
style: {
color: "#5198ea"
}
}}
onBlur={(event) => {
// updateValue(event.target.value)
handleNotes(event.target.value, tableMeta)
......@@ -112,7 +451,7 @@ export default class ProfitLossRO extends Component {
}
}
}, {
name: `31 Dec 2020 Actual`,
name: `31 Dec ${Number(this.props.periode) - 1 } Actual`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -123,7 +462,92 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.a}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
// this.state.get_for == 'view' ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value).toFixed(1)}
// decimalScale={1}
// />
// :
tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[10]}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
value={Number(tableMeta.rowData[10]).toFixed(1)}
decimalScale={1}
fixedDecimalScale={1}
onBlur={(event) => {
handleChange(event.target.value, tableMeta, "actual")
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
decimalScale={1}
value={Number(handleValue(value, tableMeta)).toFixed(1)}
// value={Number(handleValue(tableMeta, 2)).toFixed(1)}
/>
</span> :
tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 5 ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={tableMeta.rowData[10]}
decimalScale={1}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
/>
}
/>
</div>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -140,7 +564,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.b}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -157,7 +612,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.c}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -174,7 +660,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.d}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -191,7 +708,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.e}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -208,7 +756,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.f}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -225,7 +804,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.g}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -242,7 +852,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.h}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -259,7 +900,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.i}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -276,7 +948,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.j}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -293,7 +996,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.k}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -310,7 +1044,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.l}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -327,7 +1092,38 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.m}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
......@@ -344,15 +1140,59 @@ export default class ProfitLossRO extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{value.n}
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
:
<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=""
disabled={true}
value={Number(value).toFixed(1)}
decimalScale={1}
/>
}
/>
</div>
}
</div>
)
}
}
},
]
const loadingComponent = (
<div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
{this.state.loading && loadingComponent}
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Rolling Outlook & Revision CAT</Typography>
</div>
......@@ -364,19 +1204,21 @@ export default class ProfitLossRO extends Component {
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Company Name</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : 2020 rev.1</Typography>
<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>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment