Commit b0b3493a authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

update FAM

See merge request !609
parents 8fb51ecf b046a8b8
...@@ -87,7 +87,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -87,7 +87,7 @@ export default class FixedAssetsMovement extends Component {
"submission_id": this.props.submissionID "submission_id": this.props.submissionID
} }
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
// // console.log(response); // console.log(response);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
...@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component {
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 item.fixed_asset_movement.forecast_formula,
item.fixed_asset_movement.before_formula
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -154,7 +155,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -154,7 +155,8 @@ export default class FixedAssetsMovement extends Component {
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 item.fixed_asset_movement.forecast_formula,
item.fixed_asset_movement.before_formula
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -330,6 +332,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -330,6 +332,7 @@ export default class FixedAssetsMovement extends Component {
item.total_more_year, item.total_more_year,
item.orders, item.orders,
item.forecast_formula, item.forecast_formula,
item.before_formula,
item.error item.error
] ]
}) })
...@@ -463,7 +466,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -463,7 +466,7 @@ export default class FixedAssetsMovement extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
const handleValueFormula = (value, tableMeta) => { const handleValueFormula = (value, tableMeta, Bfr) => {
let splitFormula = String(tableMeta.rowData[3]).split('@') let splitFormula = String(tableMeta.rowData[3]).split('@')
let baru = [] let baru = []
let anjay = [] let anjay = []
...@@ -495,7 +498,17 @@ export default class FixedAssetsMovement extends Component { ...@@ -495,7 +498,17 @@ export default class FixedAssetsMovement extends Component {
anjay.push(item) anjay.push(item)
} else { } else {
if (String(item).includes('#')) { if (String(item).includes('#')) {
if (String(item).includes('[M-1]')) { if (Bfr !== undefined) {
let data = 24
let period = Number(this.props.periode) - 1
console.log(dataTable2[tableMeta.rowIndex][data])
anjay.push(0)
let indexID = dataTable2[tableMeta.rowIndex][data].findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == period)
if (indexID !== -1) {
let valuezz = dataTable2[tableMeta.rowIndex][data][indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '') let tst = String(item).replace('[M-1]', '')
let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1 let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
...@@ -607,20 +620,13 @@ export default class FixedAssetsMovement extends Component { ...@@ -607,20 +620,13 @@ export default class FixedAssetsMovement extends Component {
const handleForecast = (tableMeta, periode) => { const handleForecast = (tableMeta, periode) => {
let total = 0 let total = 0
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || 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) let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
if (indexID !== -1) { if (indexID !== -1) {
total = dataTable2[tableMeta.rowIndex][23][indexID].value total = dataTable2[tableMeta.rowIndex][23][indexID].value
} }
} else { } else {
total = handleValueFormula(tableMeta.columnIndex, tableMeta) total = handleValueFormula(tableMeta.columnIndex, tableMeta)
// // console.log(dataTable2[tableMeta.rowIndex])
} }
// 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 dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return total return total
} }
...@@ -659,6 +665,13 @@ export default class FixedAssetsMovement extends Component { ...@@ -659,6 +665,13 @@ export default class FixedAssetsMovement extends Component {
// // console.log(indexParent); // // console.log(indexParent);
return a return a
} }
const handleBfr = (value,tableMeta) => {
let total = 0
total = handleValueFormula(value, tableMeta, 'before')
return total
}
const handleFormula = (data, tableMeta, month) => { const handleFormula = (data, tableMeta, month) => {
let rilFormula = String(tableMeta.rowData[3]) let rilFormula = String(tableMeta.rowData[3])
if (rilFormula.includes("#")) { if (rilFormula.includes("#")) {
...@@ -765,6 +778,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -765,6 +778,7 @@ export default class FixedAssetsMovement extends Component {
return a return a
} }
} }
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -802,8 +816,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -802,8 +816,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[24] ? {tableMeta.rowData[25] ?
tableMeta.rowData[24].length > 0 ? tableMeta.rowData[25].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>
...@@ -843,6 +857,24 @@ export default class FixedAssetsMovement extends Component { ...@@ -843,6 +857,24 @@ export default class FixedAssetsMovement extends Component {
{tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1? {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1?
null null
: :
tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleBfr(value,tableMeta)).toFixed(1)}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
......
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