Commit b5624aae authored by Riri Novita's avatar Riri Novita

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

Fixing Formula

See merge request !1726
parents fddef47c 94085321
...@@ -739,7 +739,7 @@ export default class CashFlow extends Component { ...@@ -739,7 +739,7 @@ export default class CashFlow extends Component {
return total return total
} }
const handleFYTotal = (val, tableMeta) => { const handleFYTotal = (tableMeta) => {
let total = 0 let total = 0
// dataTable2[tableMeta.rowIndex].map((item, index) => { // dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index == 18) { // if (index == 18) {
...@@ -762,8 +762,17 @@ export default class CashFlow extends Component { ...@@ -762,8 +762,17 @@ export default class CashFlow extends Component {
let totalBeginning = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][7].value let totalBeginning = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][7].value
return totalBeginning return totalBeginning
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") { } 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 console.log(tableMeta.rowIndex);
return totalEnd 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 { } else {
dataTable2[tableMeta.rowIndex][19] = total dataTable2[tableMeta.rowIndex][19] = total
return total return total
...@@ -3043,9 +3052,9 @@ export default class CashFlow extends Component { ...@@ -3043,9 +3052,9 @@ export default class CashFlow extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={true} 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={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 { ...@@ -722,8 +722,16 @@ export default class CashFlow extends Component {
let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value
return totalBeginning return totalBeginning
}else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") { }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 let value = Number(dataTable2[tableMeta.rowIndex - 1][18]) + Number(dataTable2[tableMeta.rowIndex - 2][18])
return totalEnd 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 { } else {
dataTable2[tableMeta.rowIndex][18] = total dataTable2[tableMeta.rowIndex][18] = total
return total return total
......
...@@ -123,13 +123,23 @@ export default class OutlookPA extends Component { ...@@ -123,13 +123,23 @@ export default class OutlookPA extends Component {
{ name: 'Approved', value: 'approved' }, { name: 'Approved', value: 'approved' },
] ]
api.create().checkApproverOLPA().then(response => { api.create().checkApproverOLPA().then(response => {
// console.log(response); if (response.data.status === 'success') {
if (response.data.data.is_approver === true) { if (response.data.data.is_approver === true) {
this.setState({ isApprover: true, checkApprover: true, listStatus: listStatus1, selectedStatus: listStatus1 }, () => this.setState({ isApprover: true, checkApprover: true, listStatus: listStatus1, selectedStatus: listStatus1 }, () =>
this.getPeriode()) this.getPeriode())
} else {
this.setState({ isApprover: false, checkApprover: false, listStatus: listStatus2, selectedStatus: listStatus2 }, () =>
this.getPeriode())
}
} else { } else {
this.setState({ isApprover: false, checkApprover: false, listStatus: listStatus2, selectedStatus: listStatus2 }, () => this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
this.getPeriode()) 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 { ...@@ -712,17 +712,8 @@ export default class CashFlow extends Component {
loading = false loading = false
return total return total
} }
const handleTotal = (val, tableMeta) => { const handleTotal = (val, tableMeta, column) => {
let total = 0 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) => { dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 6 && index <= 17) { if (index >= 6 && index <= 17) {
...@@ -735,13 +726,33 @@ export default class CashFlow extends Component { ...@@ -735,13 +726,33 @@ export default class CashFlow extends Component {
let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value let totalBeginning = dataTable2[tableMeta.rowIndex][18] = dataTable2[tableMeta.rowIndex][6].value
return totalBeginning return totalBeginning
} else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "cash at the end of the period") { } 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 let value = Number(dataTable2[tableMeta.rowIndex - 1][18]) + Number(dataTable2[tableMeta.rowIndex - 2][18])
return totalEnd 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 { } else {
dataTable2[tableMeta.rowIndex][18] = total dataTable2[tableMeta.rowIndex][18] = total
return 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); // console.log(total);
} }
let columns = [ let columns = [
...@@ -1768,7 +1779,7 @@ export default class CashFlow extends Component { ...@@ -1768,7 +1779,7 @@ export default class CashFlow extends Component {
placeholder="" placeholder=""
disabled={true} disabled={true}
// value={Number(tableMeta.rowData[18]).toFixed(1)} // 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> </span>
...@@ -2226,4 +2237,4 @@ export default class CashFlow extends Component { ...@@ -2226,4 +2237,4 @@ export default class CashFlow extends Component {
</div> </div>
) )
} }
} }
\ No newline at end of file
...@@ -1533,13 +1533,15 @@ export default class RollingOutlook extends Component { ...@@ -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 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 datas = data.findIndex((val) => val[4] == items)
let report = data[datas] 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( 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) { if (res.status === 200) {
result = [...result, res]; 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