Commit 2981e5e7 authored by d.arizona's avatar d.arizona

update

parent 8a0c59b0
...@@ -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,
...@@ -235,8 +235,8 @@ export default class SubHolding extends Component { ...@@ -235,8 +235,8 @@ export default class SubHolding extends Component {
// this.getPeriode() // this.getPeriode()
this.getReportType() this.getReportType()
// } else { // } else {
// this.getLastPeriod() // this.getLastPeriod()
// this.getPeriode() // this.getPeriode()
// } // }
}) })
} else { } else {
...@@ -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()
}) })
} }
...@@ -305,7 +305,7 @@ export default class SubHolding extends Component { ...@@ -305,7 +305,7 @@ export default class SubHolding extends Component {
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
}) })
} }
...@@ -821,7 +821,7 @@ export default class SubHolding extends Component { ...@@ -821,7 +821,7 @@ export default class SubHolding extends Component {
console.log(this.state.dataTable) console.log(this.state.dataTable)
this.getRatioMR(payload) this.getRatioMR(payload)
}) })
} 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -830,7 +830,7 @@ export default class SubHolding extends Component { ...@@ -830,7 +830,7 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -917,7 +917,7 @@ export default class SubHolding extends Component { ...@@ -917,7 +917,7 @@ export default class SubHolding extends Component {
this.setState({ dataTable }, () => { this.setState({ dataTable }, () => {
this.getTaxPlanMR(payload) this.getTaxPlanMR(payload)
}) })
} 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -926,7 +926,7 @@ export default class SubHolding extends Component { ...@@ -926,7 +926,7 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -944,16 +944,16 @@ export default class SubHolding extends Component { ...@@ -944,16 +944,16 @@ export default class SubHolding extends Component {
if (response.data.data) { if (response.data.data) {
OPID = response.data.data.operating_indicator_id OPID = response.data.data.operating_indicator_id
} 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,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
"report_id": 21 "report_id": 21
} }
api.create().getAllReportOI(payloadOI).then(response => { api.create().getAllReportOI(payloadOI).then(response => {
// console.log(payload); // console.log(payload);
console.log(response); console.log(response);
...@@ -1061,7 +1061,7 @@ export default class SubHolding extends Component { ...@@ -1061,7 +1061,7 @@ export default class SubHolding extends Component {
// console.log(this.state.dataTable) // console.log(this.state.dataTable)
// this.getOIMR(payloadOI) // 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -1070,7 +1070,7 @@ export default class SubHolding extends Component { ...@@ -1070,7 +1070,7 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -1078,52 +1078,52 @@ export default class SubHolding extends Component { ...@@ -1078,52 +1078,52 @@ 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') {
let res = response.data.data let res = response.data.data
console.log(res) console.log(res)
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,
]) ])
...@@ -1136,42 +1136,42 @@ export default class SubHolding extends Component { ...@@ -1136,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,
]) ])
...@@ -1184,7 +1184,7 @@ export default class SubHolding extends Component { ...@@ -1184,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);
...@@ -1192,7 +1192,7 @@ export default class SubHolding extends Component { ...@@ -1192,7 +1192,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
console.log(res) console.log(res)
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
...@@ -1274,7 +1274,7 @@ export default class SubHolding extends Component { ...@@ -1274,7 +1274,7 @@ export default class SubHolding extends Component {
console.log(this.state.dataTable) console.log(this.state.dataTable)
this.getCFSumaMR(paylodCF, dbSumaCF) this.getCFSumaMR(paylodCF, dbSumaCF)
}) })
} 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -1283,13 +1283,13 @@ export default class SubHolding extends Component { ...@@ -1283,13 +1283,13 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
}) })
}) })
} 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -1298,7 +1298,7 @@ export default class SubHolding extends Component { ...@@ -1298,7 +1298,7 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -1477,7 +1477,7 @@ export default class SubHolding extends Component { ...@@ -1477,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);
...@@ -1609,7 +1609,7 @@ export default class SubHolding extends Component { ...@@ -1609,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,
...@@ -1625,7 +1625,7 @@ export default class SubHolding extends Component { ...@@ -1625,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) => {
...@@ -1633,18 +1633,18 @@ export default class SubHolding extends Component { ...@@ -1633,18 +1633,18 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz], dataTable2.push([...dataTable[indexIDzz],
items.cash_flow.january, items.cash_flow.january,
items.cash_flow.february, items.cash_flow.february,
items.cash_flow.march, items.cash_flow.march,
items.cash_flow.april, items.cash_flow.april,
items.cash_flow.may, items.cash_flow.may,
items.cash_flow.june, items.cash_flow.june,
items.cash_flow.july, items.cash_flow.july,
items.cash_flow.august, items.cash_flow.august,
items.cash_flow.september, items.cash_flow.september,
items.cash_flow.october, items.cash_flow.october,
items.cash_flow.november, items.cash_flow.november,
items.cash_flow.december, items.cash_flow.december,
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -1657,18 +1657,18 @@ export default class SubHolding extends Component { ...@@ -1657,18 +1657,18 @@ export default class SubHolding extends Component {
} }
dataTable2.push([...dataTable[indexID], dataTable2.push([...dataTable[indexID],
item.cash_flow.january, item.cash_flow.january,
item.cash_flow.february, item.cash_flow.february,
item.cash_flow.march, item.cash_flow.march,
item.cash_flow.april, item.cash_flow.april,
item.cash_flow.may, item.cash_flow.may,
item.cash_flow.june, item.cash_flow.june,
item.cash_flow.july, item.cash_flow.july,
item.cash_flow.august, item.cash_flow.august,
item.cash_flow.september, item.cash_flow.september,
item.cash_flow.october, item.cash_flow.october,
item.cash_flow.november, item.cash_flow.november,
item.cash_flow.december, item.cash_flow.december,
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1678,9 +1678,9 @@ export default class SubHolding extends Component { ...@@ -1678,9 +1678,9 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
this.setState({ dataTable2 }, () => { this.setState({ dataTable2 }, () => {
// console.log(this.state.dataTable2) // console.log(this.state.dataTable2)
...@@ -1702,7 +1702,7 @@ export default class SubHolding extends Component { ...@@ -1702,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) {
...@@ -1711,19 +1711,19 @@ export default class SubHolding extends Component { ...@@ -1711,19 +1711,19 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable3.push([...dataTable2[indexIDzz], dataTable3.push([...dataTable2[indexIDzz],
items.cash_flow.january, items.cash_flow.january,
items.cash_flow.february, items.cash_flow.february,
items.cash_flow.march, items.cash_flow.march,
items.cash_flow.april, items.cash_flow.april,
items.cash_flow.may, items.cash_flow.may,
items.cash_flow.june, items.cash_flow.june,
items.cash_flow.july, items.cash_flow.july,
items.cash_flow.august, items.cash_flow.august,
items.cash_flow.september, items.cash_flow.september,
items.cash_flow.october, items.cash_flow.october,
items.cash_flow.november, items.cash_flow.november,
items.cash_flow.december, items.cash_flow.december,
...dbSumaCF[indexIDSuma] ...dbSumaCF[indexIDSuma]
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -1736,19 +1736,19 @@ export default class SubHolding extends Component { ...@@ -1736,19 +1736,19 @@ export default class SubHolding extends Component {
} }
dataTable3.push([...dataTable2[indexID], dataTable3.push([...dataTable2[indexID],
item.cash_flow.january, item.cash_flow.january,
item.cash_flow.february, item.cash_flow.february,
item.cash_flow.march, item.cash_flow.march,
item.cash_flow.april, item.cash_flow.april,
item.cash_flow.may, item.cash_flow.may,
item.cash_flow.june, item.cash_flow.june,
item.cash_flow.july, item.cash_flow.july,
item.cash_flow.august, item.cash_flow.august,
item.cash_flow.september, item.cash_flow.september,
item.cash_flow.october, item.cash_flow.october,
item.cash_flow.november, item.cash_flow.november,
item.cash_flow.december, item.cash_flow.december,
...dbSumaCF[indexIDSuma] ...dbSumaCF[indexIDSuma]
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1758,9 +1758,9 @@ export default class SubHolding extends Component { ...@@ -1758,9 +1758,9 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
console.log(dataTable3) console.log(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true }) this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
...@@ -1779,7 +1779,7 @@ export default class SubHolding extends Component { ...@@ -1779,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) {
...@@ -1788,19 +1788,19 @@ export default class SubHolding extends Component { ...@@ -1788,19 +1788,19 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz], dataTable2.push([...dataTable[indexIDzz],
Number(items.tax_planning_report.january).toFixed(1), Number(items.tax_planning_report.january).toFixed(1),
Number(items.tax_planning_report.february).toFixed(1), Number(items.tax_planning_report.february).toFixed(1),
Number(items.tax_planning_report.march).toFixed(1), Number(items.tax_planning_report.march).toFixed(1),
Number(items.tax_planning_report.april).toFixed(1), Number(items.tax_planning_report.april).toFixed(1),
Number(items.tax_planning_report.may).toFixed(1), Number(items.tax_planning_report.may).toFixed(1),
Number(items.tax_planning_report.june).toFixed(1), Number(items.tax_planning_report.june).toFixed(1),
Number(items.tax_planning_report.july).toFixed(1), Number(items.tax_planning_report.july).toFixed(1),
Number(items.tax_planning_report.august).toFixed(1), Number(items.tax_planning_report.august).toFixed(1),
Number(items.tax_planning_report.september).toFixed(1), Number(items.tax_planning_report.september).toFixed(1),
Number(items.tax_planning_report.october).toFixed(1), Number(items.tax_planning_report.october).toFixed(1),
Number(items.tax_planning_report.november).toFixed(1), Number(items.tax_planning_report.november).toFixed(1),
Number(items.tax_planning_report.december).toFixed(1), Number(items.tax_planning_report.december).toFixed(1),
Number(items.tax_planning_report.total_actual_before).toFixed(1), Number(items.tax_planning_report.total_actual_before).toFixed(1),
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -1813,19 +1813,19 @@ export default class SubHolding extends Component { ...@@ -1813,19 +1813,19 @@ export default class SubHolding extends Component {
} }
dataTable2.push([...dataTable[indexID], dataTable2.push([...dataTable[indexID],
Number(item.tax_planning_report.january).toFixed(1), Number(item.tax_planning_report.january).toFixed(1),
Number(item.tax_planning_report.february).toFixed(1), Number(item.tax_planning_report.february).toFixed(1),
Number(item.tax_planning_report.march).toFixed(1), Number(item.tax_planning_report.march).toFixed(1),
Number(item.tax_planning_report.april).toFixed(1), Number(item.tax_planning_report.april).toFixed(1),
Number(item.tax_planning_report.may).toFixed(1), Number(item.tax_planning_report.may).toFixed(1),
Number(item.tax_planning_report.june).toFixed(1), Number(item.tax_planning_report.june).toFixed(1),
Number(item.tax_planning_report.july).toFixed(1), Number(item.tax_planning_report.july).toFixed(1),
Number(item.tax_planning_report.august).toFixed(1), Number(item.tax_planning_report.august).toFixed(1),
Number(item.tax_planning_report.september).toFixed(1), Number(item.tax_planning_report.september).toFixed(1),
Number(item.tax_planning_report.october).toFixed(1), Number(item.tax_planning_report.october).toFixed(1),
Number(item.tax_planning_report.november).toFixed(1), Number(item.tax_planning_report.november).toFixed(1),
Number(item.tax_planning_report.december).toFixed(1), Number(item.tax_planning_report.december).toFixed(1),
Number(item.tax_planning_report.total_actual_before).toFixed(1), Number(item.tax_planning_report.total_actual_before).toFixed(1),
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -1835,9 +1835,9 @@ export default class SubHolding extends Component { ...@@ -1835,9 +1835,9 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
console.log(dataTable2) console.log(dataTable2)
this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true }) this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
...@@ -1866,7 +1866,7 @@ export default class SubHolding extends Component { ...@@ -1866,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) => {
...@@ -1874,19 +1874,19 @@ export default class SubHolding extends Component { ...@@ -1874,19 +1874,19 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz], dataTable2.push([...dataTable[indexIDzz],
items.formula, items.formula,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.january, formula: items.profit_detail.january_formula } : items.profit_detail.january, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.january, formula: items.profit_detail.january_formula } : items.profit_detail.january,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.february, formula: items.profit_detail.february_formula } : items.profit_detail.february, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.february, formula: items.profit_detail.february_formula } : items.profit_detail.february,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.march, formula: items.profit_detail.march_formula } : items.profit_detail.march, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.march, formula: items.profit_detail.march_formula } : items.profit_detail.march,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.april, formula: items.profit_detail.april_formula } : items.profit_detail.april, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.april, formula: items.profit_detail.april_formula } : items.profit_detail.april,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.may, formula: items.profit_detail.may_formula } : items.profit_detail.may, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.may, formula: items.profit_detail.may_formula } : items.profit_detail.may,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.june, formula: items.profit_detail.june_formula } : items.profit_detail.june, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.june, formula: items.profit_detail.june_formula } : items.profit_detail.june,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.july, formula: items.profit_detail.july_formula } : items.profit_detail.july, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.july, formula: items.profit_detail.july_formula } : items.profit_detail.july,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.august, formula: items.profit_detail.august_formula } : items.profit_detail.august, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.august, formula: items.profit_detail.august_formula } : items.profit_detail.august,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.september, formula: items.profit_detail.september_formula } : items.profit_detail.september, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.september, formula: items.profit_detail.september_formula } : items.profit_detail.september,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.october, formula: items.profit_detail.october_formula } : items.profit_detail.october, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.october, formula: items.profit_detail.october_formula } : items.profit_detail.october,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.november, formula: items.profit_detail.november_formula } : items.profit_detail.november, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.november, formula: items.profit_detail.november_formula } : items.profit_detail.november,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.december, formula: items.profit_detail.december_formula } : items.profit_detail.december, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.december, formula: items.profit_detail.december_formula } : items.profit_detail.december,
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -1899,19 +1899,19 @@ export default class SubHolding extends Component { ...@@ -1899,19 +1899,19 @@ export default class SubHolding extends Component {
} }
dataTable2.push([...dataTable[indexID], dataTable2.push([...dataTable[indexID],
item.formula, item.formula,
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.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.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.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.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.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.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.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.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.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.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.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, 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 !== null) {
...@@ -1921,9 +1921,9 @@ export default class SubHolding extends Component { ...@@ -1921,9 +1921,9 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
console.log(dataTable2) console.log(dataTable2)
// this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true }) // this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
...@@ -1945,7 +1945,7 @@ export default class SubHolding extends Component { ...@@ -1945,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) => {
...@@ -1953,18 +1953,18 @@ export default class SubHolding extends Component { ...@@ -1953,18 +1953,18 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable3.push([...dataTable2[indexIDzz], dataTable3.push([...dataTable2[indexIDzz],
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.january, formula: items.profit_detail.january_formula } : items.profit_detail.january, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.january, formula: items.profit_detail.january_formula } : items.profit_detail.january,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.february, formula: items.profit_detail.february_formula } : items.profit_detail.february, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.february, formula: items.profit_detail.february_formula } : items.profit_detail.february,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.march, formula: items.profit_detail.march_formula } : items.profit_detail.march, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.march, formula: items.profit_detail.march_formula } : items.profit_detail.march,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.april, formula: items.profit_detail.april_formula } : items.profit_detail.april, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.april, formula: items.profit_detail.april_formula } : items.profit_detail.april,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.may, formula: items.profit_detail.may_formula } : items.profit_detail.may, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.may, formula: items.profit_detail.may_formula } : items.profit_detail.may,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.june, formula: items.profit_detail.june_formula } : items.profit_detail.june, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.june, formula: items.profit_detail.june_formula } : items.profit_detail.june,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.july, formula: items.profit_detail.july_formula } : items.profit_detail.july, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.july, formula: items.profit_detail.july_formula } : items.profit_detail.july,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.august, formula: items.profit_detail.august_formula } : items.profit_detail.august, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.august, formula: items.profit_detail.august_formula } : items.profit_detail.august,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.september, formula: items.profit_detail.september_formula } : items.profit_detail.september, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.september, formula: items.profit_detail.september_formula } : items.profit_detail.september,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.october, formula: items.profit_detail.october_formula } : items.profit_detail.october, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.october, formula: items.profit_detail.october_formula } : items.profit_detail.october,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.november, formula: items.profit_detail.november_formula } : items.profit_detail.november, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.november, formula: items.profit_detail.november_formula } : items.profit_detail.november,
items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.december, formula: items.profit_detail.december_formula } : items.profit_detail.december, items.type_report_id == 5 || items.type_report_id == 6 || items.type_report_id == 7 ? { value: items.profit_detail.december, formula: items.profit_detail.december_formula } : items.profit_detail.december,
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -1977,18 +1977,18 @@ export default class SubHolding extends Component { ...@@ -1977,18 +1977,18 @@ export default class SubHolding extends Component {
} }
dataTable3.push([...dataTable2[indexID], 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.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.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.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.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.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.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.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.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.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.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.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, 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 !== null) {
...@@ -1998,9 +1998,9 @@ export default class SubHolding extends Component { ...@@ -1998,9 +1998,9 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
console.log(dataTable3) console.log(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true }) this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
...@@ -2026,7 +2026,7 @@ export default class SubHolding extends Component { ...@@ -2026,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) => {
...@@ -2034,18 +2034,18 @@ export default class SubHolding extends Component { ...@@ -2034,18 +2034,18 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable2.push([...dataTable[indexIDzz], dataTable2.push([...dataTable[indexIDzz],
Number(items.ratio.monthly_january).toFixed(2), Number(items.ratio.monthly_january).toFixed(2),
Number(items.ratio.monthly_february).toFixed(2), Number(items.ratio.monthly_february).toFixed(2),
Number(items.ratio.monthly_march).toFixed(2), Number(items.ratio.monthly_march).toFixed(2),
Number(items.ratio.monthly_april).toFixed(2), Number(items.ratio.monthly_april).toFixed(2),
Number(items.ratio.monthly_may).toFixed(2), Number(items.ratio.monthly_may).toFixed(2),
Number(items.ratio.monthly_june).toFixed(2), Number(items.ratio.monthly_june).toFixed(2),
Number(items.ratio.monthly_july).toFixed(2), Number(items.ratio.monthly_july).toFixed(2),
Number(items.ratio.monthly_august).toFixed(2), Number(items.ratio.monthly_august).toFixed(2),
Number(items.ratio.monthly_september).toFixed(2), Number(items.ratio.monthly_september).toFixed(2),
Number(items.ratio.monthly_october).toFixed(2), Number(items.ratio.monthly_october).toFixed(2),
Number(items.ratio.monthly_november).toFixed(2), Number(items.ratio.monthly_november).toFixed(2),
Number(items.ratio.monthly_december).toFixed(2), Number(items.ratio.monthly_december).toFixed(2),
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -2058,18 +2058,18 @@ export default class SubHolding extends Component { ...@@ -2058,18 +2058,18 @@ export default class SubHolding extends Component {
} }
dataTable2.push([...dataTable[indexID], dataTable2.push([...dataTable[indexID],
Number(item.ratio.monthly_january).toFixed(2), Number(item.ratio.monthly_january).toFixed(2),
Number(item.ratio.monthly_february).toFixed(2), Number(item.ratio.monthly_february).toFixed(2),
Number(item.ratio.monthly_march).toFixed(2), Number(item.ratio.monthly_march).toFixed(2),
Number(item.ratio.monthly_april).toFixed(2), Number(item.ratio.monthly_april).toFixed(2),
Number(item.ratio.monthly_may).toFixed(2), Number(item.ratio.monthly_may).toFixed(2),
Number(item.ratio.monthly_june).toFixed(2), Number(item.ratio.monthly_june).toFixed(2),
Number(item.ratio.monthly_july).toFixed(2), Number(item.ratio.monthly_july).toFixed(2),
Number(item.ratio.monthly_august).toFixed(2), Number(item.ratio.monthly_august).toFixed(2),
Number(item.ratio.monthly_september).toFixed(2), Number(item.ratio.monthly_september).toFixed(2),
Number(item.ratio.monthly_october).toFixed(2), Number(item.ratio.monthly_october).toFixed(2),
Number(item.ratio.monthly_november).toFixed(2), Number(item.ratio.monthly_november).toFixed(2),
Number(item.ratio.monthly_december).toFixed(2), Number(item.ratio.monthly_december).toFixed(2),
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -2079,9 +2079,9 @@ export default class SubHolding extends Component { ...@@ -2079,9 +2079,9 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
console.log(dataTable2) console.log(dataTable2)
// this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true }) // this.setState({ dataTable: dataTable2, previewTable: true, loading: false, previewDownload: true })
...@@ -2089,7 +2089,7 @@ export default class SubHolding extends Component { ...@@ -2089,7 +2089,7 @@ export default class SubHolding extends Component {
console.log(this.state.dataTable2) console.log(this.state.dataTable2)
this.getRatioLastMR(payloadLast) this.getRatioLastMR(payloadLast)
}) })
} 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -2098,7 +2098,7 @@ export default class SubHolding extends Component { ...@@ -2098,7 +2098,7 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -2114,7 +2114,7 @@ export default class SubHolding extends Component { ...@@ -2114,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) => {
...@@ -2122,18 +2122,18 @@ export default class SubHolding extends Component { ...@@ -2122,18 +2122,18 @@ export default class SubHolding extends Component {
// console.log(indexIDzz) // console.log(indexIDzz)
if (indexIDzz != -1) { if (indexIDzz != -1) {
dataTable3.push([...dataTable2[indexIDzz], dataTable3.push([...dataTable2[indexIDzz],
Number(items.ratio.monthly_january).toFixed(2), Number(items.ratio.monthly_january).toFixed(2),
Number(items.ratio.monthly_february).toFixed(2), Number(items.ratio.monthly_february).toFixed(2),
Number(items.ratio.monthly_march).toFixed(2), Number(items.ratio.monthly_march).toFixed(2),
Number(items.ratio.monthly_april).toFixed(2), Number(items.ratio.monthly_april).toFixed(2),
Number(items.ratio.monthly_may).toFixed(2), Number(items.ratio.monthly_may).toFixed(2),
Number(items.ratio.monthly_june).toFixed(2), Number(items.ratio.monthly_june).toFixed(2),
Number(items.ratio.monthly_july).toFixed(2), Number(items.ratio.monthly_july).toFixed(2),
Number(items.ratio.monthly_august).toFixed(2), Number(items.ratio.monthly_august).toFixed(2),
Number(items.ratio.monthly_september).toFixed(2), Number(items.ratio.monthly_september).toFixed(2),
Number(items.ratio.monthly_october).toFixed(2), Number(items.ratio.monthly_october).toFixed(2),
Number(items.ratio.monthly_november).toFixed(2), Number(items.ratio.monthly_november).toFixed(2),
Number(items.ratio.monthly_december).toFixed(2), Number(items.ratio.monthly_december).toFixed(2),
]) ])
} }
if (items.children !== null) { if (items.children !== null) {
...@@ -2146,18 +2146,18 @@ export default class SubHolding extends Component { ...@@ -2146,18 +2146,18 @@ export default class SubHolding extends Component {
} }
dataTable3.push([...dataTable2[indexID], dataTable3.push([...dataTable2[indexID],
Number(item.ratio.monthly_january).toFixed(2), Number(item.ratio.monthly_january).toFixed(2),
Number(item.ratio.monthly_february).toFixed(2), Number(item.ratio.monthly_february).toFixed(2),
Number(item.ratio.monthly_march).toFixed(2), Number(item.ratio.monthly_march).toFixed(2),
Number(item.ratio.monthly_april).toFixed(2), Number(item.ratio.monthly_april).toFixed(2),
Number(item.ratio.monthly_may).toFixed(2), Number(item.ratio.monthly_may).toFixed(2),
Number(item.ratio.monthly_june).toFixed(2), Number(item.ratio.monthly_june).toFixed(2),
Number(item.ratio.monthly_july).toFixed(2), Number(item.ratio.monthly_july).toFixed(2),
Number(item.ratio.monthly_august).toFixed(2), Number(item.ratio.monthly_august).toFixed(2),
Number(item.ratio.monthly_september).toFixed(2), Number(item.ratio.monthly_september).toFixed(2),
Number(item.ratio.monthly_october).toFixed(2), Number(item.ratio.monthly_october).toFixed(2),
Number(item.ratio.monthly_november).toFixed(2), Number(item.ratio.monthly_november).toFixed(2),
Number(item.ratio.monthly_december).toFixed(2), Number(item.ratio.monthly_december).toFixed(2),
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -2167,13 +2167,13 @@ export default class SubHolding extends Component { ...@@ -2167,13 +2167,13 @@ export default class SubHolding extends Component {
}) })
} }
} }
} }
}) })
console.log(dataTable3) console.log(dataTable3)
this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true }) this.setState({ dataTable: dataTable3, previewTable: true, loading: false, previewDownload: true })
} 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")) {
setTimeout(() => { setTimeout(() => {
...@@ -2182,7 +2182,7 @@ export default class SubHolding extends Component { ...@@ -2182,7 +2182,7 @@ export default class SubHolding extends Component {
}, 1000); }, 1000);
} }
}) })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
} }
...@@ -2283,7 +2283,7 @@ export default class SubHolding extends Component { ...@@ -2283,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)}
...@@ -2296,7 +2296,7 @@ export default class SubHolding extends Component { ...@@ -2296,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"
...@@ -2322,7 +2322,7 @@ export default class SubHolding extends Component { ...@@ -2322,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"
...@@ -2335,7 +2335,7 @@ export default class SubHolding extends Component { ...@@ -2335,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"
...@@ -2350,7 +2350,7 @@ export default class SubHolding extends Component { ...@@ -2350,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"
...@@ -2358,7 +2358,7 @@ export default class SubHolding extends Component { ...@@ -2358,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