Commit 07d96fb9 authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

subholding

See merge request !1014
parents 4dcb72c8 acdcfc12
......@@ -246,8 +246,8 @@ export default class SubHolding extends Component {
"submission_id": this.state.submissionID
}
if (this.state.report.value === 1) {
api.create().getDetailReportMB(payload).then(response => {
// console.log(response);
api.create().getReportPLDetailMB(payload).then(response => {
console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -323,7 +323,11 @@ export default class SubHolding extends Component {
}
})
// console.log(dataTable)
this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
// this.setState({ dataTable, previewTable: true, loading: false, previewDownload: true })
this.setState({ dataTable }, () => {
console.log(this.state.dataTable)
this.getPLDetailMR(payload)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......@@ -501,7 +505,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 }, () => {
console.log(this.state.dataTable)
this.getReportPLMR(payload)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
......@@ -643,7 +651,7 @@ export default class SubHolding extends Component {
"company_id": this.state.company.company_id,
"submission_id": this.state.submissionID
}
api.create().getReportBSMB(payload).then(response => {
api.create().getReportBSMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable = this.state.dataTable
......@@ -720,7 +728,7 @@ export default class SubHolding extends Component {
}
getBalanceSheetLastMR(payload) {
api.create().getReportBSMB(payload).then(response => {
api.create().getReportBSMR(payload).then(response => {
console.log(payload);
console.log(response);
let dataTable2 = this.state.dataTable2
......@@ -792,6 +800,320 @@ export default class SubHolding extends Component {
})
}
getReportPLMR(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().getReportPLMR(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],
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.december,
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable2.push([...dataTable[indexID],
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.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.getProfitLossLastMR(payloadLast)
})
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
}
})
}
getProfitLossLastMR(payload) {
api.create().getReportPLMR(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],
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.december,
])
}
if (items.children !== null) {
if (items.children.length > 0) {
items.children.map((itemss, indexss) => {
handlePushChild(itemss)
})
}
}
}
dataTable3.push([...dataTable2[indexID],
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.january, formula: item.profit_detail.january_formula } : item.profit_detail.january,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.february, formula: item.profit_detail.february_formula } : item.profit_detail.february,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.march, formula: item.profit_detail.march_formula } : item.profit_detail.march,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.april, formula: item.profit_detail.april_formula } : item.profit_detail.april,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.may, formula: item.profit_detail.may_formula } : item.profit_detail.may,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.june, formula: item.profit_detail.june_formula } : item.profit_detail.june,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.july, formula: item.profit_detail.july_formula } : item.profit_detail.july,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.august, formula: item.profit_detail.august_formula } : item.profit_detail.august,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.september, formula: item.profit_detail.september_formula } : item.profit_detail.september,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.october, formula: item.profit_detail.october_formula } : item.profit_detail.october,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.november, formula: item.profit_detail.november_formula } : item.profit_detail.november,
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: item.profit_detail.december, formula: item.profit_detail.december_formula } : item.profit_detail.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 })
}
})
}
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],
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 (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],
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 (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) {
let payloadLast = {
"report_id": this.state.report.value,
......
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