Commit 64511418 authored by d.arizona's avatar d.arizona

apdet foreacst

parent 642294f6
...@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component {
item.fixed_asset_movement.total_current_year, item.fixed_asset_movement.total_current_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year,
item.order item.order,
item.fixed_asset_movement.forecast_formula
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -153,7 +154,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -153,7 +154,8 @@ export default class FixedAssetsMovement extends Component {
item.fixed_asset_movement.total_current_year, item.fixed_asset_movement.total_current_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_next_year,
item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year, item.type_report_id == 5 || item.type_report_id == 6 ? 0 : item.fixed_asset_movement.total_more_year,
item.order item.order,
item.fixed_asset_movement.forecast_formula
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -328,12 +330,13 @@ export default class FixedAssetsMovement extends Component { ...@@ -328,12 +330,13 @@ export default class FixedAssetsMovement extends Component {
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.orders, item.orders,
item.forecast_formula,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[23].length > 0) { if (item[24].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
...@@ -591,8 +594,18 @@ export default class FixedAssetsMovement extends Component { ...@@ -591,8 +594,18 @@ export default class FixedAssetsMovement extends Component {
} }
} }
} }
const handleForecast = (tableMeta) => { const handleForecast = (tableMeta, periode) => {
let total = 0 let total = 0
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
// console.log(dataTable2[tableMeta.rowIndex][23])
// console.log()
let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
if (indexID !== -1) {
total = dataTable2[tableMeta.rowIndex][23][indexID].value
}
} else {
}
// if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') { // if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
// total = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex - 1] // total = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex - 1]
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
...@@ -777,8 +790,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -777,8 +790,8 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[23] ? {tableMeta.rowData[24] ?
tableMeta.rowData[23].length > 0 ? tableMeta.rowData[24].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow> <LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
...@@ -1986,7 +1999,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1986,7 +1999,7 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -2000,7 +2013,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -2000,7 +2013,7 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleForecast(tableMeta)).toFixed(1)} value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
/> />
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
...@@ -2064,7 +2077,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -2064,7 +2077,7 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)} value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`)).toFixed(1)}
/> />
</span> </span>
: :
...@@ -2078,17 +2091,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -2078,17 +2091,7 @@ export default class FixedAssetsMovement extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value).toFixed(1)} value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
/>
:
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={Number(value).toFixed(1)}
/> />
: :
tableMeta.rowData[0] === 1 ? tableMeta.rowData[0] === 1 ?
......
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