Commit edb6c71b authored by rifkaki's avatar rifkaki

formula cf

parent 5bb015ed
......@@ -1124,13 +1124,49 @@ export default class SubHolding extends Component {
const handlePushChild = (item) => {
let indexIDzz = dbSumaCF.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
let mtd_actual = item.cash_flow.mtd_actual == '' ? 0 : item.cash_flow.mtd_actual
let mtd = item.cash_flow.mtd == '' ? 0 : item.cash_flow.mtd
let persenMtd = Number(mtd_actual / mtd)
let mtd_actual = item.cash_flow.mtd_actual == '' ? 0 : Number(item.cash_flow.mtd_actual)
let mtd = item.cash_flow.mtd == '' ? 0 : Number(item.cash_flow.mtd)
// let persenMtd = Number(mtd_actual / mtd)
let persenMtd = 0
if (mtd < 0) {
if (mtd_actual >= mtd) {
persenMtd = ((mtd - mtd_actual) / mtd + 1 )
} else {
persenMtd = ((mtd - mtd_actual) / mtd)
}
}
else {
persenMtd = Number(mtd_actual / mtd)
}
let ytd_actual = item.cash_flow.ytd_actual == '' ? 0 : item.cash_flow.ytd_actual
let ytd = item.cash_flow.ytd == '' ? 0 : item.cash_flow.ytd
let persenYtd = Number(ytd_actual / ytd)
let ytd_actual = item.cash_flow.ytd_actual == '' ? 0 : Number(item.cash_flow.ytd_actual)
let ytd = item.cash_flow.ytd == '' ? 0 : Number(item.cash_flow.ytd)
// let ytd_last_year = item.cash_flow.ytd_last_year == ''? 0 : Number(item.cash_flow.ytd_last_year)
// let persenYtd = Number(ytd_actual / ytd)
let persenYtd = 0
if (ytd < 0) {
if (ytd_actual >= ytd) {
persenYtd = ((ytd - ytd_actual) / ytd + 1 )
} else {
persenYtd = ((ytd - ytd_actual) / ytd)
}
}
else {
persenYtd = Number(ytd_actual/ytd)
}
// let persenYtdLY = 0
// if (ytd_last_year < 0) {
// if (ytd_actual >= ytd_last_year) {
// persenYtdLY = ((ytd_last_year - ytd_actual) / ytd_last_year + 1 )
// } else {
// persenYtdLY = (ytd_last_year - ytd_actual) / ytd_last_year
// }
// }
// else {
// persenYtdLY = Number(ytd_actual/ytd_last_year)
// }
let quarter_actual = item.cash_flow.quarter_actual == '' ? 0 : item.cash_flow.quarter_actual
let quarter = item.cash_flow.quarter == '' ? 0 : item.cash_flow.quarter
......@@ -1174,11 +1210,33 @@ export default class SubHolding extends Component {
res.map((item, index) => {
let mtd_actual = item.cash_flow.mtd_actual == '' ? 0 : item.cash_flow.mtd_actual
let mtd = item.cash_flow.mtd == '' ? 0 : item.cash_flow.mtd
let persenMtd = Number(mtd_actual / mtd)
console.log(persenMtd)
let ytd_actual = item.cash_flow.ytd_actual == '' ? 0 : item.cash_flow.ytd_actual
let ytd = item.cash_flow.ytd == '' ? 0 : item.cash_flow.ytd
let persenYtd = Number(ytd_actual / ytd)
// let persenMtd = Number(mtd_actual / mtd)
let persenMtd = 0
if (mtd < 0) {
if (mtd_actual >= mtd) {
persenMtd = ((mtd - mtd_actual) / mtd + 1 )
} else {
persenMtd = ((mtd - mtd_actual) / mtd)
}
}
else {
persenMtd = Number(mtd_actual / mtd)
}
let ytd_actual = item.cash_flow.ytd_actual == '' ? 0 : Number(item.cash_flow.ytd_actual)
let ytd = item.cash_flow.ytd == '' ? 0 : Number(item.cash_flow.ytd)
// let persenYtd = Number(ytd_actual / ytd)
let persenYtd = 0
if (ytd < 0) {
if (ytd_actual >= ytd) {
persenYtd = ((ytd - ytd_actual) / ytd + 1 )
} else {
persenYtd = ((ytd - ytd_actual) / ytd)
}
}
else {
persenYtd = Number(ytd_actual/ytd)
}
let quarter_actual = item.cash_flow.quarter_actual == '' ? 0 : item.cash_flow.quarter_actual
let quarter = item.cash_flow.quarter == '' ? 0 : item.cash_flow.quarter
......
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