Commit eecb33c7 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into rifka

parents 2080b668 e9594894
......@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component {
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_more_year,
item.order
item.order,
item.fixed_asset_movement.forecast_formula
])
}
if (item.children !== null) {
......@@ -153,7 +154,8 @@ export default class FixedAssetsMovement extends Component {
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_more_year,
item.order
item.order,
item.fixed_asset_movement.forecast_formula
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -328,12 +330,13 @@ export default class FixedAssetsMovement extends Component {
item.total_next_year,
item.total_more_year,
item.orders,
item.forecast_formula,
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => {
if (item[23].length > 0) {
if (item[24].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
......@@ -503,7 +506,7 @@ export default class FixedAssetsMovement extends Component {
// console.log(valuezz)
}
} else {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`))
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
// console.log(indexID)
if (indexID !== -1) {
// console.log(value.formula[indexID].value)
......@@ -591,12 +594,23 @@ export default class FixedAssetsMovement extends Component {
}
}
}
const handleForecast = (tableMeta) => {
const handleForecast = (tableMeta, periode) => {
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') {
// total = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex - 1]
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
// }
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return total
}
const handleTotal = (tableMeta) => {
......@@ -777,8 +791,8 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{tableMeta.rowData[23] ?
tableMeta.rowData[23].length > 0 ?
{tableMeta.rowData[24] ?
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>
......@@ -1986,7 +2000,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
/>
</span>
:
......@@ -2000,7 +2014,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleForecast(tableMeta)).toFixed(1)}
value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......@@ -2064,7 +2078,7 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValue(tableMeta)).toFixed(1)}
value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`)).toFixed(1)}
/>
</span>
:
......@@ -2078,18 +2092,8 @@ export default class FixedAssetsMovement extends Component {
type="text"
placeholder=""
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 ?
// value === "" ?
......
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