Commit 136ec101 authored by Riri Novita's avatar Riri Novita

pl semua

parent 02e5bcba
......@@ -1402,34 +1402,56 @@ export default class SubHolding extends Component {
let ytd_actual = item.profit_loss.ytd_actual == ''? 0 : item.profit_loss.ytd_actual
let ytd_mb = item.profit_loss.ytd_mb == ''? 0 : item.profit_loss.ytd_mb
let persenYtd = Number(ytd_actual/ytd_mb)
let ytd_last_year = item.profit_loss.ytd_last_year == ''? 0 : item.profit_loss.ytd_last_year
let persenYtdMB = Number(ytd_actual/ytd_mb)
let persenYtdLY = Number(ytd_actual/ytd_last_year)
let q1_actual = item.profit_loss.q1_actual == ''? 0 : item.profit_loss.q1_actual
let q1_mb = item.profit_loss.q1_mb == ''? 0 : item.profit_loss.q1_mb
let persenQuarter = Number(q1_actual/q1_mb)
let q1_last_year = item.profit_loss.q1_last_year == ''? 0 : item.profit_loss.q1_last_year
let persenQuarterMB = Number(q1_actual/q1_mb)
let persenQuarterLY = Number(q1_actual/q1_last_year)
let fy_actual = item.profit_loss.fy_actual == ''? 0 : item.profit_loss.fy_actual
let fy_mb = item.profit_loss.fy_mb == ''? 0 : item.profit_loss.fy_mb
let persenFy = Number(fy_actual/fy_mb)
let fy_ol = item.profit_loss.fy_ol == ''? 0 : item.profit_loss.fy_ol
let fy_last_year = item.profit_loss.fy_last_year == ''? 0 : item.profit_loss.fy_last_year
let persenFyMB = Number(fy_actual/fy_mb)
let persenFyOL = Number(fy_actual/fy_ol)
let persenFyLY = Number(fy_actual/fy_last_year)
let persenFyOLMB = Number(fy_ol/fy_mb)
dbSumaPL.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.profit_loss.mtd_actual,
item.profit_loss.mtd,
isNaN(persenMtd)? 0 : persenMtd * 100,
item.profit_loss.mtd_mb,
isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity'? (item.profit_loss.mtd_mb == '' || item.profit_loss.mtd_mb == 0? -0 : 0) : (item.profit_loss.mtd_mb == '' || item.profit_loss.mtd_mb == 0? persenMtd * -100 : persenMtd * 100),
item.profit_loss.mtd_last_year,
item.profit_loss.ytd_actual,
item.profit_loss.ytd,
isNaN(persenYtd)? 0 : persenYtd * 100,
item.profit_loss.ytd_mb,
isNaN(persenYtdMB) || persenYtdMB == 'Infinity' || persenYtdMB == '-Infinity'? (item.profit_loss.ytd_mb == '' || item.profit_loss.ytd_mb == 0? -0 : 0) : (item.profit_loss.ytd_mb == '' || item.profit_loss.ytd_mb == 0? persenYtdMB * -100 : persenYtdMB * 100),
item.profit_loss.ytd_last_year,
item.profit_loss.quarter_actual,
item.profit_loss.quarter,
isNaN(persenQuarter)? 0 : persenQuarter * 100,
item.profit_loss.quarter_last_year,
isNaN(persenYtdLY) || persenYtdLY == 'Infinity' || persenYtdLY == '-Infinity'? (item.profit_loss.ytd_last_year == '' || item.profit_loss.ytd_last_year == 0? -0 : 0) : (item.profit_loss.ytd_last_year == '' || item.profit_loss.ytd_last_year == 0? persenYtdLY * -100 : persenYtdLY * 100),
item.profit_loss.q1_actual,
item.profit_loss.q1_mb,
isNaN(persenQuarterMB) || persenQuarterMB == 'Infinity' || persenQuarterMB == '-Infinity'? (item.profit_loss.q1_mb == '' || item.profit_loss.q1_mb == 0? -0 : 0) : (item.profit_loss.q1_mb == '' || item.profit_loss.q1_mb == 0? persenQuarterMB * -100 : persenQuarterMB * 100),
item.profit_loss.q1_last_year,
isNaN(persenQuarterLY) || persenQuarterLY == 'Infinity' || persenQuarterLY == '-Infinity'? (item.profit_loss.q1_last_year == '' || item.profit_loss.q1_last_year == 0? -0 : 0) : (item.profit_loss.q1_last_year == '' || item.profit_loss.q1_last_year == 0? persenQuarterLY * -100 : persenQuarterLY * 100),
item.profit_loss.fy_actual,
item.profit_loss.fy,
isNaN(persenFy)? 0 : persenFy * 100,
item.profit_loss.fy_mb,
isNaN(persenFyMB) || persenFyMB == 'Infinity' || persenFyMB == '-Infinity'? (item.profit_loss.fy_mb == '' || item.profit_loss.fy_mb == 0? -0 : 0) : (item.profit_loss.fy_mb == '' || item.profit_loss.fy_mb == 0? persenFyMB * -100 : persenFyMB * 100),
item.profit_loss.fy_ol,
isNaN(persenFyOL) || persenFyOL == 'Infinity' || persenFyOL == '-Infinity'? (item.profit_loss.fy_ol == '' || item.profit_loss.fy_ol == 0? -0 : 0) : (item.profit_loss.fy_ol == '' || item.profit_loss.fy_ol == 0? persenFyOL * -100 : persenFyOL * 100),
item.profit_loss.fy_last_year,
isNaN(persenFyLY) || persenFyLY == 'Infinity' || persenFyLY == '-Infinity'? (item.profit_loss.fy_last_year == '' || item.profit_loss.fy_last_year == 0? -0 : 0) : (item.profit_loss.fy_last_year == '' || item.profit_loss.fy_last_year == 0? persenFyLY * -100 : persenFyLY * 100),
isNaN(persenFyOLMB) || persenFyOLMB == 'Infinity' || persenFyOLMB == '-Infinity'? (item.profit_loss.fy_percent_ach_ol_to_mb == '' || item.profit_loss.fy_percent_ach_ol_to_mb == 0? -0 : 0) : (item.profit_loss.fy_percent_ach_ol_to_mb == '' || item.profit_loss.fy_percent_ach_ol_to_mb == 0? persenFyOLMB * -100 : persenFyOLMB * 100),
item.profit_loss.forecast_next_year,
item.profit_loss.forecast_more_year
])
}
if (item.children !== null) {
......@@ -1442,39 +1464,59 @@ export default class SubHolding extends Component {
}
res.map((item,index) => {
let mtd_actual = item.profit_loss.mtd_actual == ''? 0 : item.profit_loss.mtd_actual
let mtd = item.profit_loss.mtd == ''? 0 : item.profit_loss.mtd
let persenMtd = Number(mtd_actual/mtd)
console.log(persenMtd)
let mtd_mb = item.profit_loss.mtd_mb == ''? 0 : item.profit_loss.mtd_mb
let persenMtd = Number(mtd_actual/mtd_mb)
let ytd_actual = item.profit_loss.ytd_actual == ''? 0 : item.profit_loss.ytd_actual
let ytd = item.profit_loss.ytd == ''? 0 : item.profit_loss.ytd
let persenYtd = Number(ytd_actual/ytd)
let ytd_mb = item.profit_loss.ytd_mb == ''? 0 : item.profit_loss.ytd_mb
let ytd_last_year = item.profit_loss.ytd_last_year == ''? 0 : item.profit_loss.ytd_last_year
let persenYtdMB = Number(ytd_actual/ytd_mb)
let persenYtdLY = Number(ytd_actual/ytd_last_year)
let quarter_actual = item.profit_loss.quarter_actual == ''? 0 : item.profit_loss.quarter_actual
let quarter = item.profit_loss.quarter == ''? 0 : item.profit_loss.quarter
let persenQuarter = Number(quarter_actual/quarter)
let q1_actual = item.profit_loss.q1_actual == ''? 0 : item.profit_loss.q1_actual
let q1_mb = item.profit_loss.q1_mb == ''? 0 : item.profit_loss.q1_mb
let q1_last_year = item.profit_loss.q1_last_year == ''? 0 : item.profit_loss.q1_last_year
let persenQuarterMB = Number(q1_actual/q1_mb)
let persenQuarterLY = Number(q1_actual/q1_last_year)
let fy_actual = item.profit_loss.fy_actual == ''? 0 : item.profit_loss.fy_actual
let fy = item.profit_loss.fy == ''? 0 : item.profit_loss.fy
let persenFy = Number(fy_actual/fy)
let fy_mb = item.profit_loss.fy_mb == ''? 0 : item.profit_loss.fy_mb
let fy_ol = item.profit_loss.fy_ol == ''? 0 : item.profit_loss.fy_ol
let fy_last_year = item.profit_loss.fy_last_year == ''? 0 : item.profit_loss.fy_last_year
let persenFyMB = Number(fy_actual/fy_mb)
let persenFyOL = Number(fy_actual/fy_ol)
let persenFyLY = Number(fy_actual/fy_last_year)
let persenFyOLMB = Number(fy_ol/fy_mb)
dbSumaPL.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.profit_loss.mtd_actual,
item.profit_loss.mtd_mb,
isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity'? (item.profit_loss.mtd == '' || item.profit_loss.mtd == 0? -0 : 0) : (item.profit_loss.mtd == '' || item.profit_loss.mtd == 0? persenMtd * -100 : persenMtd * 100),
isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity'? (item.profit_loss.mtd_mb == '' || item.profit_loss.mtd_mb == 0? -0 : 0) : (item.profit_loss.mtd_mb == '' || item.profit_loss.mtd_mb == 0? persenMtd * -100 : persenMtd * 100),
item.profit_loss.mtd_last_year,
item.profit_loss.ytd_actual,
item.profit_loss.ytd,
isNaN(persenYtd) || persenYtd == 'Infinity' || persenYtd == '-Infinity'? (item.profit_loss.ytd == '' || item.profit_loss.ytd == 0? -0 : 0) : (item.profit_loss.ytd == '' || item.profit_loss.ytd == 0? persenYtd * -100 : persenYtd * 100),
item.profit_loss.ytd_mb,
isNaN(persenYtdMB) || persenYtdMB == 'Infinity' || persenYtdMB == '-Infinity'? (item.profit_loss.ytd_mb == '' || item.profit_loss.ytd_mb == 0? -0 : 0) : (item.profit_loss.ytd_mb == '' || item.profit_loss.ytd_mb == 0? persenYtdMB * -100 : persenYtdMB * 100),
item.profit_loss.ytd_last_year,
item.profit_loss.quarter_actual,
item.profit_loss.quarter,
isNaN(persenQuarter) || persenQuarter == 'Infinity' || persenQuarter == '-Infinity'? (item.profit_loss.quarter == '' || item.profit_loss.quarter == 0? -0 : 0) : (item.profit_loss.quarter == '' || item.profit_loss.quarter == 0? persenQuarter * -100 : persenQuarter * 100),
item.profit_loss.quarter_last_year,
isNaN(persenYtdLY) || persenYtdLY == 'Infinity' || persenYtdLY == '-Infinity'? (item.profit_loss.ytd_last_year == '' || item.profit_loss.ytd_last_year == 0? -0 : 0) : (item.profit_loss.ytd_last_year == '' || item.profit_loss.ytd_last_year == 0? persenYtdLY * -100 : persenYtdLY * 100),
item.profit_loss.q1_actual,
item.profit_loss.q1_mb,
isNaN(persenQuarterMB) || persenQuarterMB == 'Infinity' || persenQuarterMB == '-Infinity'? (item.profit_loss.q1_mb == '' || item.profit_loss.q1_mb == 0? -0 : 0) : (item.profit_loss.q1_mb == '' || item.profit_loss.q1_mb == 0? persenQuarterMB * -100 : persenQuarterMB * 100),
item.profit_loss.q1_last_year,
isNaN(persenQuarterLY) || persenQuarterLY == 'Infinity' || persenQuarterLY == '-Infinity'? (item.profit_loss.q1_last_year == '' || item.profit_loss.q1_last_year == 0? -0 : 0) : (item.profit_loss.q1_last_year == '' || item.profit_loss.q1_last_year == 0? persenQuarterLY * -100 : persenQuarterLY * 100),
item.profit_loss.fy_actual,
item.profit_loss.fy,
isNaN(persenFy) || persenFy == 'Infinity' || persenFy == '-Infinity'? (item.profit_loss.fy == '' || item.profit_loss.fy == 0? -0 : 0) : (item.profit_loss.fy == '' || item.profit_loss.fy == 0? persenFy * -100 : persenFy * 100),
item.profit_loss.fy_mb,
isNaN(persenFyMB) || persenFyMB == 'Infinity' || persenFyMB == '-Infinity'? (item.profit_loss.fy_mb == '' || item.profit_loss.fy_mb == 0? -0 : 0) : (item.profit_loss.fy_mb == '' || item.profit_loss.fy_mb == 0? persenFyMB * -100 : persenFyMB * 100),
item.profit_loss.fy_ol,
isNaN(persenFyOL) || persenFyOL == 'Infinity' || persenFyOL == '-Infinity'? (item.profit_loss.fy_ol == '' || item.profit_loss.fy_ol == 0? -0 : 0) : (item.profit_loss.fy_ol == '' || item.profit_loss.fy_ol == 0? persenFyOL * -100 : persenFyOL * 100),
item.profit_loss.fy_last_year,
isNaN(persenFyLY) || persenFyLY == 'Infinity' || persenFyLY == '-Infinity'? (item.profit_loss.fy_last_year == '' || item.profit_loss.fy_last_year == 0? -0 : 0) : (item.profit_loss.fy_last_year == '' || item.profit_loss.fy_last_year == 0? persenFyLY * -100 : persenFyLY * 100),
isNaN(persenFyOLMB) || persenFyOLMB == 'Infinity' || persenFyOLMB == '-Infinity'? (item.profit_loss.fy_percent_ach_ol_to_mb == '' || item.profit_loss.fy_percent_ach_ol_to_mb == 0? -0 : 0) : (item.profit_loss.fy_percent_ach_ol_to_mb == '' || item.profit_loss.fy_percent_ach_ol_to_mb == 0? persenFyOLMB * -100 : persenFyOLMB * 100),
])
if (item.children !== null) {
if (item.children.length > 0) {
......
......@@ -1029,21 +1029,6 @@ export default class TableSubHolding extends Component {
return total
}
let datas = [
["ABCD", "Testing", { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }],
["Total Assets", "Notes", { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }]
]
let dataSummaryBS = [
["ABCD", { a: "0", b: "0", c: "0", d: "0" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }],
["Total Assets", { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }]
]
let dataSummaryPL = [
["ABCD", { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }],
["Total Assets", { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }]
]
let dataSummaryFR = [
["ABCD", "test unit", { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }, { a: "2", b: "3", c: "4", d: "5" }],
["Total Assets", "unit try", { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }, { a: "6", b: "7", c: "8", d: "9" }]
......@@ -15311,6 +15296,31 @@ export default class TableSubHolding extends Component {
const columnSummaryPL = [
{
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) => (
......@@ -15322,13 +15332,20 @@ export default class TableSubHolding extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{ val }
{
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>
)
}
}
}, {
name: `MTD 2021`,
name: `MTD ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
......@@ -15353,32 +15370,101 @@ export default class TableSubHolding extends Component {
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta)
console.log(val)
return (
<div>
<div className="grid grid-1x content-center">
<div className="grid grid-4x content-center">
<div className="col-1">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[6]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-2">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[7]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-3">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[8]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-4">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[9]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
</div>
......@@ -15387,13 +15473,13 @@ export default class TableSubHolding extends Component {
}
}
}, {
name: `YTD 2021`,
name: `YTD ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 50 }}>{columnMeta.name}</div>
<div className="grid grid-1x" style={{ ...style2, backgroundColor: '#37b5e6', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1 grid grid-4x" style={{ placeSelf: 'center', textAlign: 'center' }}>
<div className="column-1 grid grid-5x" style={{ placeSelf: 'center', textAlign: 'center' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Actual"}</span>
</div>
......@@ -15406,38 +15492,133 @@ export default class TableSubHolding extends Component {
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d06' }}>
<span>{"Last Year"}</span>
</div>
<div className="column-5" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d06' }}>
<span>{"% of LY"}</span>
</div>
</div>
</div>
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta)
console.log(val)
return (
<div>
<div className="grid grid-1x content-center">
<div className="grid grid-4x content-center">
<div className="grid grid-5x content-center">
<div className="col-1">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[10]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-2">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[11]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-3">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[12]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-4">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[13]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-5">
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[14]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
</div>
......@@ -15446,13 +15627,13 @@ export default class TableSubHolding extends Component {
}
}
}, {
name: `Q1 2021`,
name: `Q1 ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
<div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 50 }}>{columnMeta.name}</div>
<div className="grid grid-1x" style={{ ...style2, backgroundColor: '#37b5e6', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1 grid grid-4x" style={{ placeSelf: 'center', textAlign: 'center' }}>
<div className="column-1 grid grid-5x" style={{ placeSelf: 'center', textAlign: 'center' }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Actual"}</span>
</div>
......@@ -15465,47 +15646,142 @@ export default class TableSubHolding extends Component {
<div className="column-4" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d06' }}>
<span>{"Last Year"}</span>
</div>
<div className="column-5" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d06' }}>
<span>{"% of LY"}</span>
</div>
</div>
</div>
</th>
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta)
console.log(val)
return (
<div>
<div className="grid grid-1x content-center">
<div className="grid grid-4x content-center">
<div className="grid grid-5x content-center">
<div className="col-1">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
</div>
</div>
<div className="col-2">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
</div>
</div>
<div className="col-3">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
</div>
</div>
<div className="col-4">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
</div>
</div>
</div>
</div>
</div>
)
}
}
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[15]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-2">
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[16]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-3">
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[17]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-4">
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[18]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-5">
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[19]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
</div>
</div>
)
}
}
}, {
name: `FY 2021`,
name: `FY ${this.props.periode}`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
......@@ -15544,57 +15820,198 @@ export default class TableSubHolding extends Component {
),
setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => {
console.log(tableMeta)
console.log(val)
return (
<div>
<div className="grid grid-2x content-center">
<div className="col-1">
<div className="grid grid-4x content-center">
<div className="col-1">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[20]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-2">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[21]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-3">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[22]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-4">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[23]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
</div>
<div className="col-2">
<div className="grid grid-4x content-center">
<div className="col-1">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[24]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-2">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[25]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-3">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[26]).toFixed(1)}
/>
}
/>
</div>
}
</div>
<div className="col-4">
<div style={{ textAlign: 'center', width: 90 }}>
0.0
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[27]).toFixed(1)}
/>
}
/>
</div>
}
</div>
</div>
</div>
......@@ -15604,7 +16021,7 @@ export default class TableSubHolding extends Component {
}
}
}, {
name: "2022",
name: `${Number(this.props.periode) + 1}`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, top: 0, zIndex: 102, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
......@@ -15613,7 +16030,7 @@ export default class TableSubHolding extends Component {
</TableCell> */}
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 50 }}>{columnMeta.name}</div>
<div className="grid grid-1x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#1c71b8', width: 96 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#1c71b8', width: 145 }}>
<span>{"ForeCast"}</span>
</div>
</div>
......@@ -15623,13 +16040,33 @@ export default class TableSubHolding extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[28]).toFixed(1)}
/>
}
/>
</div>
}
</div>
)
}
}
}, {
name: "2023",
name: `${Number(this.props.periode) + 2}`,
options: {
customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, top: 0, zIndex: 102, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
......@@ -15638,7 +16075,7 @@ export default class TableSubHolding extends Component {
</TableCell> */}
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 50 }}>{columnMeta.name}</div>
<div className="grid grid-1x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#1c71b8', width: 96 }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#1c71b8', width: 145 }}>
<span>{"ForeCast"}</span>
</div>
</div>
......@@ -15648,12 +16085,123 @@ export default class TableSubHolding extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
null
: tableMeta.rowData[0] === 1 ?
null :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={val}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(tableMeta.rowData[29]).toFixed(1)}
/>
}
/>
</div>
}
</div>
)
}
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}
]
const columnSummaryFR = [
......@@ -16148,7 +16696,7 @@ export default class TableSubHolding extends Component {
<div style={{ padding: '0px 20px 20px 20px', width: this.props.width - (this.props.open === true ? 350 : 100) }}>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.props.type === 8 ? dataSummaryPL : this.props.type === 9 ? dataSummaryFR : dataTable2}
data={this.props.type === 9 ? dataSummaryFR : dataTable2}
columns={this.props.type === 2 ? columnDBBS : this.props.type === 1 ? columnDBPLDetail : this.props.type === 3 ? columnDBPL : this.props.type === 4 ? columnDBFR : this.props.type === 5 ? columnDBTP : this.props.type === 7 ? columnSummaryBS : this.props.type === 21 ? columnDBOI : this.props.type === 6? columnDBCF : this.props.type === 8 ? columnSummaryPL : this.props.type === 9 ? columnSummaryFR : columns}
options={options}
/>
......@@ -376,22 +376,22 @@ export default class ProfitLossMR extends Component {
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"notes": i[6],
"rolling_outlook": i[7],
"master_budget": i[8],
"rolling_budget": i[9],
"actual": i[10],
"ytd_actual": i[11],
"actual_previous_month": i[12],
"amount_act_vs_previous_month": i[13],
"percent_act_vs_previous_month": i[14],
"amount_act_vs_mb": i[15],
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_mb": i[19],
"mtd_vs_rb": i[20],
"mtd_vs_previous_month": i[21],
"notes": String(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_mb": String(i[19]),
"mtd_vs_rb": String(i[20]),
"mtd_vs_previous_month": String(i[21]),
})
})
let payload = {
......@@ -405,31 +405,31 @@ export default class ProfitLossMR extends Component {
}
console.log(payload);
// console.log(JSON.stringify(payload));
api.create('UPLOAD').createMonthlyReportPL(payload).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
if (type == 'submitted') {
this.props.saveToMonthlyReport('PL')
} else {
this.props.saveToMonthlyReport()
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
document.body.style.overflow = 'unset';
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
this.props.saveToMonthlyReport()
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 })
}
})
// api.create('UPLOAD').createMonthlyReportPL(payload).then(response => {
// console.log(response);
// if (response.data) {
// if (response.data.status === "success") {
// if (type == 'submitted') {
// this.props.saveToMonthlyReport('PL')
// } else {
// this.props.saveToMonthlyReport()
// }
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
// document.body.style.overflow = 'unset';
// if (response.data.message.includes("Someone Logged In")) {
// setTimeout(() => {
// localStorage.removeItem(Constant.TOKEN)
// window.location.reload();
// }, 1000);
// }
// this.props.saveToMonthlyReport()
// })
// }
// } else {
// this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 })
// }
// })
}
fileHandler = (event) => {
......
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