Commit 94085321 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

Fixing Formula

See merge request !1725
parents 5af487c5 f377fd28
......@@ -739,7 +739,7 @@ export default class CashFlow extends Component {
return total
}
const handleFYTotal = (val, tableMeta) => {
const handleFYTotal = (tableMeta) => {
let total = 0
// dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index == 18) {
......@@ -762,8 +762,17 @@ export default class CashFlow extends Component {
let totalBeginning = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][7].value
return totalBeginning
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") {
let totalEnd = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][18].value
return totalEnd
console.log(tableMeta.rowIndex);
let value = Number(dataTable2[tableMeta.rowIndex - 1][19]) + Number(dataTable2[tableMeta.rowIndex - 2][19])
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "control (should be nil)") {
let cashOfTheEndFy = Number(dataTable2[tableMeta.rowIndex - 3][19]) + Number(dataTable2[tableMeta.rowIndex - 4][19])
let cahsOfTheEndDec = Number(dataTable2[tableMeta.rowIndex - 2][19])
// console.log(cashOfTheEndFy);
// console.log(cahsOfTheEndDec);
let value = Number(cashOfTheEndFy) - Number(cahsOfTheEndDec);
console.log(dataTable2[tableMeta.rowIndex - 2][19]);
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else {
dataTable2[tableMeta.rowIndex][19] = total
return total
......@@ -3043,9 +3052,9 @@ export default class CashFlow extends Component {
type="text"
placeholder=""
disabled={true}
// value={Number(handleFYTotal(value, tableMeta)).toFixed(1)}
value={Number(handleFYTotal(tableMeta)).toFixed(1)}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`, 20)).toFixed(1)}
value={value}
// value={value}
/>
}
/>
......
......@@ -722,8 +722,16 @@ export default class CashFlow extends Component {
let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value
return totalBeginning
}else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") {
let totalEnd = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][17].value
return totalEnd
let value = Number(dataTable2[tableMeta.rowIndex - 1][18]) + Number(dataTable2[tableMeta.rowIndex - 2][18])
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "control (should be nil)") {
// console.log(dataTable2[tableMeta.rowIndex - 2][tableMeta.columnIndex + 11].value);
let cashOfTheEndFy = Number(dataTable2[tableMeta.rowIndex - 3][18]) + Number(dataTable2[tableMeta.rowIndex - 4][18])
let cahsOfTheEndDec = Number(dataTable2[tableMeta.rowIndex - 2][tableMeta.columnIndex + 11].value)
// console.log(cashOfTheEndFy);
console.log(cahsOfTheEndDec);
let value = Number(cashOfTheEndFy) - Number(cahsOfTheEndDec);
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else {
dataTable2[tableMeta.rowIndex][18] = total
return total
......
......@@ -123,7 +123,7 @@ export default class OutlookPA extends Component {
{ name: 'Approved', value: 'approved' },
]
api.create().checkApproverOLPA().then(response => {
// console.log(response);
if (response.data.status === 'success') {
if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true, listStatus: listStatus1, selectedStatus: listStatus1 }, () =>
this.getPeriode())
......@@ -131,6 +131,16 @@ export default class OutlookPA extends Component {
this.setState({ isApprover: false, checkApprover: false, listStatus: listStatus2, selectedStatus: listStatus2 }, () =>
this.getPeriode())
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
})
}
......
......@@ -712,17 +712,8 @@ export default class CashFlow extends Component {
loading = false
return total
}
const handleTotal = (val, tableMeta) => {
const handleTotal = (val, tableMeta, column) => {
let total = 0
// dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index == 18) {
// if (index >= 6 && index <= 17) {
// let valItem = item.value == undefined || item.value == "" ? 0 : item.value
// total += Number(valItem)
// }
// }
// })
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 6 && index <= 17) {
......@@ -735,13 +726,33 @@ export default class CashFlow extends Component {
let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value
return totalBeginning
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") {
let totalEnd = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][17].value
return totalEnd
let value = Number(dataTable2[tableMeta.rowIndex - 1][18]) + Number(dataTable2[tableMeta.rowIndex - 2][18])
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "control (should be nil)") {
// console.log(dataTable2[tableMeta.rowIndex - 2][tableMeta.columnIndex + 11].value);
let cashOfTheEndFy = Number(dataTable2[tableMeta.rowIndex - 3][18]) + Number(dataTable2[tableMeta.rowIndex - 4][18])
let cahsOfTheEndDec = Number(dataTable2[tableMeta.rowIndex - 2][tableMeta.columnIndex + 11].value)
// console.log(cashOfTheEndFy);
// console.log(cahsOfTheEndDec);
let value = Number(cashOfTheEndFy) - Number(cahsOfTheEndDec);
console.log(value);
return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
} else {
dataTable2[tableMeta.rowIndex][18] = total
return total
}
// if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the beginning period") {
// let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value
// return totalBeginning
// } else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") {
// let totalEnd = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][17].value
// return totalEnd
// } else {
// dataTable2[tableMeta.rowIndex][18] = total
// return total
// }
// console.log(total);
}
let columns = [
......@@ -1768,7 +1779,7 @@ export default class CashFlow extends Component {
placeholder=""
disabled={true}
// value={Number(tableMeta.rowData[18]).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18]).toFixed(1) : Number(handleTotal(val, tableMeta)).toFixed(1)}
value={this.props.PLBSFAMSubmitted ? Number(tableMeta.rowData[18]).toFixed(1) : Number(handleTotal(tableMeta.rowData[18], tableMeta, 18)).toFixed(1)}
/>
</span>
......
......@@ -1533,13 +1533,15 @@ export default class RollingOutlook extends Component {
let urlReport = items === 14 ? "profit_loss" : items === 15 ? "tax_planning" : items === 16 ? "balance_sheet" : items === 17 ? "cash_flow" : items === 37 ? "cat" : null
let datas = data.findIndex((val) => val[4] == items)
let report = data[datas]
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&quartal=${quarter.value}&download_file_report_id=${downloadedFileReportId}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&&report_id=${report[4]}&&company_id=${company.company_id}&&year=${periode.periode}&&revision=${report[2]}&&quartal=${quarter.value}&&download_file_report_id=${downloadedFileReportId}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/${urlReport}/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${rollingOutlookID === null ? "" : rollingOutlookID}&report_id=${report[4]}&company_id=${company.company_id}&year=${periode.periode}&revision=${report[2]}&quartal=${quarter.value}&download_file_report_id=${downloadedFileReportId}`
)
if (res.status === 200) {
result = [...result, res];
console.log(result);
}
}
......
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