Commit a6412ce7 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni' into 'master'

sub holdingggg

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