Commit 207d6702 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into deni-dev(pc)

parents be142012 fa3f1797
......@@ -346,6 +346,7 @@ export default class FixedAssetsMovement extends Component {
})
})
let body = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
......@@ -383,6 +384,50 @@ export default class FixedAssetsMovement extends Component {
}
}
handleValidate() {
let data = []
// console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
total_actual_before: String(i[6]),
january: String(i[7]),
february: String(i[8]),
march: String(i[9]),
april: String(i[10]),
may: String(i[11]),
june: String(i[12]),
july: String(i[13]),
august: String(i[14]),
september: String(i[15]),
october: String(i[16]),
november: String(i[17]),
december: String(i[18]),
total_current_year: String(i[19]),
total_next_year: String(i[20]),
total_more_year: String(i[21])
})
})
// console.log(JSON.stringify(data))
let payload = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
fixed_asset_movement: data,
status: "submitted"
}
console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true })
} else {
this.setState({ loading: false, buttonError: true, editable: true })
}
})
}
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
......@@ -507,8 +552,6 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{/* {console.log(val)} */}
{/* {console.log(tableMeta)} */}
{tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
......@@ -547,8 +590,6 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{console.log(tableMeta)}
{console.log(value)}
{tableMeta.rowData[0] === 4 ?
null
:
......@@ -2012,7 +2053,8 @@ export default class FixedAssetsMovement extends Component {
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true })
// this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate()
}, 100);
})
}}
......
......@@ -93,7 +93,8 @@ export default class TaxPlanning extends Component {
{tbc : item.tax_planning.may.tbc, fcp: item.tax_planning.may.fcp, tbf: item.tax_planning.may.tbf},
{tbc : item.tax_planning.june.tbc, fcp: item.tax_planning.june.fcp, tbf: item.tax_planning.june.tbf},
{tbc : item.tax_planning.july.tbc, fcp: item.tax_planning.july.fcp, tbf: item.tax_planning.july.tbf},
{tbc : item.tax_planning.august.tbc, fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf},
{tbc : item.tax_planning.august.tbc === null ? "0" : item.tax_planning.august.tbc === "" ? "0" : item.tax_planning.august.tbc,
fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf},
{tbc : item.tax_planning.september.tbc, fcp: item.tax_planning.september.fcp, tbf: item.tax_planning.september.tbf},
{tbc : item.tax_planning.october.tbc, fcp: item.tax_planning.october.fcp, tbf: item.tax_planning.october.tbf},
{tbc : item.tax_planning.november.tbc, fcp: item.tax_planning.november.fcp, tbf: item.tax_planning.november.tbf},
......@@ -129,7 +130,8 @@ export default class TaxPlanning extends Component {
{tbc : item.tax_planning.may.tbc, fcp: item.tax_planning.may.fcp, tbf: item.tax_planning.may.tbf},
{tbc : item.tax_planning.june.tbc, fcp: item.tax_planning.june.fcp, tbf: item.tax_planning.june.tbf},
{tbc : item.tax_planning.july.tbc, fcp: item.tax_planning.july.fcp, tbf: item.tax_planning.july.tbf},
{tbc : item.tax_planning.august.tbc, fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf},
{tbc : item.tax_planning.august.tbc === null ? "0" : item.tax_planning.august.tbc === "" ? "0" : item.tax_planning.august.tbc,
fcp: item.tax_planning.august.fcp, tbf: item.tax_planning.august.tbf},
{tbc : item.tax_planning.september.tbc, fcp: item.tax_planning.september.fcp, tbf: item.tax_planning.september.tbf},
{tbc : item.tax_planning.october.tbc, fcp: item.tax_planning.october.fcp, tbf: item.tax_planning.october.tbf},
{tbc : item.tax_planning.november.tbc, fcp: item.tax_planning.november.fcp, tbf: item.tax_planning.november.tbf},
......@@ -191,75 +193,75 @@ export default class TaxPlanning extends Component {
data.push({
item_report_id: i[4],
january: {
TBC: String(i[9].tbc),
FCP: String(i[9].fcp),
TBF: String(i[9].tbf)
tbc: String(i[9].tbc),
fcp: String(i[9].fcp),
tbf: String(i[9].tbf)
},
february: {
TBC: String(i[10].tbc),
FCP: String(i[10].fcp),
TBF: String(i[10].tbf)
tbc: String(i[10].tbc),
fcp: String(i[10].fcp),
tbf: String(i[10].tbf)
},
march: {
TBC: String(i[11].tbc),
FCP: String(i[11].fcp),
TBF: String(i[11].tbf)
tbc: String(i[11].tbc),
fcp: String(i[11].fcp),
tbf: String(i[11].tbf)
},
april: {
TBC: String(i[12].tbc),
FCP: String(i[12].fcp),
TBF: String(i[12].tbf)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
tbc: String(i[23].tbc),
fcp: String(i[23].fcp),
tbf: String(i[23].tbf)
}
})
})
......@@ -296,75 +298,75 @@ export default class TaxPlanning extends Component {
// item_report_name: this.state.reportName,
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
january: {
TBC: i[2] === undefined ? "" : String(i[2]).trim(),
FCP: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
TBF: i[4] === undefined ? "" : String(i[4]).trim()
tbc: i[2] === undefined ? "" : String(i[2]).trim(),
fcp: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
tbf: i[4] === undefined ? "" : String(i[4]).trim()
},
february: {
TBC: String(i[10].tbc),
FCP: String(i[10].fcp),
TBF: String(i[10].tbf)
tbc: i[5] === undefined ? "" : String(i[5]).trim(),
fcp: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
tbf: i[7] === undefined ? "" : String(i[7]).trim()
},
march: {
TBC: String(i[11].tbc),
FCP: String(i[11].fcp),
TBF: String(i[11].tbf)
tbc: i[8] === undefined ? "" : String(i[8]).trim(),
fcp: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
tbf: i[10] === undefined ? "" : String(i[10]).trim(),
},
april: {
TBC: String(i[12].tbc),
FCP: String(i[12].fcp),
TBF: String(i[12].tbf)
tbc: i[11] === undefined ? "" : String(i[11]).trim(),
fcp: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
tbf: i[13] === undefined ? "" : String(i[13]).trim()
},
may: {
TBC: String(i[13].tbc),
FCP: String(i[13].fcp),
TBF: String(i[13].tbf)
tbc: i[14] === undefined ? "" : String(i[14]).trim(),
fcp: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
tbf: i[16] === undefined ? "" : String(i[16]).trim()
},
june: {
TBC: String(i[14].tbc),
FCP: String(i[14].fcp),
TBF: String(i[14].tbf)
tbc: i[17] === undefined ? "" : String(i[17]).trim(),
fcp: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim(),
tbf: i[19] === undefined ? "" : String(i[19]).trim()
},
july: {
TBC: String(i[15].tbc),
FCP: String(i[15].fcp),
TBF: String(i[15].tbf)
tbc: i[20] === undefined ? "" : String(i[20]).trim(),
fcp: i[21] === undefined ? "0" : reg.test(String(i[21])) === false ? "0" : String(i[21]).trim(),
tbf: i[22] === undefined ? "" : String(i[22]).trim()
},
august: {
TBC: String(i[16].tbc),
FCP: String(i[16].fcp),
TBF: String(i[16].tbf)
tbc: i[23] === undefined ? "" : String(i[23]).trim(),
fcp: i[24] === undefined ? "0" : reg.test(String(i[24])) === false ? "0" : String(i[24]).trim(),
tbf: i[25] === undefined ? "" : String(i[25]).trim()
},
september: {
TBC: String(i[17].tbc),
FCP: String(i[17].fcp),
TBF: String(i[17].tbf)
tbc: i[26] === undefined ? "" : String(i[26]).trim(),
fcp: i[27] === undefined ? "0" : reg.test(String(i[27])) === false ? "0" : String(i[27]).trim(),
tbf: i[28] === undefined ? "" : String(i[28]).trim()
},
october: {
TBC: String(i[18].tbc),
FCP: String(i[18].fcp),
TBF: String(i[18].tbf)
tbc: i[29] === undefined ? "" : String(i[29]).trim(),
fcp: i[30] === undefined ? "0" : reg.test(String(i[30])) === false ? "0" : String(i[30]).trim(),
tbf: i[31] === undefined ? "" : String(i[31]).trim()
},
november: {
TBC: String(i[19].tbc),
FCP: String(i[19].fcp),
TBF: String(i[19].tbf)
tbc: i[32] === undefined ? "" : String(i[32]).trim(),
fcp: i[33] === undefined ? "0" : reg.test(String(i[33])) === false ? "0" : String(i[33]).trim(),
tbf: i[34] === undefined ? "" : String(i[34]).trim()
},
december: {
TBC: String(i[20].tbc),
FCP: String(i[20].fcp),
TBF: String(i[20].tbf)
tbc: i[35] === undefined ? "" : String(i[35]).trim(),
fcp: i[36] === undefined ? "0" : reg.test(String(i[36])) === false ? "0" : String(i[36]).trim(),
tbf: i[37] === undefined ? "" : String(i[37]).trim()
},
total_current_year: String(i[21]),
total_current_year: i[38] === undefined ? "" : String(i[38]).trim(),
total_next_year: {
TBC: String(i[22].tbc),
FCP: String(i[22].fcp),
TBF: String(i[22].tbf)
tbc: i[39] === undefined ? "" : String(i[39]).trim(),
fcp: i[40] === undefined ? "0" : reg.test(String(i[40])) === false ? "0" : String(i[40]).trim(),
tbf: i[41] === undefined ? "" : String(i[41]).trim()
},
total_more_year: {
TBC: String(i[23].tbc),
FCP: String(i[23].fcp),
TBF: String(i[23].tbf)
tbc: i[42] === undefined ? "" : String(i[42]).trim(),
fcp: i[43] === undefined ? "0" : reg.test(String(i[43])) === false ? "0" : String(i[43]).trim(),
tbf: i[44] === undefined ? "" : String(i[44]).trim()
}
})
}
......@@ -373,7 +375,7 @@ export default class TaxPlanning extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
balance_sheet: payload
tax_planning: payload
}
console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
......@@ -383,49 +385,154 @@ export default class TaxPlanning extends Component {
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(JSON.stringify(this.state.payload));
console.log(response)
// if (response.data) {
// if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleTP: false, loading: true })
// let dataTable = response.data.data.map((item, index) => {
// return [
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
// item.type_report_id,
// item.item_report_id,
// item.parent,
// item.formula,
// item.level,
// item.item_report,
// item.total_actual_before,
// item.january,
// item.february,
// item.march,
// item.april,
// item.may,
// item.june,
// item.july,
// item.august,
// item.september,
// item.october,
// item.november,
// item.december,
// item.total_current_year,
// item.total_next_year,
// item.total_more_year,
// item.error
// ]
// })
// this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
// this.state.dataTable.map(item => {
// if (item[22].length > 0) {
// console.log('masuk')
// this.setState({ buttonError: true, errorPreview: true })
// }
// })
// // console.log(this.state.dataTable);
// })
// }
// }
0,
Number(item.type_report_id.tbc),
Number(item.type_report_id.fcp),
Number(item.type_report_id.tbf),
item.item_report_id,
item.parent,
item.formula,
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level,
item.item_report,
{tbc : item.january.tbc, fcp: item.january.fcp, tbf: item.january.tbf},
{tbc : item.february.tbc, fcp: item.february.fcp, tbf: item.february.tbf},
{tbc : item.march.tbc, fcp: item.march.fcp, tbf: item.march.tbf},
{tbc : item.april.tbc, fcp: item.april.fcp, tbf: item.april.tbf},
{tbc : item.may.tbc, fcp: item.may.fcp, tbf: item.may.tbf},
{tbc : item.june.tbc, fcp: item.june.fcp, tbf: item.june.tbf},
{tbc : item.july.tbc, fcp: item.july.fcp, tbf: item.july.tbf},
{tbc : item.august.tbc, fcp: item.august.fcp, tbf: item.august.tbf},
{tbc : item.september.tbc, fcp: item.september.fcp, tbf: item.september.tbf},
{tbc : item.october.tbc, fcp: item.october.fcp, tbf: item.october.tbf},
{tbc : item.november.tbc, fcp: item.november.fcp, tbf: item.november.tbf},
{tbc : item.december.tbc, fcp: item.december.fcp, tbf: item.december.tbf},
item.total_current_year,
{tbc : item.total_next_year.tbc, fcp: item.total_next_year.fcp, tbf: item.total_next_year.tbf},
{tbc : item.total_more_year.tbc, fcp: item.total_more_year.fcp, tbf: item.total_more_year.tbf},
item.error
]
})
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
this.state.dataTable.map(item => {
if (item[24].length > 0) {
console.log('masuk')
this.setState({ buttonError: true, errorPreview: true })
}
})
console.log(this.state.dataTable);
})
}
}
})
}
uploadTP() {
let data = []
this.state.dataTable.map(i => {
data.push({
item_report_id: i[4],
january: {
tbc: String(i[9].tbc),
fcp: String(i[9].fcp),
tbf: String(i[9].tbf)
},
february: {
tbc: String(i[10].tbc),
fcp: String(i[10].fcp),
tbf: String(i[10].tbf)
},
march: {
tbc: String(i[11].tbc),
fcp: String(i[11].fcp),
tbf: String(i[11].tbf)
},
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 = {
submission_id: this.props.submissionID,
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
tax_planning: data
}
console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
}
} else {
alert(response.problem)
}
})
}
......@@ -476,6 +583,18 @@ export default class TaxPlanning extends Component {
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) => {
let total = 0
// console.log(dataTable2)
......@@ -586,8 +705,8 @@ export default class TaxPlanning extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ?
{tableMeta.rowData[24] ?
tableMeta.rowData[24].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
......@@ -4514,13 +4633,14 @@ export default class TaxPlanning extends Component {
</div>
<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
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
......@@ -4623,13 +4743,14 @@ export default class TaxPlanning extends Component {
</div>
{this.state.dataLoaded && (
<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
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
)}
</div>
......@@ -4675,7 +4796,7 @@ export default class TaxPlanning extends Component {
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadBalanceSheet()
this.uploadTP()
}, 100);
})}
>
......
......@@ -362,7 +362,7 @@ export default class CreateManagementDoc extends Component {
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xls", "xlsx", "pdf", "PDF"]}
acceptedFiles={["xls", "xlsx", "pdf", "PDF", "docx", "doc", "pptx", "ppt", "ods", "odf" ]}
intent={"management"}
onHandle={(dt) => {
this.fileHandler(dt)
......
......@@ -407,7 +407,7 @@ export default class EditManagementDoc extends Component {
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
acceptedFiles={["xls", "xlsx", "pdf", "PDF"]}
acceptedFiles={["xls", "xlsx", "pdf", "PDF", "docx", "doc", "pptx", "ppt", "ods", "odf" ]}
intent={"management"}
onHandle={(dt) => {
this.fileHandler(dt)
......
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