Commit 73927f46 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

update balancesheet ter new

See merge request !336
parents db1fd98d a04bd94d
...@@ -80,7 +80,7 @@ export default class BalanceSheet extends Component { ...@@ -80,7 +80,7 @@ export default class BalanceSheet extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.total_actual_before === null ? "" : item.balance_sheet.total_actual_before, item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
item.balance_sheet.january, item.balance_sheet.january,
item.balance_sheet.february, item.balance_sheet.february,
item.balance_sheet.march, item.balance_sheet.march,
...@@ -114,7 +114,7 @@ export default class BalanceSheet extends Component { ...@@ -114,7 +114,7 @@ export default class BalanceSheet extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.total_actual_before === null ? "" : item.balance_sheet.total_actual_before, item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
item.balance_sheet.january, item.balance_sheet.january,
item.balance_sheet.february, item.balance_sheet.february,
item.balance_sheet.march, item.balance_sheet.march,
...@@ -235,7 +235,7 @@ export default class BalanceSheet extends Component { ...@@ -235,7 +235,7 @@ export default class BalanceSheet extends Component {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
console.log(resp.rows[2]); console.log(resp.rows[2]);
let payload = [] let payload = []
let reg = /^\d+$/; let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => { isi.map((i, index) => {
if (i.length > 0) { if (i.length > 0) {
payload.push({ payload.push({
...@@ -382,9 +382,12 @@ export default class BalanceSheet extends Component { ...@@ -382,9 +382,12 @@ export default class BalanceSheet extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta, type) => {
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
// let data = this.state.dataTable2 // let data = this.state.dataTable2
if (type === "actual") {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} else {
let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2]) let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) { if (indexParent > 0) {
// console.log(indexParent) // console.log(indexParent)
...@@ -395,6 +398,7 @@ export default class BalanceSheet extends Component { ...@@ -395,6 +398,7 @@ export default class BalanceSheet extends Component {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} }
} }
}
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
...@@ -516,7 +520,7 @@ export default class BalanceSheet extends Component { ...@@ -516,7 +520,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[2] : "31 Dec 2020 Actual", name: this.state.judulColumn !== null ? this.state.judulColumn[2] : `31 Dec ${Number(this.props.periode) - 1} Actual`,
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 }}>
...@@ -527,83 +531,32 @@ export default class BalanceSheet extends Component { ...@@ -527,83 +531,32 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 3 ? {tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={value} value={value}
control={ control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
console.log(dataTable2)
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={handleValue(tableMeta)} value={value}
/>
</span>
:
tableMeta.rowData[0] === 4 ?
null
:
tableMeta.rowData[0] === 6 ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/> />
: }
tableMeta.rowData[0] === 5 ?
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={handleFormula(value, tableMeta)}
/> />
: </div>
tableMeta.rowData[0] === 1 ?
// value === "" ?
// null :
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={Number(value)}
// />
null
:
null
} }
</div> </div>
) )
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[3] : "Jan 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[3] : `Jan ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -622,6 +575,7 @@ export default class BalanceSheet extends Component { ...@@ -622,6 +575,7 @@ export default class BalanceSheet extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
decimalSeparator={"."}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
...@@ -689,7 +643,7 @@ export default class BalanceSheet extends Component { ...@@ -689,7 +643,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[4] : "Feb 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[4] : `Feb ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -776,7 +730,7 @@ export default class BalanceSheet extends Component { ...@@ -776,7 +730,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[5] : "Mar 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[5] : `Mar ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -863,7 +817,7 @@ export default class BalanceSheet extends Component { ...@@ -863,7 +817,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[6] : "Apr 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[6] : `Apr ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -950,7 +904,7 @@ export default class BalanceSheet extends Component { ...@@ -950,7 +904,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[7] : "May 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[7] : `May ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1037,7 +991,7 @@ export default class BalanceSheet extends Component { ...@@ -1037,7 +991,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[8] : "Jun 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[8] : `Jun ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1124,7 +1078,7 @@ export default class BalanceSheet extends Component { ...@@ -1124,7 +1078,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[9] : "Jul 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[9] : `Jul ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1211,7 +1165,7 @@ export default class BalanceSheet extends Component { ...@@ -1211,7 +1165,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[10] : "Aug 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[10] : `Aug ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1298,7 +1252,7 @@ export default class BalanceSheet extends Component { ...@@ -1298,7 +1252,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[11] : "Sep 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[11] : `Sep ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1385,7 +1339,7 @@ export default class BalanceSheet extends Component { ...@@ -1385,7 +1339,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[12] : "Oct 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[12] : `Oct ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1472,7 +1426,7 @@ export default class BalanceSheet extends Component { ...@@ -1472,7 +1426,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[13] : "Nov 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[13] : `Nov ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1559,7 +1513,7 @@ export default class BalanceSheet extends Component { ...@@ -1559,7 +1513,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[14] : "Dec 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[14] : `Dec ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1733,7 +1687,7 @@ export default class BalanceSheet extends Component { ...@@ -1733,7 +1687,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[16] : "31 Dec 2022 Total", name: this.state.judulColumn !== null ? this.state.judulColumn[16] : `31 Dec ${Number(this.props.periode) + 1} Total`,
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 }}>
...@@ -1820,7 +1774,7 @@ export default class BalanceSheet extends Component { ...@@ -1820,7 +1774,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[17] : "31 Dec 2023 Total", name: this.state.judulColumn !== null ? this.state.judulColumn[17] : `31 Dec ${Number(this.props.periode) + 2} Total`,
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 }}>
......
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