Commit 59c7d0dd authored by Rifka Kurnia's avatar Rifka Kurnia

Merge branch 'rifka' into 'master'

ytd rumus

See merge request !1093
parents e5196900 bf34a703
...@@ -541,6 +541,210 @@ export default class SummaryOfTriputra extends Component { ...@@ -541,6 +541,210 @@ export default class SummaryOfTriputra extends Component {
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id) let indexIDzz = dataTable.findIndex((val) => val[0] === item.company_id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
// revenue ytd
let revenueYtdAct = item.revenue_ytd_act == '' ? 0 : Number(item.revenue_ytd_act)
let revenueYtdMB = item.revenue_ytd_mb == '' ? 0 : Number(item.revenue_ytd_mb)
let revenueYtdPersenMB = 0
if (revenueYtdMB < 0) {
if (revenueYtdAct >= revenueYtdMB) {
revenueYtdPersenMB = ( revenueYtdMB - revenueYtdAct ) / revenueYtdMB + 1
} else {
revenueYtdPersenMB = ( revenueYtdMB - revenueYtdAct ) / revenueYtdMB
}
} else {
revenueYtdPersenMB = revenueYtdAct / revenueYtdMB
}
// revenue ytd last year
let revenueYtdLY = item.revenue_ytd_last_year == '' ? 0 : Number(item.revenue_ytd_last_year)
let revenueYtdPersenLY = 0
if (revenueYtdLY < 0) {
if (revenueYtdAct >= revenueYtdLY) {
revenueYtdPersenLY = ( revenueYtdLY - revenueYtdAct ) / revenueYtdLY + 1
} else {
revenueYtdPersenLY = ( revenueYtdLY - revenueYtdAct ) / revenueYtdLY
}
} else {
revenueYtdPersenLY = revenueYtdAct / revenueYtdLY
}
// revenue fy
let revenueFyOl = item.revenue_fy_ol == '' ? 0 : Number(item.revenue_fy_ol)
let revenueFyMB = item.revenue_fy_mb == '' ? 0 : Number(item.revenue_fy_mb)
let revenueFyPersenMB = 0
if (revenueFyMB < 0) {
if (revenueFyOl >= revenueFyMB) {
revenueFyPersenMB = ( revenueFyMB - revenueFyOl ) / revenueFyMB + 1
} else {
revenueFyPersenMB = ( revenueFyMB - revenueFyOl ) / revenueFyMB
}
} else {
revenueFyPersenMB = revenueFyOl / revenueFyMB
}
// revenue fy last year
let revenueFyLY = item.revenue_fy_last_year == '' ? 0 : Number(item.revenue_fy_last_year)
let revenueFyPersenLY = 0
if (revenueFyLY < 0) {
if (revenueFyOl >= revenueFyLY) {
revenueFyPersenLY = ( revenueFyLY - revenueFyOl ) / revenueFyLY + 1
} else {
revenueFyPersenLY = ( revenueFyLY - revenueFyOl ) / revenueFyLY
}
} else {
revenueFyPersenLY = revenueFyOl / revenueFyLY
}
// ebitda ytd
let ebitdaYtdAct = item.ebitda_ytd_act == '' ? 0 : Number(item.ebitda_ytd_act)
let ebitdaYtdMB = item.ebitda_ytd_mb == '' ? 0 : Number(item.ebitda_ytd_mb)
let ebitdaYtdPersenMB = 0
if (ebitdaYtdMB < 0) {
if (ebitdaYtdAct >= ebitdaYtdMB) {
ebitdaYtdPersenMB = ( ebitdaYtdMB - ebitdaYtdAct ) / ebitdaYtdMB + 1
} else {
ebitdaYtdPersenMB = ( ebitdaYtdMB - ebitdaYtdAct ) / ebitdaYtdMB
}
} else {
ebitdaYtdPersenMB = ebitdaYtdAct / ebitdaYtdMB
}
// ebitda ytd last year
let ebitdaYtdLY = item.ebitda_ytd_last_year == '' ? 0 : Number(item.ebitda_ytd_last_year)
let ebitdaYtdPersenLY = 0
if (ebitdaYtdLY < 0) {
if (ebitdaYtdAct >= ebitdaYtdLY) {
ebitdaYtdPersenLY = ( ebitdaYtdLY - ebitdaYtdAct ) / ebitdaYtdLY + 1
} else {
ebitdaYtdPersenLY = ( ebitdaYtdLY - ebitdaYtdAct ) / ebitdaYtdLY
}
} else {
ebitdaYtdPersenLY = ebitdaYtdAct / ebitdaYtdLY
}
// ebitda fy
let ebitdaFyOl = item.ebitda_fy_ol == '' ? 0 : Number(item.ebitda_fy_ol)
let ebitdaFyMB = item.ebitda_fy_mb == '' ? 0 : Number(item.ebitda_fy_mb)
let ebitdaFyPersenMB = 0
if (ebitdaFyMB < 0) {
if (ebitdaFyOl >= ebitdaFyMB) {
ebitdaFyPersenMB = ( ebitdaFyMB - ebitdaFyOl ) / ebitdaFyMB + 1
} else {
ebitdaFyPersenMB = ( ebitdaFyMB - ebitdaFyOl ) / ebitdaFyMB
}
} else {
ebitdaFyPersenMB = ebitdaFyOl / ebitdaFyMB
}
// ebitda fy last year
let ebitdaFyLY = item.ebitda_fy_last_year == '' ? 0 : Number(item.ebitda_fy_last_year)
let ebitdaFyPersenLY = 0
if (ebitdaFyLY < 0) {
if (ebitdaFyOl >= ebitdaFyLY) {
ebitdaFyPersenLY = ( ebitdaFyLY - ebitdaFyOl ) / ebitdaFyLY + 1
} else {
ebitdaFyPersenLY = ( ebitdaFyLY - ebitdaFyOl ) / ebitdaFyLY
}
} else {
ebitdaFyPersenLY = ebitdaFyOl / ebitdaFyLY
}
// tpat ytd
let tpatYtdAct = item.tpat_ytd_act == '' ? 0 : Number(item.tpat_ytd_act)
let tpatYtdMB = item.tpat_ytd_mb == '' ? 0 : Number(item.tpat_ytd_mb)
let tpatYtdPersenMB = 0
if (tpatYtdMB < 0) {
if (tpatYtdAct >= tpatYtdMB) {
tpatYtdPersenMB = ( tpatYtdMB - tpatYtdAct ) / tpatYtdMB + 1
} else {
tpatYtdPersenMB = ( tpatYtdMB - tpatYtdAct ) / tpatYtdMB
}
} else {
tpatYtdPersenMB = tpatYtdAct / tpatYtdMB
}
// tpat ytd last year
let tpatYtdLY = item.tpat_ytd_last_year == '' ? 0 : Number(item.tpat_ytd_last_year)
let tpatYtdPersenLY = 0
if (tpatYtdLY < 0) {
if (tpatYtdAct >= tpatYtdLY) {
tpatYtdPersenLY = ( tpatYtdLY - tpatYtdAct ) / tpatYtdLY + 1
} else {
tpatYtdPersenLY = ( tpatYtdLY - tpatYtdAct ) / tpatYtdLY
}
} else {
tpatYtdPersenLY = tpatYtdAct / tpatYtdLY
}
// tpat fy
let tpatFyOl = item.tpat_fy_ol == '' ? 0 : Number(item.tpat_fy_ol)
let tpatFyMB = item.tpat_fy_mb == '' ? 0 : Number(item.tpat_fy_mb)
let tpatFyPersenMB = 0
if (tpatFyMB < 0) {
if (tpatFyOl >= tpatFyMB) {
tpatFyPersenMB = ( tpatFyMB - tpatFyOl ) / tpatFyMB + 1
} else {
tpatFyPersenMB = ( tpatFyMB - tpatFyOl ) / tpatFyMB
}
} else {
tpatFyPersenMB = tpatFyOl / tpatFyMB
}
// tpat fy last year
let tpatFyLY = item.tpat_fy_last_year == '' ? 0 : Number(item.tpat_fy_last_year)
let tpatFyPersenLY = 0
if (tpatFyLY < 0) {
if (tpatFyOl >= tpatFyLY) {
tpatFyPersenLY = ( tpatFyLY - tpatFyOl ) / tpatFyLY + 1
} else {
tpatFyPersenLY = ( tpatFyLY - tpatFyOl ) / tpatFyLY
}
} else {
tpatFyPersenLY = tpatFyOl / tpatFyLY
}
// npat ytd
let npatYtdAct = item.npat_ytd_act == '' ? 0 : Number(item.npat_ytd_act)
let npatYtdMB = item.npat_ytd_mb == '' ? 0 : Number(item.npat_ytd_mb)
let npatYtdPersenMB = 0
if (npatYtdMB < 0) {
if (npatYtdAct >= npatYtdMB) {
npatYtdPersenMB = ( npatYtdMB - npatYtdAct ) / npatYtdMB + 1
} else {
npatYtdPersenMB = ( npatYtdMB - npatYtdAct ) / npatYtdMB
}
} else {
npatYtdPersenMB = npatYtdAct / npatYtdMB
}
// npat ytd last year
let npatYtdLY = item.npat_ytd_last_year == '' ? 0 : Number(item.npat_ytd_last_year)
let npatYtdPersenLY = 0
if (npatYtdLY < 0) {
if (npatYtdAct >= npatYtdLY) {
npatYtdPersenLY = ( npatYtdLY - npatYtdAct ) / npatYtdLY + 1
} else {
npatYtdPersenLY = ( npatYtdLY - npatYtdAct ) / npatYtdLY
}
} else {
npatYtdPersenLY = npatYtdAct / npatYtdLY
}
// npat fy
let npatFyOl = item.npat_fy_ol == '' ? 0 : Number(item.npat_fy_ol)
let npatFyMB = item.npat_fy_mb == '' ? 0 : Number(item.npat_fy_mb)
let npatFyPersenMB = 0
if (npatFyMB < 0) {
if (npatFyOl >= npatFyMB) {
npatFyPersenMB = ( npatFyMB - npatFyOl ) / npatFyMB + 1
} else {
npatFyPersenMB = ( npatFyMB - npatFyOl ) / npatFyMB
}
} else {
npatFyPersenMB = npatFyOl / npatFyMB
}
// npat fy last year
let npatFyLY = item.npat_fy_last_year == '' ? 0 : Number(item.npat_fy_last_year)
let npatFyPersenLY = 0
if (npatFyLY < 0) {
if (npatFyOl >= npatFyLY) {
npatFyPersenLY = ( npatFyLY - npatFyOl ) / npatFyLY + 1
} else {
npatFyPersenLY = ( npatFyLY - npatFyOl ) / npatFyLY
}
} else {
npatFyPersenLY = npatFyOl / npatFyLY
}
dataTable.push([ dataTable.push([
item.company_id, item.company_id,
item.parent, item.parent,
...@@ -548,44 +752,60 @@ export default class SummaryOfTriputra extends Component { ...@@ -548,44 +752,60 @@ export default class SummaryOfTriputra extends Component {
item.company_name, item.company_name,
item.revenue_ytd_act, item.revenue_ytd_act,
item.revenue_ytd_mb, item.revenue_ytd_mb,
item.revenue_ytd_percent_of_mb, // item.revenue_ytd_percent_of_mb,
isNaN(revenueYtdPersenMB) || revenueYtdPersenMB == 'Infinity' || revenueYtdPersenMB == '-Infinity' ? ( item.revenue_ytd_mb == '' || item.revenue_ytd_mb == 0 ? -0 : 0 ) : ( item.revenue_ytd_mb == '' || item.revenue_ytd_mb == 0 ? Number(revenueYtdPersenMB) * Number(-100) : Number(revenueYtdPersenMB) * Number(100) ),
item.revenue_ytd_last_year, item.revenue_ytd_last_year,
item.revenue_ytd_percent_of_last_year, // item.revenue_ytd_percent_of_last_year,
isNaN(revenueYtdPersenLY) || revenueYtdPersenLY == 'Infinity' || revenueYtdPersenLY == '-Infinity' ? ( item.revenue_ytd_last_year == '' || item.revenue_ytd_last_year == 0 ? -0 : 0 ) : ( item.revenue_ytd_last_year == '' || item.revenue_ytd_last_year == 0 ? Number(revenueYtdPersenLY) * Number(-100) : Number(revenueYtdPersenLY) * Number(100) ),
item.revenue_fy_ol, item.revenue_fy_ol,
item.revenue_fy_mb, item.revenue_fy_mb,
item.revenue_fy_percent_of_mb, // item.revenue_fy_percent_of_mb,
isNaN(revenueFyPersenMB) || revenueFyPersenMB == 'Infinity' || revenueFyPersenMB == '-Infinity' ? ( item.revenue_fy_mb == '' || item.revenue_fy_mb == 0 ? -0 : 0 ) : ( item.revenue_fy_mb == '' || item.revenue_fy_mb == 0 ? Number(revenueFyPersenMB) * Number(-100) : Number(revenueFyPersenMB) * Number(100) ),
item.revenue_fy_last_year, item.revenue_fy_last_year,
item.revenue_fy_percent_of_last_year, // item.revenue_fy_percent_of_last_year,
isNaN(revenueFyPersenLY) || revenueFyPersenLY == 'Infinity' || revenueFyPersenLY == '-Infinity' ? ( item.revenue_fy_last_year == '' || item.revenue_fy_last_year == 0 ? -0 : 0 ) : ( item.revenue_fy_last_year == '' || item.revenue_fy_last_year == 0 ? Number(revenueFyPersenLY) * Number(-100) : Number(revenueFyPersenLY) * Number(100) ),
item.ebitda_ytd_act, item.ebitda_ytd_act,
item.ebitda_ytd_mb, item.ebitda_ytd_mb,
item.ebitda_ytd_percent_of_mb, // item.ebitda_ytd_percent_of_mb,
isNaN(ebitdaYtdPersenMB) || ebitdaYtdPersenMB == 'Infinity' || ebitdaYtdPersenMB == '-Infinity' ? ( item.ebitda_ytd_mb == '' || item.ebitda_ytd_mb == 0 ? -0 : 0 ) : ( item.ebitda_ytd_mb == '' || item.ebitda_ytd_mb == 0 ? Number(ebitdaYtdPersenMB) * Number(-100) : Number(ebitdaYtdPersenMB) * Number(100) ),
item.ebitda_ytd_last_year, item.ebitda_ytd_last_year,
item.ebitda_ytd_percent_of_last_year, // item.ebitda_ytd_percent_of_last_year,
isNaN(ebitdaYtdPersenLY) || ebitdaYtdPersenLY == 'Infinity' || ebitdaYtdPersenLY == '-Infinity' ? ( item.ebitda_ytd_last_year == '' || item.ebitda_ytd_last_year == 0 ? -0 : 0 ) : ( item.ebitda_ytd_last_year == '' || item.ebitda_ytd_last_year == 0 ? Number(ebitdaYtdPersenLY) * Number(-100) : Number(ebitdaYtdPersenLY) * Number(100) ),
item.ebitda_fy_ol, item.ebitda_fy_ol,
item.ebitda_fy_mb, item.ebitda_fy_mb,
item.ebitda_fy_percent_of_mb, // item.ebitda_fy_percent_of_mb,
isNaN(ebitdaFyPersenMB) || ebitdaFyPersenMB == 'Infinity' || ebitdaFyPersenMB == '-Infinity' ? ( item.ebitda_fy_mb == '' || item.ebitda_fy_mb == 0 ? -0 : 0 ) : ( item.ebitda_fy_mb == '' || item.ebitda_fy_mb == 0 ? Number(ebitdaFyPersenMB) * Number(-100) : Number(ebitdaFyPersenMB) * Number(100) ),
item.ebitda_fy_last_year, item.ebitda_fy_last_year,
item.ebitda_fy_percent_of_last_year, // item.ebitda_fy_percent_of_last_year,
isNaN(ebitdaFyPersenLY) || ebitdaFyPersenLY == 'Infinity' || ebitdaFyPersenLY == '-Infinity' ? ( item.ebitda_fy_last_year == '' || item.ebitda_fy_last_year == 0 ? -0 : 0 ) : ( item.ebitda_fy_last_year == '' || item.ebitda_fy_last_year == 0 ? Number(ebitdaFyPersenLY) * Number(-100) : Number(ebitdaFyPersenLY) * Number(100) ),
item.tpat_ytd_act, item.tpat_ytd_act,
item.tpat_ytd_mb, item.tpat_ytd_mb,
item.tpat_ytd_percent_of_mb, // item.tpat_ytd_percent_of_mb,
isNaN(tpatYtdPersenMB) || tpatYtdPersenMB == 'Infinity' || tpatYtdPersenMB == '-Infinity' ? ( item.tpat_ytd_mb == '' || item.tpat_ytd_mb == 0 ? -0 : 0 ) : ( item.tpat_ytd_mb == '' || item.tpat_ytd_mb == 0 ? Number(tpatYtdPersenMB) * Number(-100) : Number(tpatYtdPersenMB) * Number(100) ),
item.tpat_ytd_last_year, item.tpat_ytd_last_year,
item.tpat_ytd_percent_of_last_year, // item.tpat_ytd_percent_of_last_year,
isNaN(tpatYtdPersenLY) || tpatYtdPersenLY == 'Infinity' || tpatYtdPersenLY == '-Infinity' ? ( item.tpat_ytd_last_year == '' || item.tpat_ytd_last_year == 0 ? -0 : 0 ) : ( item.tpat_ytd_last_year == '' || item.tpat_ytd_last_year == 0 ? Number(tpatYtdPersenLY) * Number(-100) : Number(tpatYtdPersenLY) * Number(100) ),
item.tpat_fy_ol, item.tpat_fy_ol,
item.tpat_fy_mb, item.tpat_fy_mb,
item.tpat_fy_percent_of_mb, // item.tpat_fy_percent_of_mb,
isNaN(tpatFyPersenMB) || tpatFyPersenMB == 'Infinity' || tpatFyPersenMB == '-Infinity' ? ( item.tpat_fy_mb == '' || item.tpat_fy_mb == 0 ? -0 : 0 ) : ( item.tpat_fy_mb == '' || item.tpat_fy_mb == 0 ? Number(tpatFyPersenMB) * Number(-100) : Number(tpatFyPersenMB) * Number(100) ),
item.tpat_fy_last_year, item.tpat_fy_last_year,
item.tpat_fy_percent_of_last_year, // item.tpat_fy_percent_of_last_year,
isNaN(tpatFyPersenLY) || tpatFyPersenLY == 'Infinity' || tpatFyPersenLY == '-Infinity' ? ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? -0 : 0 ) : ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? Number(tpatFyPersenLY) * Number(-100) : Number(tpatFyPersenLY) * Number(100) ),
item.npat_ytd_act, item.npat_ytd_act,
item.npat_ytd_mb, item.npat_ytd_mb,
item.npat_ytd_percent_of_mb, // item.npat_ytd_percent_of_mb,
isNaN(npatYtdPersenMB) || npatYtdPersenMB == 'Infinity' || npatYtdPersenMB == '-Infinity' ? ( item.npat_ytd_mb == '' || item.npat_ytd_mb == 0 ? -0 : 0 ) : ( item.npat_ytd_mb == '' || item.npat_ytd_mb == 0 ? Number(npatYtdPersenMB) * Number(-100) : Number(npatYtdPersenMB) * Number(100) ),
item.npat_ytd_last_year, item.npat_ytd_last_year,
item.npat_ytd_percent_of_last_year, // item.npat_ytd_percent_of_last_year,
isNaN(npatYtdPersenLY) || npatYtdPersenLY == 'Infinity' || npatYtdPersenLY == '-Infinity' ? ( item.npat_ytd_last_year == '' || item.npat_ytd_last_year == 0 ? -0 : 0 ) : ( item.npat_ytd_last_year == '' || item.npat_ytd_last_year == 0 ? Number(npatYtdPersenLY) * Number(-100) : Number(npatYtdPersenLY) * Number(100) ),
item.npat_fy_ol, item.npat_fy_ol,
item.npat_fy_mb, item.npat_fy_mb,
item.npat_fy_percent_of_mb, // item.npat_fy_percent_of_mb,
isNaN(npatFyPersenMB) || npatFyPersenMB == 'Infinity' || npatFyPersenMB == '-Infinity' ? ( item.npat_fy_mb == '' || item.npat_fy_mb == 0 ? -0 : 0 ) : ( item.npat_fy_mb == '' || item.npat_fy_mb == 0 ? Number(npatFyPersenMB) * Number(-100) : Number(npatFyPersenMB) * Number(100) ),
item.npat_fy_last_year, item.npat_fy_last_year,
item.npat_fy_percent_of_last_year, // item.npat_fy_percent_of_last_year,
isNaN(npatFyPersenLY) || npatFyPersenLY == 'Infinity' || npatFyPersenLY == '-Infinity' ? ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? -0 : 0 ) : ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? Number(npatFyPersenLY) * Number(-100) : Number(npatFyPersenLY) * Number(100) ),
item.order, item.order,
]) ])
} }
...@@ -598,6 +818,210 @@ export default class SummaryOfTriputra extends Component { ...@@ -598,6 +818,210 @@ export default class SummaryOfTriputra extends Component {
} }
} }
res.map((item, index) => { res.map((item, index) => {
// revenue ytd
let revenueYtdAct = item.revenue_ytd_act == '' ? 0 : Number(item.revenue_ytd_act)
let revenueYtdMB = item.revenue_ytd_mb == '' ? 0 : Number(item.revenue_ytd_mb)
let revenueYtdPersenMB = 0
if (revenueYtdMB < 0) {
if (revenueYtdAct >= revenueYtdMB) {
revenueYtdPersenMB = ( revenueYtdMB - revenueYtdAct ) / revenueYtdMB + 1
} else {
revenueYtdPersenMB = ( revenueYtdMB - revenueYtdAct ) / revenueYtdMB
}
} else {
revenueYtdPersenMB = revenueYtdAct / revenueYtdMB
}
// revenue ytd last year
let revenueYtdLY = item.revenue_ytd_last_year == '' ? 0 : Number(item.revenue_ytd_last_year)
let revenueYtdPersenLY = 0
if (revenueYtdLY < 0) {
if (revenueYtdAct >= revenueYtdLY) {
revenueYtdPersenLY = ( revenueYtdLY - revenueYtdAct ) / revenueYtdLY + 1
} else {
revenueYtdPersenLY = ( revenueYtdLY - revenueYtdAct ) / revenueYtdLY
}
} else {
revenueYtdPersenLY = revenueYtdAct / revenueYtdLY
}
// revenue fy
let revenueFyOl = item.revenue_fy_ol == '' ? 0 : Number(item.revenue_fy_ol)
let revenueFyMB = item.revenue_fy_mb == '' ? 0 : Number(item.revenue_fy_mb)
let revenueFyPersenMB = 0
if (revenueFyMB < 0) {
if (revenueFyOl >= revenueFyMB) {
revenueFyPersenMB = ( revenueFyMB - revenueFyOl ) / revenueFyMB + 1
} else {
revenueFyPersenMB = ( revenueFyMB - revenueFyOl ) / revenueFyMB
}
} else {
revenueFyPersenMB = revenueFyOl / revenueFyMB
}
// revenue fy last year
let revenueFyLY = item.revenue_fy_last_year == '' ? 0 : Number(item.revenue_fy_last_year)
let revenueFyPersenLY = 0
if (revenueFyLY < 0) {
if (revenueFyOl >= revenueFyLY) {
revenueFyPersenLY = ( revenueFyLY - revenueFyOl ) / revenueFyLY + 1
} else {
revenueFyPersenLY = ( revenueFyLY - revenueFyOl ) / revenueFyLY
}
} else {
revenueFyPersenLY = revenueFyOl / revenueFyLY
}
// ebitda ytd
let ebitdaYtdAct = item.ebitda_ytd_act == '' ? 0 : Number(item.ebitda_ytd_act)
let ebitdaYtdMB = item.ebitda_ytd_mb == '' ? 0 : Number(item.ebitda_ytd_mb)
let ebitdaYtdPersenMB = 0
if (ebitdaYtdMB < 0) {
if (ebitdaYtdAct >= ebitdaYtdMB) {
ebitdaYtdPersenMB = ( ebitdaYtdMB - ebitdaYtdAct ) / ebitdaYtdMB + 1
} else {
ebitdaYtdPersenMB = ( ebitdaYtdMB - ebitdaYtdAct ) / ebitdaYtdMB
}
} else {
ebitdaYtdPersenMB = ebitdaYtdAct / ebitdaYtdMB
}
// ebitda ytd last year
let ebitdaYtdLY = item.ebitda_ytd_last_year == '' ? 0 : Number(item.ebitda_ytd_last_year)
let ebitdaYtdPersenLY = 0
if (ebitdaYtdLY < 0) {
if (ebitdaYtdAct >= ebitdaYtdLY) {
ebitdaYtdPersenLY = ( ebitdaYtdLY - ebitdaYtdAct ) / ebitdaYtdLY + 1
} else {
ebitdaYtdPersenLY = ( ebitdaYtdLY - ebitdaYtdAct ) / ebitdaYtdLY
}
} else {
ebitdaYtdPersenLY = ebitdaYtdAct / ebitdaYtdLY
}
// ebitda fy
let ebitdaFyOl = item.ebitda_fy_ol == '' ? 0 : Number(item.ebitda_fy_ol)
let ebitdaFyMB = item.ebitda_fy_mb == '' ? 0 : Number(item.ebitda_fy_mb)
let ebitdaFyPersenMB = 0
if (ebitdaFyMB < 0) {
if (ebitdaFyOl >= ebitdaFyMB) {
ebitdaFyPersenMB = ( ebitdaFyMB - ebitdaFyOl ) / ebitdaFyMB + 1
} else {
ebitdaFyPersenMB = ( ebitdaFyMB - ebitdaFyOl ) / ebitdaFyMB
}
} else {
ebitdaFyPersenMB = ebitdaFyOl / ebitdaFyMB
}
// ebitda fy last year
let ebitdaFyLY = item.ebitda_fy_last_year == '' ? 0 : Number(item.ebitda_fy_last_year)
let ebitdaFyPersenLY = 0
if (ebitdaFyLY < 0) {
if (ebitdaFyOl >= ebitdaFyLY) {
ebitdaFyPersenLY = ( ebitdaFyLY - ebitdaFyOl ) / ebitdaFyLY + 1
} else {
ebitdaFyPersenLY = ( ebitdaFyLY - ebitdaFyOl ) / ebitdaFyLY
}
} else {
ebitdaFyPersenLY = ebitdaFyOl / ebitdaFyLY
}
// tpat ytd
let tpatYtdAct = item.tpat_ytd_act == '' ? 0 : Number(item.tpat_ytd_act)
let tpatYtdMB = item.tpat_ytd_mb == '' ? 0 : Number(item.tpat_ytd_mb)
let tpatYtdPersenMB = 0
if (tpatYtdMB < 0) {
if (tpatYtdAct >= tpatYtdMB) {
tpatYtdPersenMB = ( tpatYtdMB - tpatYtdAct ) / tpatYtdMB + 1
} else {
tpatYtdPersenMB = ( tpatYtdMB - tpatYtdAct ) / tpatYtdMB
}
} else {
tpatYtdPersenMB = tpatYtdAct / tpatYtdMB
}
// tpat ytd last year
let tpatYtdLY = item.tpat_ytd_last_year == '' ? 0 : Number(item.tpat_ytd_last_year)
let tpatYtdPersenLY = 0
if (tpatYtdLY < 0) {
if (tpatYtdAct >= tpatYtdLY) {
tpatYtdPersenLY = ( tpatYtdLY - tpatYtdAct ) / tpatYtdLY + 1
} else {
tpatYtdPersenLY = ( tpatYtdLY - tpatYtdAct ) / tpatYtdLY
}
} else {
tpatYtdPersenLY = tpatYtdAct / tpatYtdLY
}
// tpat fy
let tpatFyOl = item.tpat_fy_ol == '' ? 0 : Number(item.tpat_fy_ol)
let tpatFyMB = item.tpat_fy_mb == '' ? 0 : Number(item.tpat_fy_mb)
let tpatFyPersenMB = 0
if (tpatFyMB < 0) {
if (tpatFyOl >= tpatFyMB) {
tpatFyPersenMB = ( tpatFyMB - tpatFyOl ) / tpatFyMB + 1
} else {
tpatFyPersenMB = ( tpatFyMB - tpatFyOl ) / tpatFyMB
}
} else {
tpatFyPersenMB = tpatFyOl / tpatFyMB
}
// tpat fy last year
let tpatFyLY = item.tpat_fy_last_year == '' ? 0 : Number(item.tpat_fy_last_year)
let tpatFyPersenLY = 0
if (tpatFyLY < 0) {
if (tpatFyOl >= tpatFyLY) {
tpatFyPersenLY = ( tpatFyLY - tpatFyOl ) / tpatFyLY + 1
} else {
tpatFyPersenLY = ( tpatFyLY - tpatFyOl ) / tpatFyLY
}
} else {
tpatFyPersenLY = tpatFyOl / tpatFyLY
}
// npat ytd
let npatYtdAct = item.npat_ytd_act == '' ? 0 : Number(item.npat_ytd_act)
let npatYtdMB = item.npat_ytd_mb == '' ? 0 : Number(item.npat_ytd_mb)
let npatYtdPersenMB = 0
if (npatYtdMB < 0) {
if (npatYtdAct >= npatYtdMB) {
npatYtdPersenMB = ( npatYtdMB - npatYtdAct ) / npatYtdMB + 1
} else {
npatYtdPersenMB = ( npatYtdMB - npatYtdAct ) / npatYtdMB
}
} else {
npatYtdPersenMB = npatYtdAct / npatYtdMB
}
// npat ytd last year
let npatYtdLY = item.npat_ytd_last_year == '' ? 0 : Number(item.npat_ytd_last_year)
let npatYtdPersenLY = 0
if (npatYtdLY < 0) {
if (npatYtdAct >= npatYtdLY) {
npatYtdPersenLY = ( npatYtdLY - npatYtdAct ) / npatYtdLY + 1
} else {
npatYtdPersenLY = ( npatYtdLY - npatYtdAct ) / npatYtdLY
}
} else {
npatYtdPersenLY = npatYtdAct / npatYtdLY
}
// npat fy
let npatFyOl = item.npat_fy_ol == '' ? 0 : Number(item.npat_fy_ol)
let npatFyMB = item.npat_fy_mb == '' ? 0 : Number(item.npat_fy_mb)
let npatFyPersenMB = 0
if (npatFyMB < 0) {
if (npatFyOl >= npatFyMB) {
npatFyPersenMB = ( npatFyMB - npatFyOl ) / npatFyMB + 1
} else {
npatFyPersenMB = ( npatFyMB - npatFyOl ) / npatFyMB
}
} else {
npatFyPersenMB = npatFyOl / npatFyMB
}
// npat fy last year
let npatFyLY = item.npat_fy_last_year == '' ? 0 : Number(item.npat_fy_last_year)
let npatFyPersenLY = 0
if (npatFyLY < 0) {
if (npatFyOl >= npatFyLY) {
npatFyPersenLY = ( npatFyLY - npatFyOl ) / npatFyLY + 1
} else {
npatFyPersenLY = ( npatFyLY - npatFyOl ) / npatFyLY
}
} else {
npatFyPersenLY = npatFyOl / npatFyLY
}
dataTable.push([ dataTable.push([
item.company_id, item.company_id,
item.parent, item.parent,
...@@ -605,44 +1029,60 @@ export default class SummaryOfTriputra extends Component { ...@@ -605,44 +1029,60 @@ export default class SummaryOfTriputra extends Component {
item.company_name, item.company_name,
item.revenue_ytd_act, item.revenue_ytd_act,
item.revenue_ytd_mb, item.revenue_ytd_mb,
item.revenue_ytd_percent_of_mb, // item.revenue_ytd_percent_of_mb,
isNaN(revenueYtdPersenMB) || revenueYtdPersenMB == 'Infinity' || revenueYtdPersenMB == '-Infinity' ? ( item.revenue_ytd_mb == '' || item.revenue_ytd_mb == 0 ? -0 : 0 ) : ( item.revenue_ytd_mb == '' || item.revenue_ytd_mb == 0 ? Number(revenueYtdPersenMB) * Number(-100) : Number(revenueYtdPersenMB) * Number(100) ),
item.revenue_ytd_last_year, item.revenue_ytd_last_year,
item.revenue_ytd_percent_of_last_year, // item.revenue_ytd_percent_of_last_year,
isNaN(revenueYtdPersenLY) || revenueYtdPersenLY == 'Infinity' || revenueYtdPersenLY == '-Infinity' ? ( item.revenue_ytd_last_year == '' || item.revenue_ytd_last_year == 0 ? -0 : 0 ) : ( item.revenue_ytd_last_year == '' || item.revenue_ytd_last_year == 0 ? Number(revenueYtdPersenLY) * Number(-100) : Number(revenueYtdPersenLY) * Number(100) ),
item.revenue_fy_ol, item.revenue_fy_ol,
item.revenue_fy_mb, item.revenue_fy_mb,
item.revenue_fy_percent_of_mb, // item.revenue_fy_percent_of_mb,
isNaN(revenueFyPersenMB) || revenueFyPersenMB == 'Infinity' || revenueFyPersenMB == '-Infinity' ? ( item.revenue_fy_mb == '' || item.revenue_fy_mb == 0 ? -0 : 0 ) : ( item.revenue_fy_mb == '' || item.revenue_fy_mb == 0 ? Number(revenueFyPersenMB) * Number(-100) : Number(revenueFyPersenMB) * Number(100) ),
item.revenue_fy_last_year, item.revenue_fy_last_year,
item.revenue_fy_percent_of_last_year, // item.revenue_fy_percent_of_last_year,
isNaN(revenueFyPersenLY) || revenueFyPersenLY == 'Infinity' || revenueFyPersenLY == '-Infinity' ? ( item.revenue_fy_last_year == '' || item.revenue_fy_last_year == 0 ? -0 : 0 ) : ( item.revenue_fy_last_year == '' || item.revenue_fy_last_year == 0 ? Number(revenueFyPersenLY) * Number(-100) : Number(revenueFyPersenLY) * Number(100) ),
item.ebitda_ytd_act, item.ebitda_ytd_act,
item.ebitda_ytd_mb, item.ebitda_ytd_mb,
item.ebitda_ytd_percent_of_mb, // item.ebitda_ytd_percent_of_mb,
isNaN(ebitdaYtdPersenMB) || ebitdaYtdPersenMB == 'Infinity' || ebitdaYtdPersenMB == '-Infinity' ? ( item.ebitda_ytd_mb == '' || item.ebitda_ytd_mb == 0 ? -0 : 0 ) : ( item.ebitda_ytd_mb == '' || item.ebitda_ytd_mb == 0 ? Number(ebitdaYtdPersenMB) * Number(-100) : Number(ebitdaYtdPersenMB) * Number(100) ),
item.ebitda_ytd_last_year, item.ebitda_ytd_last_year,
item.ebitda_ytd_percent_of_last_year, // item.ebitda_ytd_percent_of_last_year,
isNaN(ebitdaYtdPersenLY) || ebitdaYtdPersenLY == 'Infinity' || ebitdaYtdPersenLY == '-Infinity' ? ( item.ebitda_ytd_last_year == '' || item.ebitda_ytd_last_year == 0 ? -0 : 0 ) : ( item.ebitda_ytd_last_year == '' || item.ebitda_ytd_last_year == 0 ? Number(ebitdaYtdPersenLY) * Number(-100) : Number(ebitdaYtdPersenLY) * Number(100) ),
item.ebitda_fy_ol, item.ebitda_fy_ol,
item.ebitda_fy_mb, item.ebitda_fy_mb,
item.ebitda_fy_percent_of_mb, // item.ebitda_fy_percent_of_mb,
isNaN(ebitdaFyPersenMB) || ebitdaFyPersenMB == 'Infinity' || ebitdaFyPersenMB == '-Infinity' ? ( item.ebitda_fy_mb == '' || item.ebitda_fy_mb == 0 ? -0 : 0 ) : ( item.ebitda_fy_mb == '' || item.ebitda_fy_mb == 0 ? Number(ebitdaFyPersenMB) * Number(-100) : Number(ebitdaFyPersenMB) * Number(100) ),
item.ebitda_fy_last_year, item.ebitda_fy_last_year,
item.ebitda_fy_percent_of_last_year, // item.ebitda_fy_percent_of_last_year,
isNaN(ebitdaFyPersenLY) || ebitdaFyPersenLY == 'Infinity' || ebitdaFyPersenLY == '-Infinity' ? ( item.ebitda_fy_last_year == '' || item.ebitda_fy_last_year == 0 ? -0 : 0 ) : ( item.ebitda_fy_last_year == '' || item.ebitda_fy_last_year == 0 ? Number(ebitdaFyPersenLY) * Number(-100) : Number(ebitdaFyPersenLY) * Number(100) ),
item.tpat_ytd_act, item.tpat_ytd_act,
item.tpat_ytd_mb, item.tpat_ytd_mb,
item.tpat_ytd_percent_of_mb, // item.tpat_ytd_percent_of_mb,
isNaN(tpatYtdPersenMB) || tpatYtdPersenMB == 'Infinity' || tpatYtdPersenMB == '-Infinity' ? ( item.tpat_ytd_mb == '' || item.tpat_ytd_mb == 0 ? -0 : 0 ) : ( item.tpat_ytd_mb == '' || item.tpat_ytd_mb == 0 ? Number(tpatYtdPersenMB) * Number(-100) : Number(tpatYtdPersenMB) * Number(100) ),
item.tpat_ytd_last_year, item.tpat_ytd_last_year,
item.tpat_ytd_percent_of_last_year, // item.tpat_ytd_percent_of_last_year,
isNaN(tpatYtdPersenLY) || tpatYtdPersenLY == 'Infinity' || tpatYtdPersenLY == '-Infinity' ? ( item.tpat_ytd_last_year == '' || item.tpat_ytd_last_year == 0 ? -0 : 0 ) : ( item.tpat_ytd_last_year == '' || item.tpat_ytd_last_year == 0 ? Number(tpatYtdPersenLY) * Number(-100) : Number(tpatYtdPersenLY) * Number(100) ),
item.tpat_fy_ol, item.tpat_fy_ol,
item.tpat_fy_mb, item.tpat_fy_mb,
item.tpat_fy_percent_of_mb, // item.tpat_fy_percent_of_mb,
isNaN(tpatFyPersenMB) || tpatFyPersenMB == 'Infinity' || tpatFyPersenMB == '-Infinity' ? ( item.tpat_fy_mb == '' || item.tpat_fy_mb == 0 ? -0 : 0 ) : ( item.tpat_fy_mb == '' || item.tpat_fy_mb == 0 ? Number(tpatFyPersenMB) * Number(-100) : Number(tpatFyPersenMB) * Number(100) ),
item.tpat_fy_last_year, item.tpat_fy_last_year,
item.tpat_fy_percent_of_last_year, // item.tpat_fy_percent_of_last_year,
isNaN(tpatFyPersenLY) || tpatFyPersenLY == 'Infinity' || tpatFyPersenLY == '-Infinity' ? ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? -0 : 0 ) : ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? Number(tpatFyPersenLY) * Number(-100) : Number(tpatFyPersenLY) * Number(100) ),
item.npat_ytd_act, item.npat_ytd_act,
item.npat_ytd_mb, item.npat_ytd_mb,
item.npat_ytd_percent_of_mb, // item.npat_ytd_percent_of_mb,
isNaN(npatYtdPersenMB) || npatYtdPersenMB == 'Infinity' || npatYtdPersenMB == '-Infinity' ? ( item.npat_ytd_mb == '' || item.npat_ytd_mb == 0 ? -0 : 0 ) : ( item.npat_ytd_mb == '' || item.npat_ytd_mb == 0 ? Number(npatYtdPersenMB) * Number(-100) : Number(npatYtdPersenMB) * Number(100) ),
item.npat_ytd_last_year, item.npat_ytd_last_year,
item.npat_ytd_percent_of_last_year, // item.npat_ytd_percent_of_last_year,
isNaN(npatYtdPersenLY) || npatYtdPersenLY == 'Infinity' || npatYtdPersenLY == '-Infinity' ? ( item.npat_ytd_last_year == '' || item.npat_ytd_last_year == 0 ? -0 : 0 ) : ( item.npat_ytd_last_year == '' || item.npat_ytd_last_year == 0 ? Number(npatYtdPersenLY) * Number(-100) : Number(npatYtdPersenLY) * Number(100) ),
item.npat_fy_ol, item.npat_fy_ol,
item.npat_fy_mb, item.npat_fy_mb,
item.npat_fy_percent_of_mb, // item.npat_fy_percent_of_mb,
isNaN(npatFyPersenMB) || npatFyPersenMB == 'Infinity' || npatFyPersenMB == '-Infinity' ? ( item.npat_fy_mb == '' || item.npat_fy_mb == 0 ? -0 : 0 ) : ( item.npat_fy_mb == '' || item.npat_fy_mb == 0 ? Number(npatFyPersenMB) * Number(-100) : Number(npatFyPersenMB) * Number(100) ),
item.npat_fy_last_year, item.npat_fy_last_year,
item.npat_fy_percent_of_last_year, // item.npat_fy_percent_of_last_year,
isNaN(npatFyPersenLY) || npatFyPersenLY == 'Infinity' || npatFyPersenLY == '-Infinity' ? ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? -0 : 0 ) : ( item.tpat_fy_last_year == '' || item.tpat_fy_last_year == 0 ? Number(npatFyPersenLY) * Number(-100) : Number(npatFyPersenLY) * Number(100) ),
item.order, item.order,
]) ])
if (item.children !== null) { if (item.children !== null) {
......
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