Commit 8637ff99 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

Didam

See merge request !1032
parents fb38ed45 2981e5e7
...@@ -234,14 +234,17 @@ const create = (type = "") => { ...@@ -234,14 +234,17 @@ const create = (type = "") => {
const getLastestUpdateMROI = (body) => api.post('transaction/operating_indicator/monthly_report/get_latest_update', body) const getLastestUpdateMROI = (body) => api.post('transaction/operating_indicator/monthly_report/get_latest_update', body)
//REPORT NEW //REPORT NEW
const getAllReportBS = (body) => api.post('/transaction/db_balance_sheet/get_report_hierarki', body)
const getReportBSMB = (body) => api.post('/transaction/db_balance_sheet/master_budget/get_report_hierarki', body) const getReportBSMB = (body) => api.post('/transaction/db_balance_sheet/master_budget/get_report_hierarki', body)
const getReportBSMR = (body) => api.post('/transaction/db_balance_sheet/monthly_report/get_report_hierarki', body) const getReportBSMR = (body) => api.post('/transaction/db_balance_sheet/monthly_report/get_report_hierarki', body)
const getAllReportPLDetail = (body) => api.post('/transaction/db_profit_loss_detail/get_report_hierarki', body)
const getReportPLDetailMB = (body) => api.post('/transaction/db_profit_loss_detail/master_budget/get_report_hierarki', body) const getReportPLDetailMB = (body) => api.post('/transaction/db_profit_loss_detail/master_budget/get_report_hierarki', body)
const getReportPLDetailMR = (body) => api.post('/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki', body) const getReportPLDetailMR = (body) => api.post('/transaction/db_profit_loss_detail/monthly_report/get_report_hierarki', body)
const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/get_report_hierarki', body) const getReportPLMB = (body) => api.post('/transaction/db_profit_loss/master_budget/get_report_hierarki', body)
const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body) const getReportPLMR = (body) => api.post('/transaction/db_profit_loss/monthly_report/get_report_hierarki', body)
const getReportTPMB = (body) => api.post('/transaction/db_tax_planning/master_budget/get_report_hierarki', body) const getReportTPMB = (body) => api.post('/transaction/db_tax_planning/master_budget/get_report_hierarki', body)
const getReportTPMR = (body) => api.post('/transaction/db_tax_planning/monthly_report/get_report_hierarki', body) const getReportTPMR = (body) => api.post('/transaction/db_tax_planning/monthly_report/get_report_hierarki', body)
const getAllReportOI = (body) => api.post('/transaction/db_operating_indicator/get_report_hierarki', body)
const getReportOIMB = (body) => api.post('/transaction/db_operating_indicator/master_budget/get_report_hierarki', body) const getReportOIMB = (body) => api.post('/transaction/db_operating_indicator/master_budget/get_report_hierarki', body)
const getReportOIMR = (body) => api.post('/transaction/db_operating_indicator/monthly_report/get_report_hierarki', body) const getReportOIMR = (body) => api.post('/transaction/db_operating_indicator/monthly_report/get_report_hierarki', body)
const getReportCFSumaMB = (body) => api.post('/transaction/summary_cash_flow/master_budget/get_report_hierarki', body) const getReportCFSumaMB = (body) => api.post('/transaction/summary_cash_flow/master_budget/get_report_hierarki', body)
...@@ -607,6 +610,9 @@ const create = (type = "") => { ...@@ -607,6 +610,9 @@ const create = (type = "") => {
getReportCFSumaMR, getReportCFSumaMR,
createReportCF, createReportCF,
getReportCFSuma, getReportCFSuma,
getAllReportBS,
getAllReportPLDetail,
getAllReportOI,
getReportFRMB, getReportFRMB,
getReportFRMR, getReportFRMR,
getReportFRLastMR getReportFRLastMR
......
...@@ -205,13 +205,13 @@ export default class SubHolding extends Component { ...@@ -205,13 +205,13 @@ export default class SubHolding extends Component {
let index = data.findIndex((val) => val.month_name == month) let index = data.findIndex((val) => val.month_name == month)
let listQuarter = [ let listQuarter = [
{name: 'Q1', value: '3'}, { name: 'Q1', value: '3' },
{name: 'Q2', value: '6'}, { name: 'Q2', value: '6' },
{name: 'Q3', value: '9'}, { name: 'Q3', value: '9' },
{name: 'Q4', value: '12'}, { name: 'Q4', value: '12' },
] ]
let listUom = [{value: 'Mio IDR'}] let listUom = [{ value: 'Mio IDR' }]
let defaultPropsQuarter = { let defaultPropsQuarter = {
options: listQuarter, options: listQuarter,
...@@ -268,7 +268,7 @@ export default class SubHolding extends Component { ...@@ -268,7 +268,7 @@ export default class SubHolding extends Component {
if (this.state.report.value === 2) { if (this.state.report.value === 2) {
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.report_name === 'Balance Sheet') { if (item.report_name === 'Balance Sheet') {
this.setState({ revisionType: item.revision }, ()=> { this.setState({ revisionType: item.revision }, () => {
this.getSubmission() this.getSubmission()
}) })
} }
...@@ -276,7 +276,7 @@ export default class SubHolding extends Component { ...@@ -276,7 +276,7 @@ export default class SubHolding extends Component {
} else if (this.state.report.value === 1) { } else if (this.state.report.value === 1) {
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.report_name === 'Profit Loss') { if (item.report_name === 'Profit Loss') {
this.setState({ revisionType: item.revision }, ()=> { this.setState({ revisionType: item.revision }, () => {
this.getSubmission() this.getSubmission()
}) })
} }
...@@ -284,13 +284,13 @@ export default class SubHolding extends Component { ...@@ -284,13 +284,13 @@ export default class SubHolding extends Component {
} else if (this.state.report.value === 5) { } else if (this.state.report.value === 5) {
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.report_name === 'Tax Planning') { if (item.report_name === 'Tax Planning') {
this.setState({ revisionType: item.revision }, ()=> { this.setState({ revisionType: item.revision }, () => {
this.getSubmission() this.getSubmission()
}) })
} }
}) })
} else { } else {
this.setState({ revisionType: 0 }, ()=> { this.setState({ revisionType: 0 }, () => {
this.getSubmission() this.getSubmission()
}) })
} }
...@@ -343,7 +343,7 @@ export default class SubHolding extends Component { ...@@ -343,7 +343,7 @@ export default class SubHolding extends Component {
"submission_id": this.state.submissionID "submission_id": this.state.submissionID
} }
if (this.state.report.value === 1) { if (this.state.report.value === 1) {
api.create().getReportPLDetailMB(payload).then(response => { api.create().getAllReportPLDetail(payload).then(response => {
console.log(response); console.log(response);
let dataTable = [] let dataTable = []
if (response.data) { if (response.data) {
...@@ -374,7 +374,31 @@ export default class SubHolding extends Component { ...@@ -374,7 +374,31 @@ export default class SubHolding extends Component {
item.profit_loss.total_current_year, item.profit_loss.total_current_year,
item.profit_loss.total_next_year, item.profit_loss.total_next_year,
item.profit_loss.total_more_year, item.profit_loss.total_more_year,
item.order item.order,
item.profit_loss.monthly_january,
item.profit_loss.monthly_february,
item.profit_loss.monthly_march,
item.profit_loss.monthly_april,
item.profit_loss.monthly_may,
item.profit_loss.monthly_june,
item.profit_loss.monthly_july,
item.profit_loss.monthly_august,
item.profit_loss.monthly_september,
item.profit_loss.monthly_october,
item.profit_loss.monthly_november,
item.profit_loss.monthly_december,
item.profit_loss.monthly_last_year_january,
item.profit_loss.monthly_last_year_february,
item.profit_loss.monthly_last_year_march,
item.profit_loss.monthly_last_year_april,
item.profit_loss.monthly_last_year_may,
item.profit_loss.monthly_last_year_june,
item.profit_loss.monthly_last_year_july,
item.profit_loss.monthly_last_year_august,
item.profit_loss.monthly_last_year_september,
item.profit_loss.monthly_last_year_october,
item.profit_loss.monthly_last_year_november,
item.profit_loss.monthly_last_year_december
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -409,7 +433,31 @@ export default class SubHolding extends Component { ...@@ -409,7 +433,31 @@ export default class SubHolding extends Component {
item.profit_loss.total_current_year, item.profit_loss.total_current_year,
item.profit_loss.total_next_year, item.profit_loss.total_next_year,
item.profit_loss.total_more_year, item.profit_loss.total_more_year,
item.order item.order,
item.profit_loss.monthly_january,
item.profit_loss.monthly_february,
item.profit_loss.monthly_march,
item.profit_loss.monthly_april,
item.profit_loss.monthly_may,
item.profit_loss.monthly_june,
item.profit_loss.monthly_july,
item.profit_loss.monthly_august,
item.profit_loss.monthly_september,
item.profit_loss.monthly_october,
item.profit_loss.monthly_november,
item.profit_loss.monthly_december,
item.profit_loss.monthly_last_year_january,
item.profit_loss.monthly_last_year_february,
item.profit_loss.monthly_last_year_march,
item.profit_loss.monthly_last_year_april,
item.profit_loss.monthly_last_year_may,
item.profit_loss.monthly_last_year_june,
item.profit_loss.monthly_last_year_july,
item.profit_loss.monthly_last_year_august,
item.profit_loss.monthly_last_year_september,
item.profit_loss.monthly_last_year_october,
item.profit_loss.monthly_last_year_november,
item.profit_loss.monthly_last_year_december
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -421,16 +469,18 @@ export default class SubHolding extends Component { ...@@ -421,16 +469,18 @@ export default class SubHolding extends Component {
}) })
// console.log(dataTable) // console.log(dataTable)
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true }) // this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => { this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
console.log(this.state.dataTable)
this.getPLDetailMR(payload) // this.setState({ dataTable }, () => {
}) // console.log(this.state.dataTable)
// this.getPLDetailMR(payload)
// })
} else { } else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
}) })
} else if (this.state.report.value === 2) { } else if (this.state.report.value === 2) {
api.create().getReportBSMB(payload).then(response => { api.create().getAllReportBS(payload).then(response => {
console.log(payload); console.log(payload);
console.log(response); console.log(response);
let dataTable = [] let dataTable = []
...@@ -464,7 +514,31 @@ export default class SubHolding extends Component { ...@@ -464,7 +514,31 @@ export default class SubHolding extends Component {
Number(item.balance_sheet.total_more_year).toFixed(1), Number(item.balance_sheet.total_more_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong item.condition_if_wrong,
item.balance_sheet.monthly_january,
item.balance_sheet.monthly_february,
item.balance_sheet.monthly_march,
item.balance_sheet.monthly_april,
item.balance_sheet.monthly_may,
item.balance_sheet.monthly_june,
item.balance_sheet.monthly_july,
item.balance_sheet.monthly_august,
item.balance_sheet.monthly_september,
item.balance_sheet.monthly_october,
item.balance_sheet.monthly_november,
item.balance_sheet.monthly_december,
item.balance_sheet.monthly_last_year_january,
item.balance_sheet.monthly_last_year_february,
item.balance_sheet.monthly_last_year_march,
item.balance_sheet.monthly_last_year_april,
item.balance_sheet.monthly_last_year_may,
item.balance_sheet.monthly_last_year_june,
item.balance_sheet.monthly_last_year_july,
item.balance_sheet.monthly_last_year_august,
item.balance_sheet.monthly_last_year_september,
item.balance_sheet.monthly_last_year_october,
item.balance_sheet.monthly_last_year_november,
item.balance_sheet.monthly_last_year_december
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -501,7 +575,31 @@ export default class SubHolding extends Component { ...@@ -501,7 +575,31 @@ export default class SubHolding extends Component {
Number(item.balance_sheet.total_more_year).toFixed(1), Number(item.balance_sheet.total_more_year).toFixed(1),
item.order, item.order,
item.condition_it_should_be, item.condition_it_should_be,
item.condition_if_wrong item.condition_if_wrong,
item.balance_sheet.monthly_january,
item.balance_sheet.monthly_february,
item.balance_sheet.monthly_march,
item.balance_sheet.monthly_april,
item.balance_sheet.monthly_may,
item.balance_sheet.monthly_june,
item.balance_sheet.monthly_july,
item.balance_sheet.monthly_august,
item.balance_sheet.monthly_september,
item.balance_sheet.monthly_october,
item.balance_sheet.monthly_november,
item.balance_sheet.monthly_december,
item.balance_sheet.monthly_last_year_january,
item.balance_sheet.monthly_last_year_february,
item.balance_sheet.monthly_last_year_march,
item.balance_sheet.monthly_last_year_april,
item.balance_sheet.monthly_last_year_may,
item.balance_sheet.monthly_last_year_june,
item.balance_sheet.monthly_last_year_july,
item.balance_sheet.monthly_last_year_august,
item.balance_sheet.monthly_last_year_september,
item.balance_sheet.monthly_last_year_october,
item.balance_sheet.monthly_last_year_november,
item.balance_sheet.monthly_last_year_december
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -511,11 +609,11 @@ export default class SubHolding extends Component { ...@@ -511,11 +609,11 @@ export default class SubHolding extends Component {
} }
} }
}) })
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true }) this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => { // this.setState({ dataTable }, () => {
console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.getBalanceSheetMR(payload) // this.getBalanceSheetMR(payload)
}) // })
} else { } else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
...@@ -848,7 +946,7 @@ export default class SubHolding extends Component { ...@@ -848,7 +946,7 @@ export default class SubHolding extends Component {
} else { } else {
OPID = null OPID = null
} }
this.setState({OPID}, () => { this.setState({ OPID }, () => {
let payloadOI = { let payloadOI = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"operating_indicator_id": this.state.OPID, "operating_indicator_id": this.state.OPID,
...@@ -856,7 +954,7 @@ export default class SubHolding extends Component { ...@@ -856,7 +954,7 @@ export default class SubHolding extends Component {
"report_id": 21 "report_id": 21
} }
api.create().getReportOIMB(payloadOI).then(response => { api.create().getAllReportOI(payloadOI).then(response => {
// console.log(payload); // console.log(payload);
console.log(response); console.log(response);
let dataTable = [] let dataTable = []
...@@ -889,7 +987,19 @@ export default class SubHolding extends Component { ...@@ -889,7 +987,19 @@ export default class SubHolding extends Component {
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1), item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1), item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1), item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order item.order,
item.master_budget.monthly_january == "" ? item.master_budget.monthly_january : String(item.master_budget.monthly_january).indexOf(".") == -1 ? Number(item.master_budget.monthly_january) : Number(item.master_budget.monthly_january).toFixed(1),
item.master_budget.monthly_february == "" ? item.master_budget.monthly_february : String(item.master_budget.monthly_february).indexOf(".") == -1 ? Number(item.master_budget.monthly_february) : Number(item.master_budget.monthly_february).toFixed(1),
item.master_budget.monthly_march == "" ? item.master_budget.monthly_march : String(item.master_budget.monthly_march).indexOf(".") == -1 ? Number(item.master_budget.monthly_march) : Number(item.master_budget.monthly_march).toFixed(1),
item.master_budget.monthly_april == "" ? item.master_budget.monthly_april : String(item.master_budget.monthly_april).indexOf(".") == -1 ? Number(item.master_budget.monthly_april) : Number(item.master_budget.monthly_april).toFixed(1),
item.master_budget.monthly_may == "" ? item.master_budget.monthly_may : String(item.master_budget.monthly_may).indexOf(".") == -1 ? Number(item.master_budget.monthly_may) : Number(item.master_budget.monthly_may).toFixed(1),
item.master_budget.monthly_june == "" ? item.master_budget.monthly_june : String(item.master_budget.monthly_june).indexOf(".") == -1 ? Number(item.master_budget.monthly_june) : Number(item.master_budget.monthly_june).toFixed(1),
item.master_budget.monthly_july == "" ? item.master_budget.monthly_july : String(item.master_budget.monthly_july).indexOf(".") == -1 ? Number(item.master_budget.monthly_july) : Number(item.master_budget.monthly_july).toFixed(1),
item.master_budget.monthly_august == "" ? item.master_budget.monthly_august : String(item.master_budget.monthly_august).indexOf(".") == -1 ? Number(item.master_budget.monthly_august) : Number(item.master_budget.monthly_august).toFixed(1),
item.master_budget.monthly_september == "" ? item.master_budget.monthly_september : String(item.master_budget.monthly_september).indexOf(".") == -1 ? Number(item.master_budget.monthly_september) : Number(item.master_budget.monthly_september).toFixed(1),
item.master_budget.monthly_october == "" ? item.master_budget.monthly_october : String(item.master_budget.monthly_october).indexOf(".") == -1 ? Number(item.master_budget.monthly_october) : Number(item.master_budget.monthly_october).toFixed(1),
item.master_budget.monthly_november == "" ? item.master_budget.monthly_november : String(item.master_budget.monthly_november).indexOf(".") == -1 ? Number(item.master_budget.monthly_november) : Number(item.master_budget.monthly_november).toFixed(1),
item.master_budget.monthly_december == "" ? item.master_budget.monthly_december : String(item.master_budget.monthly_december).indexOf(".") == -1 ? Number(item.master_budget.monthly_december) : Number(item.master_budget.monthly_december).toFixed(1),
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -923,7 +1033,19 @@ export default class SubHolding extends Component { ...@@ -923,7 +1033,19 @@ export default class SubHolding extends Component {
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1), item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1), item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1), item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
item.order item.order,
item.master_budget.monthly_january == "" ? item.master_budget.monthly_january : String(item.master_budget.monthly_january).indexOf(".") == -1 ? Number(item.master_budget.monthly_january) : Number(item.master_budget.monthly_january).toFixed(1),
item.master_budget.monthly_february == "" ? item.master_budget.monthly_february : String(item.master_budget.monthly_february).indexOf(".") == -1 ? Number(item.master_budget.monthly_february) : Number(item.master_budget.monthly_february).toFixed(1),
item.master_budget.monthly_march == "" ? item.master_budget.monthly_march : String(item.master_budget.monthly_march).indexOf(".") == -1 ? Number(item.master_budget.monthly_march) : Number(item.master_budget.monthly_march).toFixed(1),
item.master_budget.monthly_april == "" ? item.master_budget.monthly_april : String(item.master_budget.monthly_april).indexOf(".") == -1 ? Number(item.master_budget.monthly_april) : Number(item.master_budget.monthly_april).toFixed(1),
item.master_budget.monthly_may == "" ? item.master_budget.monthly_may : String(item.master_budget.monthly_may).indexOf(".") == -1 ? Number(item.master_budget.monthly_may) : Number(item.master_budget.monthly_may).toFixed(1),
item.master_budget.monthly_june == "" ? item.master_budget.monthly_june : String(item.master_budget.monthly_june).indexOf(".") == -1 ? Number(item.master_budget.monthly_june) : Number(item.master_budget.monthly_june).toFixed(1),
item.master_budget.monthly_july == "" ? item.master_budget.monthly_july : String(item.master_budget.monthly_july).indexOf(".") == -1 ? Number(item.master_budget.monthly_july) : Number(item.master_budget.monthly_july).toFixed(1),
item.master_budget.monthly_august == "" ? item.master_budget.monthly_august : String(item.master_budget.monthly_august).indexOf(".") == -1 ? Number(item.master_budget.monthly_august) : Number(item.master_budget.monthly_august).toFixed(1),
item.master_budget.monthly_september == "" ? item.master_budget.monthly_september : String(item.master_budget.monthly_september).indexOf(".") == -1 ? Number(item.master_budget.monthly_september) : Number(item.master_budget.monthly_september).toFixed(1),
item.master_budget.monthly_october == "" ? item.master_budget.monthly_october : String(item.master_budget.monthly_october).indexOf(".") == -1 ? Number(item.master_budget.monthly_october) : Number(item.master_budget.monthly_october).toFixed(1),
item.master_budget.monthly_november == "" ? item.master_budget.monthly_november : String(item.master_budget.monthly_november).indexOf(".") == -1 ? Number(item.master_budget.monthly_november) : Number(item.master_budget.monthly_november).toFixed(1),
item.master_budget.monthly_december == "" ? item.master_budget.monthly_december : String(item.master_budget.monthly_december).indexOf(".") == -1 ? Number(item.master_budget.monthly_december) : Number(item.master_budget.monthly_december).toFixed(1),
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -933,10 +1055,12 @@ export default class SubHolding extends Component { ...@@ -933,10 +1055,12 @@ export default class SubHolding extends Component {
} }
} }
}) })
this.setState({ dataTable }, () => { this.setState({ dataTable, previewTable: true, loading: false, previewDownload: false })
console.log(this.state.dataTable)
this.getOIMR(payloadOI) // this.setState({ dataTable }, () => {
}) // console.log(this.state.dataTable)
// this.getOIMR(payloadOI)
// })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -956,7 +1080,7 @@ export default class SubHolding extends Component { ...@@ -956,7 +1080,7 @@ export default class SubHolding extends Component {
}) })
} else if (this.state.report.value === 6) { } else if (this.state.report.value === 6) {
let dbSumaCF = [] let dbSumaCF = []
let paylodCF = {...payload, months: this.state.month.month_id} let paylodCF = { ...payload, months: this.state.month.month_id }
api.create().getReportCFSuma(paylodCF).then(response => { api.create().getReportCFSuma(paylodCF).then(response => {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
...@@ -965,41 +1089,41 @@ export default class SubHolding extends Component { ...@@ -965,41 +1089,41 @@ export default class SubHolding extends Component {
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dbSumaCF.findIndex((val) => val[1] === item.id) let indexIDzz = dbSumaCF.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let mtd_actual = item.cash_flow.mtd_actual == ''? 0 : item.cash_flow.mtd_actual 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 mtd = item.cash_flow.mtd == '' ? 0 : item.cash_flow.mtd
let persenMtd = Number(mtd_actual/mtd) let persenMtd = Number(mtd_actual / mtd)
let ytd_actual = item.cash_flow.ytd_actual == ''? 0 : item.cash_flow.ytd_actual 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 ytd = item.cash_flow.ytd == '' ? 0 : item.cash_flow.ytd
let persenYtd = Number(ytd_actual/ytd) let persenYtd = Number(ytd_actual / ytd)
let quarter_actual = item.cash_flow.quarter_actual == ''? 0 : item.cash_flow.quarter_actual 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 let quarter = item.cash_flow.quarter == '' ? 0 : item.cash_flow.quarter
let persenQuarter = Number(quarter_actual/quarter) let persenQuarter = Number(quarter_actual / quarter)
let fy_actual = item.cash_flow.fy_actual == ''? 0 : item.cash_flow.fy_actual let fy_actual = item.cash_flow.fy_actual == '' ? 0 : item.cash_flow.fy_actual
let fy = item.cash_flow.fy == ''? 0 : item.cash_flow.fy let fy = item.cash_flow.fy == '' ? 0 : item.cash_flow.fy
let persenFy = Number(fy_actual/fy) let persenFy = Number(fy_actual / fy)
dbSumaCF.push([ dbSumaCF.push([
item.id, item.id,
item.cash_flow.mtd_actual, item.cash_flow.mtd_actual,
item.cash_flow.mtd, item.cash_flow.mtd,
isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity'? (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0? -0 : 0) : (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0? persenMtd * -100 : persenMtd * 100), isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity' ? (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0 ? -0 : 0) : (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0 ? persenMtd * -100 : persenMtd * 100),
item.cash_flow.mtd_last_year, item.cash_flow.mtd_last_year,
item.cash_flow.ytd_actual, item.cash_flow.ytd_actual,
item.cash_flow.ytd, item.cash_flow.ytd,
isNaN(persenYtd) || persenYtd == 'Infinity' || persenYtd == '-Infinity'? (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0? -0 : 0) : (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0? persenYtd * -100 : persenYtd * 100), isNaN(persenYtd) || persenYtd == 'Infinity' || persenYtd == '-Infinity' ? (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0 ? -0 : 0) : (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0 ? persenYtd * -100 : persenYtd * 100),
// isNaN(persenYtd)? 0 : persenYtd * 100, // isNaN(persenYtd)? 0 : persenYtd * 100,
item.cash_flow.ytd_last_year, item.cash_flow.ytd_last_year,
item.cash_flow.quarter_actual, item.cash_flow.quarter_actual,
item.cash_flow.quarter, item.cash_flow.quarter,
isNaN(persenQuarter) || persenQuarter == 'Infinity' || persenQuarter == '-Infinity'? (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0? -0 : 0) : (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0? persenQuarter * -100 : persenQuarter * 100), isNaN(persenQuarter) || persenQuarter == 'Infinity' || persenQuarter == '-Infinity' ? (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0 ? -0 : 0) : (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0 ? persenQuarter * -100 : persenQuarter * 100),
// isNaN(persenQuarter)? 0 : persenQuarter * 100, // isNaN(persenQuarter)? 0 : persenQuarter * 100,
item.cash_flow.quarter_last_year, item.cash_flow.quarter_last_year,
item.cash_flow.fy_actual, item.cash_flow.fy_actual,
item.cash_flow.fy, item.cash_flow.fy,
isNaN(persenFy) || persenFy == 'Infinity' || persenFy == '-Infinity'? (item.cash_flow.fy == '' || item.cash_flow.fy == 0? -0 : 0) : (item.cash_flow.fy == '' || item.cash_flow.fy == 0? persenFy * -100 : persenFy * 100), isNaN(persenFy) || persenFy == 'Infinity' || persenFy == '-Infinity' ? (item.cash_flow.fy == '' || item.cash_flow.fy == 0 ? -0 : 0) : (item.cash_flow.fy == '' || item.cash_flow.fy == 0 ? persenFy * -100 : persenFy * 100),
// isNaN(persenFy)? 0 : persenFy * 100, // isNaN(persenFy)? 0 : persenFy * 100,
item.cash_flow.fy_last_year, item.cash_flow.fy_last_year,
]) ])
...@@ -1012,42 +1136,42 @@ export default class SubHolding extends Component { ...@@ -1012,42 +1136,42 @@ export default class SubHolding extends Component {
} }
} }
} }
res.map((item,index) => { res.map((item, index) => {
let mtd_actual = item.cash_flow.mtd_actual == ''? 0 : item.cash_flow.mtd_actual 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 mtd = item.cash_flow.mtd == '' ? 0 : item.cash_flow.mtd
let persenMtd = Number(mtd_actual/mtd) let persenMtd = Number(mtd_actual / mtd)
console.log(persenMtd) console.log(persenMtd)
let ytd_actual = item.cash_flow.ytd_actual == ''? 0 : item.cash_flow.ytd_actual 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 ytd = item.cash_flow.ytd == '' ? 0 : item.cash_flow.ytd
let persenYtd = Number(ytd_actual/ytd) let persenYtd = Number(ytd_actual / ytd)
let quarter_actual = item.cash_flow.quarter_actual == ''? 0 : item.cash_flow.quarter_actual 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 let quarter = item.cash_flow.quarter == '' ? 0 : item.cash_flow.quarter
let persenQuarter = Number(quarter_actual/quarter) let persenQuarter = Number(quarter_actual / quarter)
let fy_actual = item.cash_flow.fy_actual == ''? 0 : item.cash_flow.fy_actual let fy_actual = item.cash_flow.fy_actual == '' ? 0 : item.cash_flow.fy_actual
let fy = item.cash_flow.fy == ''? 0 : item.cash_flow.fy let fy = item.cash_flow.fy == '' ? 0 : item.cash_flow.fy
let persenFy = Number(fy_actual/fy) let persenFy = Number(fy_actual / fy)
dbSumaCF.push([ dbSumaCF.push([
item.id, item.id,
item.cash_flow.mtd_actual, item.cash_flow.mtd_actual,
item.cash_flow.mtd, item.cash_flow.mtd,
isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity'? (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0? -0 : 0) : (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0? persenMtd * -100 : persenMtd * 100), isNaN(persenMtd) || persenMtd == 'Infinity' || persenMtd == '-Infinity' ? (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0 ? -0 : 0) : (item.cash_flow.mtd == '' || item.cash_flow.mtd == 0 ? persenMtd * -100 : persenMtd * 100),
item.cash_flow.mtd_last_year, item.cash_flow.mtd_last_year,
item.cash_flow.ytd_actual, item.cash_flow.ytd_actual,
item.cash_flow.ytd, item.cash_flow.ytd,
isNaN(persenYtd) || persenYtd == 'Infinity' || persenYtd == '-Infinity'? (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0? -0 : 0) : (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0? persenYtd * -100 : persenYtd * 100), isNaN(persenYtd) || persenYtd == 'Infinity' || persenYtd == '-Infinity' ? (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0 ? -0 : 0) : (item.cash_flow.ytd == '' || item.cash_flow.ytd == 0 ? persenYtd * -100 : persenYtd * 100),
// isNaN(persenYtd)? 0 : persenYtd * 100, // isNaN(persenYtd)? 0 : persenYtd * 100,
item.cash_flow.ytd_last_year, item.cash_flow.ytd_last_year,
item.cash_flow.quarter_actual, item.cash_flow.quarter_actual,
item.cash_flow.quarter, item.cash_flow.quarter,
isNaN(persenQuarter) || persenQuarter == 'Infinity' || persenQuarter == '-Infinity'? (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0? -0 : 0) : (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0? persenQuarter * -100 : persenQuarter * 100), isNaN(persenQuarter) || persenQuarter == 'Infinity' || persenQuarter == '-Infinity' ? (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0 ? -0 : 0) : (item.cash_flow.quarter == '' || item.cash_flow.quarter == 0 ? persenQuarter * -100 : persenQuarter * 100),
// isNaN(persenQuarter)? 0 : persenQuarter * 100, // isNaN(persenQuarter)? 0 : persenQuarter * 100,
item.cash_flow.quarter_last_year, item.cash_flow.quarter_last_year,
item.cash_flow.fy_actual, item.cash_flow.fy_actual,
item.cash_flow.fy, item.cash_flow.fy,
isNaN(persenFy) || persenFy == 'Infinity' || persenFy == '-Infinity'? (item.cash_flow.fy == '' || item.cash_flow.fy == 0? -0 : 0) : (item.cash_flow.fy == '' || item.cash_flow.fy == 0? persenFy * -100 : persenFy * 100), isNaN(persenFy) || persenFy == 'Infinity' || persenFy == '-Infinity' ? (item.cash_flow.fy == '' || item.cash_flow.fy == 0 ? -0 : 0) : (item.cash_flow.fy == '' || item.cash_flow.fy == 0 ? persenFy * -100 : persenFy * 100),
// isNaN(persenFy)? 0 : persenFy * 100, // isNaN(persenFy)? 0 : persenFy * 100,
item.cash_flow.fy_last_year, item.cash_flow.fy_last_year,
]) ])
...@@ -1060,7 +1184,7 @@ export default class SubHolding extends Component { ...@@ -1060,7 +1184,7 @@ export default class SubHolding extends Component {
} }
}) })
console.log(dbSumaCF) console.log(dbSumaCF)
this.setState({dbSumaCF}, () => { this.setState({ dbSumaCF }, () => {
api.create().getReportCFSumaMB(payload).then(response => { api.create().getReportCFSumaMB(payload).then(response => {
// console.log(payload); // console.log(payload);
console.log(response); console.log(response);
...@@ -1353,7 +1477,7 @@ export default class SubHolding extends Component { ...@@ -1353,7 +1477,7 @@ export default class SubHolding extends Component {
this.setState({ previewTable: true, loading: false, previewDownload: false }) this.setState({ previewTable: true, loading: false, previewDownload: false })
}) })
} else if (this.state.report.value === 9) { } else if (this.state.report.value === 9) {
let paylodFR = {...payload, months: this.state.month.month_id} let paylodFR = { ...payload, months: this.state.month.month_id }
api.create().getReportFRMB(paylodFR).then(response => { api.create().getReportFRMB(paylodFR).then(response => {
console.log(payload); console.log(payload);
console.log(response); console.log(response);
...@@ -1485,7 +1609,7 @@ export default class SubHolding extends Component { ...@@ -1485,7 +1609,7 @@ export default class SubHolding extends Component {
} }
getCFSumaMR(payload, dbSumaCF) { getCFSumaMR(payload, dbSumaCF) {
let payloadLast = {...payload, "periode": Number(this.state.periode.periode) - 1} let payloadLast = { ...payload, "periode": Number(this.state.periode.periode) - 1 }
// let payloadLast = { // let payloadLast = {
// "report_id": this.state.report.value, // "report_id": this.state.report.value,
// "revision": this.state.revisionType, // "revision": this.state.revisionType,
...@@ -1501,7 +1625,7 @@ export default class SubHolding extends Component { ...@@ -1501,7 +1625,7 @@ export default class SubHolding extends Component {
let dataTable2 = [] let dataTable2 = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.id) let indexID = dataTable.findIndex((val) => val[1] == item.id)
if (indexID != -1) { if (indexID != -1) {
const handlePushChild = (items) => { const handlePushChild = (items) => {
...@@ -1578,7 +1702,7 @@ export default class SubHolding extends Component { ...@@ -1578,7 +1702,7 @@ export default class SubHolding extends Component {
let dataTable3 = [] let dataTable3 = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id) let indexID = dataTable2.findIndex((val) => val[1] == item.id)
let indexIDSuma = dbSumaCF.findIndex((val) => val[0] == item.id) let indexIDSuma = dbSumaCF.findIndex((val) => val[0] == item.id)
if (indexID != -1) { if (indexID != -1) {
...@@ -1646,81 +1770,6 @@ export default class SubHolding extends Component { ...@@ -1646,81 +1770,6 @@ export default class SubHolding extends Component {
}) })
} }
getOIMR(payload) {
// let payloadOI = {...payload, "periode": Number(this.state.periode.periode) - 1}
api.create().getReportOIMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = this.state.dataTable
let dataTable2 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz],
items.master_budget.january == "" ? items.master_budget.january : String(items.master_budget.january).indexOf(".") == -1 ? Number(items.master_budget.january) : Number(items.master_budget.january).toFixed(1),
items.master_budget.february == "" ? items.master_budget.february : String(items.master_budget.february).indexOf(".") == -1 ? Number(items.master_budget.february) : Number(items.master_budget.february).toFixed(1),
items.master_budget.march == "" ? items.master_budget.march : String(items.master_budget.march).indexOf(".") == -1 ? Number(items.master_budget.march) : Number(items.master_budget.march).toFixed(1),
items.master_budget.april == "" ? items.master_budget.april : String(items.master_budget.april).indexOf(".") == -1 ? Number(items.master_budget.april) : Number(items.master_budget.april).toFixed(1),
items.master_budget.may == "" ? items.master_budget.may : String(items.master_budget.may).indexOf(".") == -1 ? Number(items.master_budget.may) : Number(items.master_budget.may).toFixed(1),
items.master_budget.june == "" ? items.master_budget.june : String(items.master_budget.june).indexOf(".") == -1 ? Number(items.master_budget.june) : Number(items.master_budget.june).toFixed(1),
items.master_budget.july == "" ? items.master_budget.july : String(items.master_budget.july).indexOf(".") == -1 ? Number(items.master_budget.july) : Number(items.master_budget.july).toFixed(1),
items.master_budget.august == "" ? items.master_budget.august : String(items.master_budget.august).indexOf(".") == -1 ? Number(items.master_budget.august) : Number(items.master_budget.august).toFixed(1),
items.master_budget.september == "" ? items.master_budget.september : String(items.master_budget.september).indexOf(".") == -1 ? Number(items.master_budget.september) : Number(items.master_budget.september).toFixed(1),
items.master_budget.october == "" ? items.master_budget.october : String(items.master_budget.october).indexOf(".") == -1 ? Number(items.master_budget.october) : Number(items.master_budget.october).toFixed(1),
items.master_budget.november == "" ? items.master_budget.november : String(items.master_budget.november).indexOf(".") == -1 ? Number(items.master_budget.november) : Number(items.master_budget.november).toFixed(1),
items.master_budget.december == "" ? items.master_budget.december : String(items.master_budget.december).indexOf(".") == -1 ? Number(items.master_budget.december) : Number(items.master_budget.december).toFixed(1),
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
console.log(dataTable2)
this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: false })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getTaxPlanMR(payload) { getTaxPlanMR(payload) {
api.create().getReportTPMR(payload).then(response => { api.create().getReportTPMR(payload).then(response => {
console.log(payload); console.log(payload);
...@@ -1730,7 +1779,7 @@ export default class SubHolding extends Component { ...@@ -1730,7 +1779,7 @@ export default class SubHolding extends Component {
let dataTable2 = [] let dataTable2 = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable.findIndex((val) => val[4] == item.id) let indexID = dataTable.findIndex((val) => val[4] == item.id)
console.log(indexID) console.log(indexID)
if (indexID != -1) { if (indexID != -1) {
...@@ -1802,163 +1851,6 @@ export default class SubHolding extends Component { ...@@ -1802,163 +1851,6 @@ export default class SubHolding extends Component {
}) })
} }
getBalanceSheetMR(payload) {
let payloadLast = {
"report_id": this.state.report.value,
"revision": this.state.revisionType,
"periode": Number(this.state.periode.periode) - 1,
"company_id": this.state.company.company_id,
"submission_id": this.state.submissionID
}
api.create().getReportBSMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = this.state.dataTable
let dataTable2 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz],
Number(items.balance_sheet.january).toFixed(1),
Number(items.balance_sheet.february).toFixed(1),
Number(items.balance_sheet.march).toFixed(1),
Number(items.balance_sheet.april).toFixed(1),
Number(items.balance_sheet.may).toFixed(1),
Number(items.balance_sheet.june).toFixed(1),
Number(items.balance_sheet.july).toFixed(1),
Number(items.balance_sheet.august).toFixed(1),
Number(items.balance_sheet.september).toFixed(1),
Number(items.balance_sheet.october).toFixed(1),
Number(items.balance_sheet.november).toFixed(1),
Number(items.balance_sheet.december).toFixed(1),
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
Number(item.balance_sheet.january).toFixed(1),
Number(item.balance_sheet.february).toFixed(1),
Number(item.balance_sheet.march).toFixed(1),
Number(item.balance_sheet.april).toFixed(1),
Number(item.balance_sheet.may).toFixed(1),
Number(item.balance_sheet.june).toFixed(1),
Number(item.balance_sheet.july).toFixed(1),
Number(item.balance_sheet.august).toFixed(1),
Number(item.balance_sheet.september).toFixed(1),
Number(item.balance_sheet.october).toFixed(1),
Number(item.balance_sheet.november).toFixed(1),
Number(item.balance_sheet.december).toFixed(1),
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
console.log(dataTable2)
// this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable2 }, () => {
// console.log(this.state.dataTable2)
this.getBalanceSheetLastMR(payloadLast)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getBalanceSheetLastMR(payload) {
api.create().getReportBSMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable2 = this.state.dataTable2
let dataTable3 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable2.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable3.push([...dataTable2[indexIDzz],
Number(items.balance_sheet.january).toFixed(1),
Number(items.balance_sheet.february).toFixed(1),
Number(items.balance_sheet.march).toFixed(1),
Number(items.balance_sheet.april).toFixed(1),
Number(items.balance_sheet.may).toFixed(1),
Number(items.balance_sheet.june).toFixed(1),
Number(items.balance_sheet.july).toFixed(1),
Number(items.balance_sheet.august).toFixed(1),
Number(items.balance_sheet.september).toFixed(1),
Number(items.balance_sheet.october).toFixed(1),
Number(items.balance_sheet.november).toFixed(1),
Number(items.balance_sheet.december).toFixed(1),
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable3.push([...dataTable2[indexID],
Number(item.balance_sheet.january).toFixed(1),
Number(item.balance_sheet.february).toFixed(1),
Number(item.balance_sheet.march).toFixed(1),
Number(item.balance_sheet.april).toFixed(1),
Number(item.balance_sheet.may).toFixed(1),
Number(item.balance_sheet.june).toFixed(1),
Number(item.balance_sheet.july).toFixed(1),
Number(item.balance_sheet.august).toFixed(1),
Number(item.balance_sheet.september).toFixed(1),
Number(item.balance_sheet.october).toFixed(1),
Number(item.balance_sheet.november).toFixed(1),
Number(item.balance_sheet.december).toFixed(1),
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
console.log(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getReportPLMR(payload) { getReportPLMR(payload) {
let payloadLast = { let payloadLast = {
"report_id": this.state.report.value, "report_id": this.state.report.value,
...@@ -1974,7 +1866,7 @@ export default class SubHolding extends Component { ...@@ -1974,7 +1866,7 @@ export default class SubHolding extends Component {
let dataTable2 = [] let dataTable2 = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.id) let indexID = dataTable.findIndex((val) => val[1] == item.id)
if (indexID != -1) { if (indexID != -1) {
const handlePushChild = (items) => { const handlePushChild = (items) => {
...@@ -2053,7 +1945,7 @@ export default class SubHolding extends Component { ...@@ -2053,7 +1945,7 @@ export default class SubHolding extends Component {
let dataTable3 = [] let dataTable3 = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id) let indexID = dataTable2.findIndex((val) => val[1] == item.id)
if (indexID != -1) { if (indexID != -1) {
const handlePushChild = (items) => { const handlePushChild = (items) => {
...@@ -2118,163 +2010,6 @@ export default class SubHolding extends Component { ...@@ -2118,163 +2010,6 @@ export default class SubHolding extends Component {
}) })
} }
getPLDetailMR(payload) {
let payloadLast = {
"report_id": this.state.report.value,
"revision": this.state.revisionType,
"periode": Number(this.state.periode.periode) - 1,
"company_id": this.state.company.company_id,
"submission_id": this.state.submissionID
}
api.create().getReportPLDetailMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = this.state.dataTable
let dataTable2 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz],
items.profit_loss.january,
items.profit_loss.february,
items.profit_loss.march,
items.profit_loss.april,
items.profit_loss.may,
items.profit_loss.june,
items.profit_loss.july,
items.profit_loss.august,
items.profit_loss.september,
items.profit_loss.october,
items.profit_loss.november,
items.profit_loss.december,
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
item.profit_loss.january,
item.profit_loss.february,
item.profit_loss.march,
item.profit_loss.april,
item.profit_loss.may,
item.profit_loss.june,
item.profit_loss.july,
item.profit_loss.august,
item.profit_loss.september,
item.profit_loss.october,
item.profit_loss.november,
item.profit_loss.december,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
console.log(dataTable2)
// this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable2 }, () => {
// console.log(this.state.dataTable2)
this.getPLDetailLastMR(payloadLast)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getPLDetailLastMR(payload) {
api.create().getReportPLDetailMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable2 = this.state.dataTable2
let dataTable3 = []
if (response.data) {
let res = response.data.data
res.map((item,index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id)
if (indexID != -1) {
const handlePushChild = (items) => {
let indexIDzz = dataTable2.findIndex((val) => val[1] === items.id)
// console.log(indexIDzz)
if (indexIDzz != -1) {
dataTable3.push([...dataTable2[indexIDzz],
items.profit_loss.january,
items.profit_loss.february,
items.profit_loss.march,
items.profit_loss.april,
items.profit_loss.may,
items.profit_loss.june,
items.profit_loss.july,
items.profit_loss.august,
items.profit_loss.september,
items.profit_loss.october,
items.profit_loss.november,
items.profit_loss.december,
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable3.push([...dataTable2[indexID],
item.profit_loss.january,
item.profit_loss.february,
item.profit_loss.march,
item.profit_loss.april,
item.profit_loss.may,
item.profit_loss.june,
item.profit_loss.july,
item.profit_loss.august,
item.profit_loss.september,
item.profit_loss.october,
item.profit_loss.november,
item.profit_loss.december,
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
})
console.log(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getRatioMR(payload) { getRatioMR(payload) {
let payloadLast = { let payloadLast = {
"report_id": this.state.report.value, "report_id": this.state.report.value,
...@@ -2291,7 +2026,7 @@ export default class SubHolding extends Component { ...@@ -2291,7 +2026,7 @@ export default class SubHolding extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable.findIndex((val) => val[1] == item.id) let indexID = dataTable.findIndex((val) => val[1] == item.id)
if (indexID != -1) { if (indexID != -1) {
const handlePushChild = (items) => { const handlePushChild = (items) => {
...@@ -2379,7 +2114,7 @@ export default class SubHolding extends Component { ...@@ -2379,7 +2114,7 @@ export default class SubHolding extends Component {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let res = response.data.data let res = response.data.data
res.map((item,index) => { res.map((item, index) => {
let indexID = dataTable2.findIndex((val) => val[1] == item.id) let indexID = dataTable2.findIndex((val) => val[1] == item.id)
if (indexID != -1) { if (indexID != -1) {
const handlePushChild = (items) => { const handlePushChild = (items) => {
...@@ -2548,7 +2283,7 @@ export default class SubHolding extends Component { ...@@ -2548,7 +2283,7 @@ export default class SubHolding extends Component {
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Sub Holding</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Sub Holding</Typography>
</div> </div>
<div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}> <div style={{ minWidth: 'max-content', padding: '20px 20px 0px 20px' }}>
<div style={{ marginTop: 15, display: 'flex'}}> <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
options={this.state.reportType} options={this.state.reportType}
getOptionLabel={(option) => titleCase(option.label)} getOptionLabel={(option) => titleCase(option.label)}
...@@ -2561,7 +2296,7 @@ export default class SubHolding extends Component { ...@@ -2561,7 +2296,7 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.report} value={this.state.report}
/> />
{this.state.report != null? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listMonths} {...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
id="months" id="months"
...@@ -2587,7 +2322,7 @@ export default class SubHolding extends Component { ...@@ -2587,7 +2322,7 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company} value={this.state.company}
/> />
{this.state.report != null? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listQuarter} {...this.state.listQuarter}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
id="quarter" id="quarter"
...@@ -2600,7 +2335,7 @@ export default class SubHolding extends Component { ...@@ -2600,7 +2335,7 @@ export default class SubHolding extends Component {
value={this.state.quarter} value={this.state.quarter}
/> : null : null} /> : null : null}
</div> </div>
<div style={{ marginTop: 15, display: 'flex'}}> <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
...@@ -2615,7 +2350,7 @@ export default class SubHolding extends Component { ...@@ -2615,7 +2350,7 @@ export default class SubHolding extends Component {
/>} />}
value={this.state.periode} value={this.state.periode}
/> />
{this.state.report != null? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listUom} {...this.state.listUom}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
id="uom" id="uom"
...@@ -2623,7 +2358,7 @@ export default class SubHolding extends Component { ...@@ -2623,7 +2358,7 @@ export default class SubHolding extends Component {
this.getReportType() this.getReportType()
})} })}
disableClearable disableClearable
style={{ width: 250, marginLeft: 10}} style={{ width: 250, marginLeft: 10 }}
renderInput={(params) => <TextField {...params} label="Uom" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Uom" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.uom} value={this.state.uom}
/> : null : null} /> : null : 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