Commit 8d105565 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

Ggmac

See merge request !1140
parents eab0adc7 be98d08c
...@@ -331,212 +331,7 @@ export default class SummaryOfTriputra extends Component { ...@@ -331,212 +331,7 @@ 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,
0, 0,
item.parent, item.parent,
item.level, item.level,
...@@ -544,59 +339,43 @@ export default class SummaryOfTriputra extends Component { ...@@ -544,59 +339,43 @@ export default class SummaryOfTriputra extends Component {
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,
]) ])
} }
...@@ -609,212 +388,7 @@ export default class SummaryOfTriputra extends Component { ...@@ -609,212 +388,7 @@ 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,
0, 0,
item.parent, item.parent,
item.level, item.level,
...@@ -822,59 +396,43 @@ export default class SummaryOfTriputra extends Component { ...@@ -822,59 +396,43 @@ export default class SummaryOfTriputra extends Component {
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) {
...@@ -902,7 +460,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -902,7 +460,6 @@ export default class SummaryOfTriputra extends Component {
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) {
dataTable.push([ dataTable.push([
// item.company_id,
0, 0,
item.parent, item.parent,
item.level, item.level,
...@@ -952,9 +509,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -952,9 +509,6 @@ export default class SummaryOfTriputra extends Component {
item.percent_npat_yoy_ol, item.percent_npat_yoy_ol,
item.percent_npat_yoy_next_year, item.percent_npat_yoy_next_year,
item.percent_npat_yoy_next_two_year, item.percent_npat_yoy_next_two_year,
// item.npat_margin_ol,
// item.npat_margin_next_year,
// item.npat_margin_next_two_year,
item.order, item.order,
]) ])
} }
...@@ -968,7 +522,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -968,7 +522,6 @@ export default class SummaryOfTriputra extends Component {
} }
res.map((item, index) => { res.map((item, index) => {
dataTable.push([ dataTable.push([
// item.company_id,
0, 0,
item.parent, item.parent,
item.level, item.level,
...@@ -1018,9 +571,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -1018,9 +571,6 @@ export default class SummaryOfTriputra extends Component {
item.percent_npat_yoy_ol, item.percent_npat_yoy_ol,
item.percent_npat_yoy_next_year, item.percent_npat_yoy_next_year,
item.percent_npat_yoy_next_two_year, item.percent_npat_yoy_next_two_year,
// item.npat_margin_ol,
// item.npat_margin_next_year,
// item.npat_margin_next_two_year,
item.order, item.order,
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1049,7 +599,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -1049,7 +599,6 @@ export default class SummaryOfTriputra extends Component {
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) {
dataTable.push([ dataTable.push([
// item.company_id,
0, 0,
item.parent, item.parent,
item.level, item.level,
...@@ -1133,7 +682,6 @@ export default class SummaryOfTriputra extends Component { ...@@ -1133,7 +682,6 @@ export default class SummaryOfTriputra extends Component {
} }
res.map((item, index) => { res.map((item, index) => {
dataTable.push([ dataTable.push([
// item.company_id,
0, 0,
item.parent, item.parent,
item.level, item.level,
...@@ -1225,19 +773,22 @@ export default class SummaryOfTriputra extends Component { ...@@ -1225,19 +773,22 @@ export default class SummaryOfTriputra extends Component {
async downloadAllData() { async downloadAllData() {
if (this.state.report.value === 1) { if (this.state.report.value === 1) {
alert("Download MTD Report Coming Soon") // alert("Download MTD Report Coming Soon")
// let res = await fetch( let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_mtd/export_report?year=${this.state.periode.periode}&&months=${this.state.month.month_id}`
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/db_report/export_master_budget?submission_id=${this.state.submissionID === null ? "" : this.state.submissionID}&&report_id=${this.state.report.value}&&company_id=${this.state.company.company_id}&&year=${this.state.periode.periode}&&revision=${this.state.lastRevision}` let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_mtd/export_report?year=${this.state.periode.periode}&&months=${this.state.month.month_id}`
// ) console.log(url);
// res = await res.blob() let res = await fetch(
// this.setState({ loading: false }) this.state.submissionID == null ? sub_null : url
// if (res.size > 0) { )
// let url = window.URL.createObjectURL(res); res = await res.blob()
// let a = document.createElement('a'); this.setState({ loading: false })
// a.href = url; if (res.size > 0) {
// a.download = 'Report DB Profit & Loss Detail.xlsx'; let url = window.URL.createObjectURL(res);
// a.click(); let a = document.createElement('a');
// } a.href = url;
a.download = 'Report MTD.xlsx';
a.click();
}
} else if (this.state.report.value === 2) { } else if (this.state.report.value === 2) {
// alert("Download YTD Report Coming Soon") // alert("Download YTD Report Coming Soon")
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_ytd/export_report?year=${this.state.periode.periode}&&months=${this.state.month.month_id}` let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/summary_ytd/export_report?year=${this.state.periode.periode}&&months=${this.state.month.month_id}`
......
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