Commit f9432be4 authored by Deni Rinaldi's avatar Deni Rinaldi

PLPLPLPLPLLPL

parent 4aa84a78
......@@ -104,7 +104,7 @@ export default class ProfitLoss extends Component {
"submission_id": this.props.submissionID
}
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
console.log(response);
let dataTable = []
this.setState({ visibleProfitLoss: true })
if (response.data) {
......@@ -123,24 +123,28 @@ export default class ProfitLoss extends Component {
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,
this.props.status === 'CLOSED' ? Number(item.profit_loss.january).toFixed(1) : Number(item.profit_loss.january).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.february).toFixed(1) : Number(item.profit_loss.february).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.march).toFixed(1) : Number(item.profit_loss.march).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.april).toFixed(1) : Number(item.profit_loss.april).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.may).toFixed(1) : Number(item.profit_loss.may).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.june).toFixed(1) : Number(item.profit_loss.june).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.july).toFixed(1) : Number(item.profit_loss.july).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.august).toFixed(1) : Number(item.profit_loss.august).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.september).toFixed(1) : Number(item.profit_loss.september).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.october).toFixed(1) : Number(item.profit_loss.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.november).toFixed(1) : Number(item.profit_loss.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.december).toFixed(1) : Number(item.profit_loss.december).toFixed(1),
Number(item.profit_loss.january).toFixed(1),
Number(item.profit_loss.february).toFixed(1),
Number(item.profit_loss.march).toFixed(1),
Number(item.profit_loss.april).toFixed(1),
Number(item.profit_loss.may).toFixed(1),
Number(item.profit_loss.june).toFixed(1),
Number(item.profit_loss.july).toFixed(1),
Number(item.profit_loss.august).toFixed(1),
Number(item.profit_loss.september).toFixed(1),
Number(item.profit_loss.october).toFixed(1),
Number(item.profit_loss.november).toFixed(1),
Number(item.profit_loss.december).toFixed(1),
item.profit_loss.total_current_year,
item.profit_loss.total_next_year,
item.profit_loss.total_more_year,
item.order
])
}
if (item.id === 20092) {
console.log(item);
console.log(dataTable);
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
......@@ -159,18 +163,18 @@ export default class ProfitLoss extends Component {
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,
this.props.status === 'CLOSED' ? Number(item.profit_loss.january).toFixed(1) : Number(item.profit_loss.january).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.february).toFixed(1) : Number(item.profit_loss.february).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.march).toFixed(1) : Number(item.profit_loss.march).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.april).toFixed(1) : Number(item.profit_loss.april).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.may).toFixed(1) : Number(item.profit_loss.may).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.june).toFixed(1) : Number(item.profit_loss.june).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.july).toFixed(1) : Number(item.profit_loss.july).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.august).toFixed(1) : Number(item.profit_loss.august).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.september).toFixed(1) : Number(item.profit_loss.september).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.october).toFixed(1) : Number(item.profit_loss.october).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.november).toFixed(1) : Number(item.profit_loss.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.profit_loss.december).toFixed(1) : Number(item.profit_loss.december).toFixed(1),
Number(item.profit_loss.january).toFixed(1),
Number(item.profit_loss.february).toFixed(1),
Number(item.profit_loss.march).toFixed(1),
Number(item.profit_loss.april).toFixed(1),
Number(item.profit_loss.may).toFixed(1),
Number(item.profit_loss.june).toFixed(1),
Number(item.profit_loss.july).toFixed(1),
Number(item.profit_loss.august).toFixed(1),
Number(item.profit_loss.september).toFixed(1),
Number(item.profit_loss.october).toFixed(1),
Number(item.profit_loss.november).toFixed(1),
Number(item.profit_loss.december).toFixed(1),
item.profit_loss.total_current_year,
item.profit_loss.total_next_year,
item.profit_loss.total_more_year,
......@@ -184,7 +188,7 @@ export default class ProfitLoss extends Component {
}
}
})
// console.log(dataTable)
console.log(dataTable)
this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => {
})
} else {
......@@ -418,7 +422,8 @@ export default class ProfitLoss extends Component {
profit_loss: data,
status: type
}
// console.log(data);
console.log(this.state.dataTable);
console.log(JSON.stringify(body));
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response);
if (response.data) {
......@@ -526,6 +531,10 @@ export default class ProfitLoss extends Component {
total += Number(valItem)
}
})
// if (tableMeta.rowData[1] === 20092) {
// console.log(total);
// console.log(dataTable2[tableMeta.rowIndex]);
// }
let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
......@@ -580,10 +589,14 @@ export default class ProfitLoss extends Component {
}
} else {
if (index != -1) {
if (item === String(tableMeta.rowData[23])) {
arrayJumlah.push(0)
} else {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
}
}
}
}
// if (indexs % 2 !== 0) {
// operator.push(item)
......@@ -621,8 +634,15 @@ export default class ProfitLoss extends Component {
}
}
})
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a
if (tableMeta.rowData[1] === 20092) {
console.log(total);
console.log(arrayJumlah);
}
// if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
// }
return Number(total)
}
......
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