Commit 971ecd12 authored by idlanirined's avatar idlanirined

sub holdingggg

parent a2dac336
...@@ -22,9 +22,9 @@ export default class SubHolding extends Component { ...@@ -22,9 +22,9 @@ export default class SubHolding extends Component {
listPeriode: null, listPeriode: null,
periode: null, periode: null,
reportType: [ reportType: [
{ value: 1, label: 'DB Balance Sheet' }, { value: 2, label: 'DB Balance Sheet' },
{ value: 3, label: 'DB Profit & Loss' }, { value: 3, label: 'DB Profit & Loss' },
{ value: 2, label: 'DB Profit & Loss Detail' }, { value: 1, label: 'DB Profit & Loss Detail' },
{ value: 4, label: 'DB Ratio' }, { value: 4, label: 'DB Ratio' },
], ],
report: null, report: null,
...@@ -193,10 +193,10 @@ export default class SubHolding extends Component { ...@@ -193,10 +193,10 @@ export default class SubHolding extends Component {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"submission_id": this.state.submissionID "submission_id": this.state.submissionID
} }
if (this.state.report.value === 1) {
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
// console.log(response); // console.log(response);
let dataTable = [] let dataTable = []
if (this.state.report.value === 1) {
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
...@@ -209,25 +209,23 @@ export default class SubHolding extends Component { ...@@ -209,25 +209,23 @@ export default class SubHolding extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before, item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
Number(item.balance_sheet.january).toFixed(1), item.profit_loss.january,
Number(item.balance_sheet.february).toFixed(1), item.profit_loss.february,
Number(item.balance_sheet.march).toFixed(1), item.profit_loss.march,
Number(item.balance_sheet.april).toFixed(1), item.profit_loss.april,
Number(item.balance_sheet.may).toFixed(1), item.profit_loss.may,
Number(item.balance_sheet.june).toFixed(1), item.profit_loss.june,
Number(item.balance_sheet.july).toFixed(1), item.profit_loss.july,
Number(item.balance_sheet.august).toFixed(1), item.profit_loss.august,
Number(item.balance_sheet.september).toFixed(1), item.profit_loss.september,
Number(item.balance_sheet.october).toFixed(1), item.profit_loss.october,
Number(item.balance_sheet.november).toFixed(1), item.profit_loss.november,
Number(item.balance_sheet.december).toFixed(1), item.profit_loss.december,
Number(item.balance_sheet.total_current_year).toFixed(1), item.profit_loss.total_current_year,
Number(item.balance_sheet.total_next_year).toFixed(1), item.profit_loss.total_next_year,
Number(item.balance_sheet.total_more_year).toFixed(1), item.profit_loss.total_more_year,
item.order, item.order
item.condition_it_should_be,
item.condition_if_wrong
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -246,25 +244,23 @@ export default class SubHolding extends Component { ...@@ -246,25 +244,23 @@ export default class SubHolding extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before, item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
Number(item.balance_sheet.january).toFixed(1), item.profit_loss.january,
Number(item.balance_sheet.february).toFixed(1), item.profit_loss.february,
Number(item.balance_sheet.march).toFixed(1), item.profit_loss.march,
Number(item.balance_sheet.april).toFixed(1), item.profit_loss.april,
Number(item.balance_sheet.may).toFixed(1), item.profit_loss.may,
Number(item.balance_sheet.june).toFixed(1), item.profit_loss.june,
Number(item.balance_sheet.july).toFixed(1), item.profit_loss.july,
Number(item.balance_sheet.august).toFixed(1), item.profit_loss.august,
Number(item.balance_sheet.september).toFixed(1), item.profit_loss.september,
Number(item.balance_sheet.october).toFixed(1), item.profit_loss.october,
Number(item.balance_sheet.november).toFixed(1), item.profit_loss.november,
Number(item.balance_sheet.december).toFixed(1), item.profit_loss.december,
Number(item.balance_sheet.total_current_year).toFixed(1), item.profit_loss.total_current_year,
Number(item.balance_sheet.total_next_year).toFixed(1), item.profit_loss.total_next_year,
Number(item.balance_sheet.total_more_year).toFixed(1), item.profit_loss.total_more_year,
item.order, item.order
item.condition_it_should_be,
item.condition_if_wrong
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -274,11 +270,16 @@ export default class SubHolding extends Component { ...@@ -274,11 +270,16 @@ 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 })
} 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().getDetailReportMB(payload).then(response => {
// console.log(response);
let dataTable = []
if (response.data) { if (response.data) {
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
...@@ -291,23 +292,25 @@ export default class SubHolding extends Component { ...@@ -291,23 +292,25 @@ export default class SubHolding extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before, item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
item.profit_loss.january, Number(item.balance_sheet.january).toFixed(1),
item.profit_loss.february, Number(item.balance_sheet.february).toFixed(1),
item.profit_loss.march, Number(item.balance_sheet.march).toFixed(1),
item.profit_loss.april, Number(item.balance_sheet.april).toFixed(1),
item.profit_loss.may, Number(item.balance_sheet.may).toFixed(1),
item.profit_loss.june, Number(item.balance_sheet.june).toFixed(1),
item.profit_loss.july, Number(item.balance_sheet.july).toFixed(1),
item.profit_loss.august, Number(item.balance_sheet.august).toFixed(1),
item.profit_loss.september, Number(item.balance_sheet.september).toFixed(1),
item.profit_loss.october, Number(item.balance_sheet.october).toFixed(1),
item.profit_loss.november, Number(item.balance_sheet.november).toFixed(1),
item.profit_loss.december, Number(item.balance_sheet.december).toFixed(1),
item.profit_loss.total_current_year, Number(item.balance_sheet.total_current_year).toFixed(1),
item.profit_loss.total_next_year, Number(item.balance_sheet.total_next_year).toFixed(1),
item.profit_loss.total_more_year, Number(item.balance_sheet.total_more_year).toFixed(1),
item.order item.order,
item.condition_it_should_be,
item.condition_if_wrong
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -326,23 +329,25 @@ export default class SubHolding extends Component { ...@@ -326,23 +329,25 @@ export default class SubHolding extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before, item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
item.profit_loss.january, Number(item.balance_sheet.january).toFixed(1),
item.profit_loss.february, Number(item.balance_sheet.february).toFixed(1),
item.profit_loss.march, Number(item.balance_sheet.march).toFixed(1),
item.profit_loss.april, Number(item.balance_sheet.april).toFixed(1),
item.profit_loss.may, Number(item.balance_sheet.may).toFixed(1),
item.profit_loss.june, Number(item.balance_sheet.june).toFixed(1),
item.profit_loss.july, Number(item.balance_sheet.july).toFixed(1),
item.profit_loss.august, Number(item.balance_sheet.august).toFixed(1),
item.profit_loss.september, Number(item.balance_sheet.september).toFixed(1),
item.profit_loss.october, Number(item.balance_sheet.october).toFixed(1),
item.profit_loss.november, Number(item.balance_sheet.november).toFixed(1),
item.profit_loss.december, Number(item.balance_sheet.december).toFixed(1),
item.profit_loss.total_current_year, Number(item.balance_sheet.total_current_year).toFixed(1),
item.profit_loss.total_next_year, Number(item.balance_sheet.total_next_year).toFixed(1),
item.profit_loss.total_more_year, Number(item.balance_sheet.total_more_year).toFixed(1),
item.order item.order,
item.condition_it_should_be,
item.condition_if_wrong
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -352,13 +357,14 @@ export default class SubHolding extends Component { ...@@ -352,13 +357,14 @@ 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 })
} 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 === 3) { } else if (this.state.report.value === 3) {
api.create().getReportHierarkiPL(payload).then(response => { api.create().getReportHierarkiPL(payload).then(response => {
// console.log(response);
if (response.data) { if (response.data) {
let dataTable = [] let dataTable = []
console.log(response) console.log(response)
...@@ -443,10 +449,7 @@ export default class SubHolding extends Component { ...@@ -443,10 +449,7 @@ export default class SubHolding extends Component {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
}) })
} else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
})
} }
async downloadAllData() { async downloadAllData() {
...@@ -527,7 +530,7 @@ export default class SubHolding extends Component { ...@@ -527,7 +530,7 @@ export default class SubHolding extends Component {
options={this.state.reportType} options={this.state.reportType}
getOptionLabel={(option) => titleCase(option.label)} getOptionLabel={(option) => titleCase(option.label)}
id="typereport" id="typereport"
onChange={(event, newInputValue) => this.setState({ report: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ report: newInputValue, loading: true, previewTable: false }, () => {
this.getSubmission() this.getSubmission()
})} })}
disableClearable disableClearable
...@@ -541,7 +544,7 @@ export default class SubHolding extends Component { ...@@ -541,7 +544,7 @@ export default class SubHolding extends Component {
{...this.state.listCompany} {...this.state.listCompany}
id="company" id="company"
disabled={this.state.intent === 'Home' ? true : false} disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue, loading: true, previewTable: false }, () => {
this.getSubmission() this.getSubmission()
})} })}
disableClearable disableClearable
...@@ -554,7 +557,7 @@ export default class SubHolding extends Component { ...@@ -554,7 +557,7 @@ export default class SubHolding extends Component {
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
this.getSubmission() this.getSubmission()
})} })}
disabled={this.state.intent === 'Home' ? true : false} disabled={this.state.intent === 'Home' ? true : false}
......
...@@ -310,7 +310,7 @@ export default class TableSubHolding extends Component { ...@@ -310,7 +310,7 @@ export default class TableSubHolding extends Component {
// } // }
if (forecast != undefined) { if (forecast != undefined) {
console.log(dataTable2[indexID][column]) // console.log(dataTable2[indexID][column])
} }
let valuezz = dataTable2[indexID][column].value == undefined ? dataTable2[indexID][column] : dataTable2[indexID][column].value let valuezz = dataTable2[indexID][column].value == undefined ? dataTable2[indexID][column] : dataTable2[indexID][column].value
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
...@@ -2899,7 +2899,7 @@ export default class TableSubHolding extends Component { ...@@ -2899,7 +2899,7 @@ export default class TableSubHolding extends Component {
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={this.props.type === 1 ? columnDBBS : this.props.type === 2 ? columnDBPLDetail : this.props.type === 3 ? columnDBPL : columns} columns={this.props.type === 2 ? columnDBBS : this.props.type === 1 ? columnDBPLDetail : this.props.type === 3 ? columnDBPL : columns}
options={options} options={options}
/> />
</MuiThemeProvider> </MuiThemeProvider>
......
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