Commit 473070f8 authored by Deni Rinaldi's avatar Deni Rinaldi

updt balancesheet

parent ee945e60
...@@ -411,23 +411,6 @@ export default class BudgetTahunan extends Component { ...@@ -411,23 +411,6 @@ export default class BudgetTahunan extends Component {
name: "", name: "",
options: { display: false } options: { display: false }
}] }]
const dataTable = [
["1", "Balance Sheet", "done"],
["2", "Profit & Loss", ""],
["3", "CAT", "done"],
["4", "Fixed Assets Movement", ""],
["5", "Tax Planning", "done"],
["6", "Balance Sheet", "done"],
["7", "Profit & Loss", ""],
["8", "CAT", "done"],
["9", "Fixed Assets Movement", ""],
["10", "Tax Planning", "done"],
["11", "Balance Sheet", "done"],
["12", "Profit & Loss", "done"],
["13", "CAT", "done"],
["14", "Fixed Assets Movement", "done"],
["15", "Tax Planning", "done"],
]
const options = { const options = {
filter: false, filter: false,
sort: false, sort: false,
...@@ -440,25 +423,6 @@ export default class BudgetTahunan extends Component { ...@@ -440,25 +423,6 @@ export default class BudgetTahunan extends Component {
rowsPerPageOptions: [5, 25, 100], rowsPerPageOptions: [5, 25, 100],
search: false search: false
} }
const periode = [
{ value: '2021', label: '2021' },
{ value: '2020', label: '2020' },
{ value: '2019', label: '2019' },
{ value: '2018', label: '2018' },
{ value: '2017', label: '2017' },
{ value: '2016', label: '2016' },
]
const perusahaan = [
{ value: 'TAP Group', label: 'TAP Group' },
{ value: '2019', label: '2019' },
{ value: '2018', label: '2018' },
{ value: '2017', label: '2017' },
{ value: '2016', label: '2016' },
]
const revisi = [
{ value: '0', label: '0' },
{ value: '1', label: '1' },
]
const loadingComponent = ( const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}> <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader <PropagateLoader
...@@ -497,10 +461,11 @@ export default class BudgetTahunan extends Component { ...@@ -497,10 +461,11 @@ export default class BudgetTahunan extends Component {
this.getReportAttachment() this.getReportAttachment()
this.getSubmission() this.getSubmission()
})} })}
debug
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) =>
<TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.periode} value={this.state.periode}
/> />
</div> </div>
...@@ -513,7 +478,6 @@ export default class BudgetTahunan extends Component { ...@@ -513,7 +478,6 @@ export default class BudgetTahunan extends Component {
this.getReportAttachment() this.getReportAttachment()
this.getSubmission() this.getSubmission()
})} })}
debug
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
...@@ -528,7 +492,6 @@ export default class BudgetTahunan extends Component { ...@@ -528,7 +492,6 @@ export default class BudgetTahunan extends Component {
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
})} })}
debug
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Revision" margin="normal" style={{ marginTop: 7 }} />}
......
...@@ -44,7 +44,8 @@ export default class BalanceSheet extends Component { ...@@ -44,7 +44,8 @@ export default class BalanceSheet extends Component {
visibleBalanceSheet: true, visibleBalanceSheet: true,
disabledSave: true, disabledSave: true,
editable: false, editable: false,
buttonError: false buttonError: false,
judulColumn: null
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -56,7 +57,7 @@ export default class BalanceSheet extends Component { ...@@ -56,7 +57,7 @@ export default class BalanceSheet extends Component {
} }
getItemHierarki() { getItemHierarki() {
this.setState({ loading: true }) this.setState({ loading: true, judulColumn: null })
let payload = { let payload = {
"report_id": this.props.report_id, "report_id": this.props.report_id,
"revision": Number(this.props.revision), "revision": Number(this.props.revision),
...@@ -67,11 +68,45 @@ export default class BalanceSheet extends Component { ...@@ -67,11 +68,45 @@ export default class BalanceSheet extends Component {
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
console.log(response); console.log(response);
let dataTable = [] let dataTable = []
let res = response.data.data if (response.data) {
console.log(res) let res = response.data.data
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) {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "" : item.balance_sheet.total_actual_before,
item.balance_sheet.january,
item.balance_sheet.february,
item.balance_sheet.march,
item.balance_sheet.april,
item.balance_sheet.may,
item.balance_sheet.june,
item.balance_sheet.july,
item.balance_sheet.august,
item.balance_sheet.september,
item.balance_sheet.october,
item.balance_sheet.november,
item.balance_sheet.december,
item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
}
res.map((item, index) => {
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -96,50 +131,18 @@ export default class BalanceSheet extends Component { ...@@ -96,50 +131,18 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year item.balance_sheet.total_more_year
]) ])
} if (item.children !== null) {
if (item.children !== null) { if (item.children.length > 0) {
if (item.children.length > 0) { item.children.map((items, indexs) => {
item.children.map((items, indexs) => { handlePushChild(items)
handlePushChild(items) })
}) }
} }
} })
this.setState({ dataTable, loading: false, buttonError: true })
} else {
this.setState({ dataTable, loading: false, buttonError: true })
} }
res.map((item, index) => {
dataTable.push([
item.type_report_id,
item.id,
item.parent,
item.formula,
item.level,
item.description,
item.balance_sheet.total_actual_before === null ? "" : item.balance_sheet.total_actual_before,
item.balance_sheet.january,
item.balance_sheet.february,
item.balance_sheet.march,
item.balance_sheet.april,
item.balance_sheet.may,
item.balance_sheet.june,
item.balance_sheet.july,
item.balance_sheet.august,
item.balance_sheet.september,
item.balance_sheet.october,
item.balance_sheet.november,
item.balance_sheet.december,
item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year
])
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items, indexs) => {
handlePushChild(items)
})
}
}
})
this.setState({ dataTable, loading: false, buttonError: true })
}) })
} }
...@@ -230,7 +233,7 @@ export default class BalanceSheet extends Component { ...@@ -230,7 +233,7 @@ export default class BalanceSheet extends Component {
} }
else { else {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
console.log(isi); console.log(resp.rows[2]);
let payload = [] let payload = []
let reg = /^\d+$/; let reg = /^\d+$/;
isi.map((i, index) => { isi.map((i, index) => {
...@@ -264,7 +267,7 @@ export default class BalanceSheet extends Component { ...@@ -264,7 +267,7 @@ export default class BalanceSheet extends Component {
balance_sheet: payload balance_sheet: payload
} }
console.log(body) console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] }) this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
} }
}); });
} }
...@@ -475,7 +478,7 @@ export default class BalanceSheet extends Component { ...@@ -475,7 +478,7 @@ export default class BalanceSheet extends Component {
display: false display: false
} }
}, { }, {
name: "Account", name: this.state.judulColumn !== null ? this.state.judulColumn[1] : "Account",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}> <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
...@@ -513,7 +516,7 @@ export default class BalanceSheet extends Component { ...@@ -513,7 +516,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "31 Dec 2020 Actual", name: this.state.judulColumn !== null ? this.state.judulColumn[2] : "31 Dec 2020 Actual",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -600,7 +603,7 @@ export default class BalanceSheet extends Component { ...@@ -600,7 +603,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Jan 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[3] : "Jan 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -686,7 +689,7 @@ export default class BalanceSheet extends Component { ...@@ -686,7 +689,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Feb 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[4] : "Feb 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -773,7 +776,7 @@ export default class BalanceSheet extends Component { ...@@ -773,7 +776,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Mar 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[5] : "Mar 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -860,7 +863,7 @@ export default class BalanceSheet extends Component { ...@@ -860,7 +863,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Apr 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[6] : "Apr 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -947,7 +950,7 @@ export default class BalanceSheet extends Component { ...@@ -947,7 +950,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "May 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[7] : "May 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1034,7 +1037,7 @@ export default class BalanceSheet extends Component { ...@@ -1034,7 +1037,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Jun 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[8] : "Jun 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1121,7 +1124,7 @@ export default class BalanceSheet extends Component { ...@@ -1121,7 +1124,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Jul 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[9] : "Jul 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1208,7 +1211,7 @@ export default class BalanceSheet extends Component { ...@@ -1208,7 +1211,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Aug 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[10] : "Aug 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1295,7 +1298,7 @@ export default class BalanceSheet extends Component { ...@@ -1295,7 +1298,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Sep 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[11] : "Sep 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1382,7 +1385,7 @@ export default class BalanceSheet extends Component { ...@@ -1382,7 +1385,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Oct 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[12] : "Oct 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1469,7 +1472,7 @@ export default class BalanceSheet extends Component { ...@@ -1469,7 +1472,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Nov 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[13] : "Nov 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1556,7 +1559,7 @@ export default class BalanceSheet extends Component { ...@@ -1556,7 +1559,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Dec 2021", name: this.state.judulColumn !== null ? this.state.judulColumn[14] : "Dec 2021",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -1643,7 +1646,7 @@ export default class BalanceSheet extends Component { ...@@ -1643,7 +1646,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "Current Total", name: this.state.judulColumn !== null ? this.state.judulColumn[15] : "Current Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -1730,7 +1733,7 @@ export default class BalanceSheet extends Component { ...@@ -1730,7 +1733,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "31 Dec 2022 Total", name: this.state.judulColumn !== null ? this.state.judulColumn[16] : "31 Dec 2022 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -1817,7 +1820,7 @@ export default class BalanceSheet extends Component { ...@@ -1817,7 +1820,7 @@ export default class BalanceSheet extends Component {
} }
} }
}, { }, {
name: "31 Dec 2023 Total", name: this.state.judulColumn !== null ? this.state.judulColumn[17] : "31 Dec 2023 Total",
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -1938,7 +1941,7 @@ export default class BalanceSheet extends Component { ...@@ -1938,7 +1941,7 @@ export default class BalanceSheet extends Component {
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
...@@ -2008,12 +2011,12 @@ export default class BalanceSheet extends Component { ...@@ -2008,12 +2011,12 @@ export default class BalanceSheet extends Component {
<div className="col-1"> <div className="col-1">
<button <button
type="button" type="button"
onClick={() => this.state.editable === true ? onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.backToMasterBudget('draft') this.backToMasterBudget('draft')
}, 100); }, 100);
}) : }) :
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
...@@ -2098,11 +2101,11 @@ export default class BalanceSheet extends Component { ...@@ -2098,11 +2101,11 @@ export default class BalanceSheet extends Component {
<div style={{ padding: 25 }}> <div style={{ padding: 25 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
......
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