Commit b3f188bc authored by faisalhamdi's avatar faisalhamdi

nambah note

parent 3397b424
import { createMuiTheme, MuiThemeProvider, Paper, TableCell, Typography } from '@material-ui/core' 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 MUIDataTable from 'mui-datatables';
import React, { Component } from 'react' import NumberFormat from 'react-number-format';
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
import api from '../../api'; 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'
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"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3()); const getMuiTheme = () => createMuiTheme(ct.customTable3());
const options = ct.customOptionsFixedColumn(); const options = ct.customOptionsFixedColumn();
const style = { const style = {
position: "sticky", position: "sticky",
left: 0, left: 0,
zIndex: 101,
background: "white", background: "white",
zIndex: 101,
}; };
const style2 = { const style2 = {
position: "sticky", position: "sticky",
background: "white", background: "white",
zIndex: 100, zIndex: 100
top: 0
}; };
export default class FixedAssetsMovementMR extends Component { export default class FixedAssetsMovementMR extends Component {
...@@ -131,193 +144,211 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -131,193 +144,211 @@ export default class FixedAssetsMovementMR extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let columns = [ const columns = [{
{ name: "Account",
name: "Account", options: {
options: { customHeadRender: (columnMeta) => (
customHeadRender: (columnMeta) => ( <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> </TableCell>
</TableCell> ),
), setCellProps: () => ({ style }),
setCellProps: () => ({ style }), customBodyRender: (val, tableMeta) => {
customBodyRender: (val, tableMeta) => { return (
return ( <div style={{ width: 300 }}>
<div style={{ width: 300 }}> {console.log(tableMeta)}
{val} {tableMeta.rowData[24] ?
</div> tableMeta.rowData[24].length > 0 ?
) <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>
:
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: `Month To Date (MTD)`, name: `Month To Date (MTD)`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} > <th style={{ ...style2, color: '#fff', backgroundColor: '#07a7d0', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
{/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> */} </TableCell> */}
<div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div> <div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}> <div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Master Budget (MB)"}</span> <span>{"Master Budget (MB)"}</span>
</div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
<span>{"Rolling Budget (RB)"}</span>
</div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6' }}>
<span>{"Actual"}</span>
</div>
</div> </div>
</th> <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0' }}>
), <span>{"Rolling Budget (RB)"}</span>
setCellProps: () => ({ style2 }), </div>
customBodyRender: (val, tableMeta, updateValue) => { <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6' }}>
return ( <span>{"Actual"}</span>
<div> </div>
<div className="grid grid-3x content-center"> </div>
<div className="col-1"> </th>
<div style={{ textAlign: 'right', width: 90 }}> ),
{val.a} setCellProps: () => ({ style2 }),
</div> customBodyRender: (val, tableMeta, updateValue) => {
return (
<div>
<div className="grid grid-3x content-center">
<div className="col-1">
<div style={{ textAlign: 'right', width: 90 }}>
{val.a}
</div> </div>
<div className="col-2"> </div>
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-2">
{val.b} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.b}
</div> </div>
<div className="col-3"> </div>
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-3">
{val.c} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.c}
</div> </div>
</div> </div>
</div> </div>
) </div>
} )
} }
}, }
{ }, {
name: "Actual Previous Month", name: "Actual Previous Month",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell> </TableCell>
), ),
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (val, tableMeta, updateValue) => { customBodyRender: (val, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right', width: 90 }}> <div style={{ textAlign: 'right', width: 90 }}>
{val} {val}
</div> </div>
) )
}
} }
}, }
{ }, {
name: `Variance`, name: `Variance`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} > <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 }}>{columnMeta.name}</div> <div style={{ borderBottom: "1px #fff solid", textAlign: 'center', fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
<div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}> <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
<div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#37b5e6' }}> <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div style={{ borderBottom: '1px #fff solid', backgroundColor: '#37b5e6' }}> <div style={{ borderBottom: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<span>{"Act vs Previous Month"}</span> <span>{"Act vs Previous Month"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<span>{"Amount"}</span>
</div> </div>
<div className="grid grid-2x"> <div className="column-2" style={{ borderLeft: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid', backgroundColor: '#37b5e6' }}> <span>{"%"}</span>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid', backgroundColor: '#37b5e6' }}>
<span>{"%"}</span>
</div>
</div> </div>
</div> </div>
<div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}> </div>
<div style={{ borderBottom: '1px #fff solid' }}> <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
<span>{"Act vs MB"}</span> <div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs MB"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<span>{"Amount"}</span>
</div> </div>
<div className="grid grid-2x"> <div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid' }}> <span>{"%"}</span>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<span>{"%"}</span>
</div>
</div> </div>
</div> </div>
<div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}> </div>
<div style={{ borderBottom: '1px #fff solid' }}> <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
<span>{"Act vs RB"}</span> <div style={{ borderBottom: '1px #fff solid' }}>
<span>{"Act vs RB"}</span>
</div>
<div className="grid grid-2x">
<div className="column-1" style={{ borderRight: '1px #fff solid' }}>
<span>{"Amount"}</span>
</div> </div>
<div className="grid grid-2x"> <div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<div className="column-1" style={{ borderRight: '1px #fff solid' }}> <span>{"%"}</span>
<span>{"Amount"}</span>
</div>
<div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
<span>{"%"}</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</th> </div>
), </th>
setCellProps: () => ({ style2 }), ),
customBodyRender: (val, tableMeta, updateValue) => { setCellProps: () => ({ style2 }),
return ( customBodyRender: (val, tableMeta, updateValue) => {
<div> return (
<div className="grid grid-3x content-center"> <div>
<div className="col-1"> <div className="grid grid-3x content-center">
<div className="grid grid-2x content-center"> <div className="col-1">
<div className="col-1"> <div className="grid grid-2x content-center">
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-1">
{val.a} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.a}
</div> </div>
<div className="col-2"> </div>
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-2">
{val.b} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.b}
</div> </div>
</div> </div>
</div> </div>
<div className="col-2"> </div>
<div className="grid grid-2x content-center"> <div className="col-2">
<div className="col-1"> <div className="grid grid-2x content-center">
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-1">
{val.c} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.c}
</div> </div>
<div className="col-2"> </div>
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-2">
{val.d} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.d}
</div> </div>
</div> </div>
</div> </div>
<div className="col-3"> </div>
<div className="grid grid-2x content-center"> <div className="col-3">
<div className="col-1"> <div className="grid grid-2x content-center">
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-1">
{val.e} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.e}
</div> </div>
<div className="col-2"> </div>
<div style={{ textAlign: 'right', width: 90 }}> <div className="col-2">
{val.f} <div style={{ textAlign: 'right', width: 90 }}>
</div> {val.f}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
) </div>
} )
} }
}, }
}
] ]
// let data = [ // let data = [
// ["Total Assets", { a: "2", b: "3", c: "4" }, "5", { a: "6", b: "7", c: "8", d: "9", e: "10", f: "11" }], // ["Total Assets", { a: "2", b: "3", c: "4" }, "5", { a: "6", b: "7", c: "8", d: "9", e: "10", f: "11" }],
......
...@@ -35,6 +35,19 @@ const style2 = { ...@@ -35,6 +35,19 @@ const style2 = {
background: "white", background: "white",
zIndex: 100 zIndex: 100
}; };
const stylenotes = {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
};
const styleNotesEmpty = {
position: "sticky",
background: "white",
zIndex: 99,
left: 0
}
export default class ProfitLossOLPA extends Component { export default class ProfitLossOLPA extends Component {
constructor(props) { constructor(props) {
...@@ -104,6 +117,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -104,6 +117,7 @@ export default class ProfitLossOLPA extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before, item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
item.profit_loss.january, item.profit_loss.january,
item.profit_loss.february, item.profit_loss.february,
...@@ -137,6 +151,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -137,6 +151,7 @@ export default class ProfitLossOLPA extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.profit_loss.notes === "" ? null : item.profit_loss.notes,
item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before, item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
item.profit_loss.january, item.profit_loss.january,
item.profit_loss.february, item.profit_loss.february,
...@@ -200,20 +215,21 @@ export default class ProfitLossOLPA extends Component { ...@@ -200,20 +215,21 @@ export default class ProfitLossOLPA extends Component {
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(Number(i[6]).toFixed(1)), notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
january: String(Number(i[7]).toFixed(1)), total_actual_before: String(Number(i[7]).toFixed(1)),
february: String(Number(i[8]).toFixed(1)), january: String(Number(i[8]).toFixed(1)),
march: String(Number(i[9]).toFixed(1)), february: String(Number(i[9]).toFixed(1)),
april: String(Number(i[10]).toFixed(1)), march: String(Number(i[10]).toFixed(1)),
may: String(Number(i[11]).toFixed(1)), april: String(Number(i[11]).toFixed(1)),
june: String(Number(i[12]).toFixed(1)), may: String(Number(i[12]).toFixed(1)),
july: String(Number(i[13]).toFixed(1)), june: String(Number(i[13]).toFixed(1)),
august: String(Number(i[14]).toFixed(1)), july: String(Number(i[14]).toFixed(1)),
september: String(Number(i[15]).toFixed(1)), august: String(Number(i[15]).toFixed(1)),
october: String(Number(i[16]).toFixed(1)), september: String(Number(i[16]).toFixed(1)),
november: String(Number(i[17]).toFixed(1)), october: String(Number(i[17]).toFixed(1)),
december: String(Number(i[18]).toFixed(1)), november: String(Number(i[18]).toFixed(1)),
total_current_year: String(Number(i[19]).toFixed(1)), december: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1))
}) })
}) })
let payload = { let payload = {
...@@ -262,20 +278,21 @@ export default class ProfitLossOLPA extends Component { ...@@ -262,20 +278,21 @@ export default class ProfitLossOLPA extends Component {
payload.push({ payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(),
total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(), notes: i[2] === undefined ? "" : String(i[2]).trim(),
january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(), total_actual_before: 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(), january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(), february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(), march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(), april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(), may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(), june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(), july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(), august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(), september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(), october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(), november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(), december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim()
}) })
} }
}) })
...@@ -306,6 +323,7 @@ export default class ProfitLossOLPA extends Component { ...@@ -306,6 +323,7 @@ export default class ProfitLossOLPA extends Component {
item.formula, item.formula,
item.level, item.level,
item.item_report, item.item_report,
item.notes,
item.total_actual_before, item.total_actual_before,
item.january, item.january,
item.february, item.february,
...@@ -343,20 +361,21 @@ export default class ProfitLossOLPA extends Component { ...@@ -343,20 +361,21 @@ export default class ProfitLossOLPA extends Component {
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(Number(i[6]).toFixed(1)), notes: String(i[6]),
january: String(Number(i[7]).toFixed(1)), total_actual_before: String(Number(i[7]).toFixed(1)),
february: String(Number(i[8]).toFixed(1)), january: String(Number(i[8]).toFixed(1)),
march: String(Number(i[9]).toFixed(1)), february: String(Number(i[9]).toFixed(1)),
april: String(Number(i[10]).toFixed(1)), march: String(Number(i[10]).toFixed(1)),
may: String(Number(i[11]).toFixed(1)), april: String(Number(i[11]).toFixed(1)),
june: String(Number(i[12]).toFixed(1)), may: String(Number(i[12]).toFixed(1)),
july: String(Number(i[13]).toFixed(1)), june: String(Number(i[13]).toFixed(1)),
august: String(Number(i[14]).toFixed(1)), july: String(Number(i[14]).toFixed(1)),
september: String(Number(i[15]).toFixed(1)), august: String(Number(i[15]).toFixed(1)),
october: String(Number(i[16]).toFixed(1)), september: String(Number(i[16]).toFixed(1)),
november: String(Number(i[17]).toFixed(1)), october: String(Number(i[17]).toFixed(1)),
december: String(Number(i[18]).toFixed(1)), november: String(Number(i[18]).toFixed(1)),
total_current_year: String(Number(i[19]).toFixed(1)) december: String(Number(i[19]).toFixed(1)),
total_current_year: String(Number(i[20]).toFixed(1))
}) })
}) })
let body = { let body = {
...@@ -408,20 +427,21 @@ export default class ProfitLossOLPA extends Component { ...@@ -408,20 +427,21 @@ export default class ProfitLossOLPA extends Component {
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
total_actual_before: String(i[6]), notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
january: i[0] === 3 && i[7] === "" ? "0" : String(i[7]), total_actual_before: String(i[7]),
february: i[0] === 3 && i[8] === "" ? "0" : String(i[8]), january: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
march: i[0] === 3 && i[9] === "" ? "0" : String(i[9]), february: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
april: i[0] === 3 && i[10] === "" ? "0" : String(i[10]), march: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
may: i[0] === 3 && i[11] === "" ? "0" : String(i[11]), april: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
june: i[0] === 3 && i[12] === "" ? "0" : String(i[12]), may: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
july: i[0] === 3 && i[13] === "" ? "0" : String(i[13]), june: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
august: i[0] === 3 && i[14] === "" ? "0" : String(i[14]), july: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
september: i[0] === 3 && i[15] === "" ? "0" : String(i[15]), august: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
october: i[0] === 3 && i[16] === "" ? "0" : String(i[16]), september: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
november: i[0] === 3 && i[17] === "" ? "0" : String(i[17]), october: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
december: i[0] === 3 && i[18] === "" ? "0" : String(i[18]), november: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(i[19]) december: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
total_current_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20])
}) })
}) })
let payload = { let payload = {
...@@ -489,6 +509,11 @@ export default class ProfitLossOLPA extends Component { ...@@ -489,6 +509,11 @@ export default class ProfitLossOLPA extends Component {
} }
// console.log(total); // console.log(total);
} }
const handleNotes = (value, tableMeta) => {
// console.log(value)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// console.log(dataTable2[tableMeta.rowIndex]);
}
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
...@@ -610,6 +635,55 @@ export default class ProfitLossOLPA extends Component { ...@@ -610,6 +635,55 @@ export default class ProfitLossOLPA extends Component {
) )
} }
} }
}, {
name: "Notes",
options: {
customHeadRender: (columnMeta) => (
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> :
<TableCell style={{ ...styleNotesEmpty, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96 }}>
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
setCellProps: () => ({
style: {
position: "sticky",
background: "white",
zIndex: 101,
left: 350
}
}),
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
<div style={{ flex: 1 }}>
{tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
<Input
disableUnderline={true}
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}
onBlur={(event) => {
// updateValue(event.target.value)
handleNotes(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>}
</div>
</div>
)
}
}
}, { }, {
name: `31 Dec ${Number(this.props.periode) - 1} Actual`, name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
options: { options: {
......
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