Commit 89e0a0bc authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

upload taxplan

parent 6fe8586b
...@@ -392,27 +392,32 @@ export default class TaxPlanning extends Component { ...@@ -392,27 +392,32 @@ export default class TaxPlanning extends Component {
this.setState({ visibleUpload: false, visibleTP: false, loading: true }) this.setState({ visibleUpload: false, visibleTP: false, loading: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
item.type_report_id, // item.type_report_id,
0,
Number(item.type_report_id.tbc),
Number(item.type_report_id.fcp),
Number(item.type_report_id.tbf),
item.item_report_id, item.item_report_id,
item.parent, item.parent,
item.formula, item.formula,
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level, item.level,
item.description, item.item_report,
{tbc : item.tax_planning.january.tbc, fcp: item.tax_planning.january.fcp, tbf: item.tax_planning.january.tbf}, {tbc : item.january.tbc, fcp: item.january.fcp, tbf: item.january.tbf},
{tbc : item.tax_planning.february.tbc, fcp: item.tax_planning.february.fcp, tbf: item.tax_planning.february.tbf}, {tbc : item.february.tbc, fcp: item.february.fcp, tbf: item.february.tbf},
{tbc : item.tax_planning.march.tbc, fcp: item.tax_planning.march.fcp, tbf: item.tax_planning.march.tbf}, {tbc : item.march.tbc, fcp: item.march.fcp, tbf: item.march.tbf},
{tbc : item.tax_planning.april.tbc, fcp: item.tax_planning.april.fcp, tbf: item.tax_planning.april.tbf}, {tbc : item.april.tbc, fcp: item.april.fcp, tbf: item.april.tbf},
{tbc : item.tax_planning.may.tbc, fcp: item.tax_planning.may.fcp, tbf: item.tax_planning.may.tbf}, {tbc : item.may.tbc, fcp: item.may.fcp, tbf: item.may.tbf},
{tbc : item.tax_planning.june.tbc, fcp: item.tax_planning.june.fcp, tbf: item.tax_planning.june.tbf}, {tbc : item.june.tbc, fcp: item.june.fcp, tbf: item.june.tbf},
{tbc : item.tax_planning.july.tbc, fcp: item.tax_planning.july.fcp, tbf: item.tax_planning.july.tbf}, {tbc : item.july.tbc, fcp: item.july.fcp, tbf: item.july.tbf},
{tbc : item.tax_planning.august.tbc, fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf}, {tbc : item.august.tbc, fcp: item.august.fcp, tbf: item.august.tbf},
{tbc : item.tax_planning.september.tbc, fcp: item.tax_planning.september.fcp, tbf: item.tax_planning.september.tbf}, {tbc : item.september.tbc, fcp: item.september.fcp, tbf: item.september.tbf},
{tbc : item.tax_planning.october.tbc, fcp: item.tax_planning.october.fcp, tbf: item.tax_planning.october.tbf}, {tbc : item.october.tbc, fcp: item.october.fcp, tbf: item.october.tbf},
{tbc : item.tax_planning.november.tbc, fcp: item.tax_planning.november.fcp, tbf: item.tax_planning.november.tbf}, {tbc : item.november.tbc, fcp: item.november.fcp, tbf: item.november.tbf},
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf}, {tbc : item.december.tbc, fcp: item.december.fcp, tbf: item.december.tbf},
item.tax_planning.total_current_year, item.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf}, {tbc : item.total_next_year.tbc, fcp: item.total_next_year.fcp, tbf: item.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf}, {tbc : item.total_more_year.tbc, fcp: item.total_more_year.fcp, tbf: item.total_more_year.tbf},
item.error item.error
] ]
}) })
...@@ -423,7 +428,7 @@ export default class TaxPlanning extends Component { ...@@ -423,7 +428,7 @@ export default class TaxPlanning extends Component {
this.setState({ buttonError: true, errorPreview: true }) this.setState({ buttonError: true, errorPreview: true })
} }
}) })
// console.log(this.state.dataTable); console.log(this.state.dataTable);
}) })
} }
} }
...@@ -434,23 +439,78 @@ export default class TaxPlanning extends Component { ...@@ -434,23 +439,78 @@ export default class TaxPlanning extends Component {
let data = [] let data = []
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[4],
total_actual_before: String(i[6]), january: {
january: String(i[7]), tbc: String(i[9].tbc),
february: String(i[8]), fcp: String(i[9].fcp),
march: String(i[9]), tbf: String(i[9].tbf)
april: String(i[10]), },
may: String(i[11]), february: {
june: String(i[12]), tbc: String(i[10].tbc),
july: String(i[13]), fcp: String(i[10].fcp),
august: String(i[14]), tbf: String(i[10].tbf)
september: String(i[15]), },
october: String(i[16]), march: {
november: String(i[17]), tbc: String(i[11].tbc),
december: String(i[18]), fcp: String(i[11].fcp),
total_current_year: String(i[19]), tbf: String(i[11].tbf)
total_next_year: String(i[20]), },
total_more_year: String(i[21]) april: {
tbc: String(i[12].tbc),
fcp: String(i[12].fcp),
tbf: String(i[12].tbf)
},
may: {
tbc: String(i[13].tbc),
fcp: String(i[13].fcp),
tbf: String(i[13].tbf)
},
june: {
tbc: String(i[14].tbc),
fcp: String(i[14].fcp),
tbf: String(i[14].tbf)
},
july: {
tbc: String(i[15].tbc),
fcp: String(i[15].fcp),
tbf: String(i[15].tbf)
},
august: {
tbc: String(i[16].tbc),
fcp: String(i[16].fcp),
tbf: String(i[16].tbf)
},
september: {
tbc: String(i[17].tbc),
fcp: String(i[17].fcp),
tbf: String(i[17].tbf)
},
october: {
tbc: String(i[18].tbc),
fcp: String(i[18].fcp),
tbf: String(i[18].tbf)
},
november: {
tbc: String(i[19].tbc),
fcp: String(i[19].fcp),
tbf: String(i[19].tbf)
},
december: {
tbc: String(i[20].tbc),
fcp: String(i[20].fcp),
tbf: String(i[20].tbf)
},
total_current_year: String(i[21]),
total_next_year: {
tbc: String(i[22].tbc),
fcp: String(i[22].fcp),
tbf: String(i[22].tbf)
},
total_more_year: {
tbc: String(i[23].tbc),
fcp: String(i[23].fcp),
tbf: String(i[23].tbf)
}
}) })
}) })
let body = { let body = {
...@@ -458,7 +518,7 @@ export default class TaxPlanning extends Component { ...@@ -458,7 +518,7 @@ export default class TaxPlanning extends Component {
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
balance_sheet: data tax_planning: data
} }
console.log(data); console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
...@@ -523,6 +583,18 @@ export default class TaxPlanning extends Component { ...@@ -523,6 +583,18 @@ export default class TaxPlanning extends Component {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].fcp = Number(val)
} }
} }
const handleTotal = (tableMeta) => {
let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) {
let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem)
}
})
dataTable2[tableMeta.rowIndex][19] = total
return total
// console.log(total);
}
const handleValue = (data) => { const handleValue = (data) => {
let total = 0 let total = 0
// console.log(dataTable2) // console.log(dataTable2)
...@@ -4561,13 +4633,14 @@ export default class TaxPlanning extends Component { ...@@ -4561,13 +4633,14 @@ export default class TaxPlanning extends Component {
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider>} </MuiThemeProvider>
</div> </div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
...@@ -4670,13 +4743,14 @@ export default class TaxPlanning extends Component { ...@@ -4670,13 +4743,14 @@ export default class TaxPlanning extends Component {
</div> </div>
{this.state.dataLoaded && ( {this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> {this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
columns={columns} columns={columns}
options={options} options={options}
/> />
</MuiThemeProvider>} </MuiThemeProvider>
</div> </div>
)} )}
</div> </div>
......
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